From 8a4d4f029e822ff81d97c5fcee8c46f93c5385ec Mon Sep 17 00:00:00 2001 From: j <0x006A@0x2620.org> Date: Tue, 14 Feb 2012 19:14:54 +0530 Subject: [PATCH] max length, dont fail for layer redirects --- pandora/annotation/models.py | 2 +- pandora/clip/models.py | 2 +- pandora/item/models.py | 6 +++--- pandora/urlalias/views.py | 7 ++++--- 4 files changed, 9 insertions(+), 8 deletions(-) diff --git a/pandora/annotation/models.py b/pandora/annotation/models.py index a4b139be..618759d1 100644 --- a/pandora/annotation/models.py +++ b/pandora/annotation/models.py @@ -129,7 +129,7 @@ class Annotation(models.Model): self.findvalue = ox.decodeHtml(ox.stripTags(self.value).strip()) sortvalue = sort_string(self.findvalue) if sortvalue: - self.sortvalue = sortvalue[:1000] + self.sortvalue = sortvalue[:900] else: self.sortvalue = None else: diff --git a/pandora/clip/models.py b/pandora/clip/models.py index 715c142a..8bf60aae 100644 --- a/pandora/clip/models.py +++ b/pandora/clip/models.py @@ -41,7 +41,7 @@ class MetaClip: [a.sortvalue for a in self.annotations.filter(layer=l).order_by('sortvalue')])) if sortvalue: - self.sortvalue = sortvalue[:1000] + self.sortvalue = sortvalue[:900] else: self.sortvalue = None self.findvalue = '\n'.join(filter(None, [a.findvalue for a in self.annotations.all()])) diff --git a/pandora/item/models.py b/pandora/item/models.py index e8776192..a96641c0 100644 --- a/pandora/item/models.py +++ b/pandora/item/models.py @@ -791,7 +791,7 @@ class Item(models.Model): Facet.objects.filter(item=self, key=key, value__in=removed_values).delete() for value in current_values: if value not in saved_values: - sortvalue = value.lower() + sortvalue = value.lower()[:900] Facet.objects.get_or_create(item=self, key=key, value=value, sortvalue=sortvalue) def update_layer_facets(self): @@ -835,7 +835,7 @@ class Item(models.Model): sortvalue = value if key in self.person_keys + ['name']: sortvalue = get_name_sort(value) - sortvalue = sortvalue.lower() + sortvalue = sortvalue.lower()[:900] Facet.objects.get_or_create(item=self, key=key, value=value, sortvalue=sortvalue) self.update_layer_facets() @@ -1350,7 +1350,7 @@ class Facet(models.Model): def save(self, *args, **kwargs): if not self.sortvalue: - self.sortvalue = utils.sort_string(self.value).lower() + self.sortvalue = utils.sort_string(self.value).lower()[:900] super(Facet, self).save(*args, **kwargs) class Description(models.Model): diff --git a/pandora/urlalias/views.py b/pandora/urlalias/views.py index c9c741fb..3148fa0f 100644 --- a/pandora/urlalias/views.py +++ b/pandora/urlalias/views.py @@ -52,9 +52,10 @@ def padma_video(request, url): else: alias = get_object_or_404(models.IDAlias, old=hid) url = '/%s' % alias.new - timecodes = re.compile('(\d{2}:\d{2}:\d{2}\.\d{3})-(\d{2}:\d{2}:\d{2}\.\d{3})').findall(view) - if timecodes: - view = ','.join(timecodes[0]) + if view: + timecodes = re.compile('(\d{2}:\d{2}:\d{2}\.\d{3})-(\d{2}:\d{2}:\d{2}\.\d{3})').findall(view) + if timecodes: + view = ','.join(timecodes[0]) if view: url += '/' + { 'editor': 'timeline',