max length, dont fail for layer redirects

This commit is contained in:
j 2012-02-14 19:14:54 +05:30
parent 6ca4edf742
commit 8a4d4f029e
4 changed files with 9 additions and 8 deletions

View file

@ -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:

View file

@ -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()]))

View file

@ -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):

View file

@ -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',