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()) self.findvalue = ox.decodeHtml(ox.stripTags(self.value).strip())
sortvalue = sort_string(self.findvalue) sortvalue = sort_string(self.findvalue)
if sortvalue: if sortvalue:
self.sortvalue = sortvalue[:1000] self.sortvalue = sortvalue[:900]
else: else:
self.sortvalue = None self.sortvalue = None
else: else:

View file

@ -41,7 +41,7 @@ class MetaClip:
[a.sortvalue [a.sortvalue
for a in self.annotations.filter(layer=l).order_by('sortvalue')])) for a in self.annotations.filter(layer=l).order_by('sortvalue')]))
if sortvalue: if sortvalue:
self.sortvalue = sortvalue[:1000] self.sortvalue = sortvalue[:900]
else: else:
self.sortvalue = None self.sortvalue = None
self.findvalue = '\n'.join(filter(None, [a.findvalue for a in self.annotations.all()])) 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() Facet.objects.filter(item=self, key=key, value__in=removed_values).delete()
for value in current_values: for value in current_values:
if value not in saved_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) Facet.objects.get_or_create(item=self, key=key, value=value, sortvalue=sortvalue)
def update_layer_facets(self): def update_layer_facets(self):
@ -835,7 +835,7 @@ class Item(models.Model):
sortvalue = value sortvalue = value
if key in self.person_keys + ['name']: if key in self.person_keys + ['name']:
sortvalue = get_name_sort(value) 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) Facet.objects.get_or_create(item=self, key=key, value=value, sortvalue=sortvalue)
self.update_layer_facets() self.update_layer_facets()
@ -1350,7 +1350,7 @@ class Facet(models.Model):
def save(self, *args, **kwargs): def save(self, *args, **kwargs):
if not self.sortvalue: 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) super(Facet, self).save(*args, **kwargs)
class Description(models.Model): class Description(models.Model):

View file

@ -52,6 +52,7 @@ def padma_video(request, url):
else: else:
alias = get_object_or_404(models.IDAlias, old=hid) alias = get_object_or_404(models.IDAlias, old=hid)
url = '/%s' % alias.new url = '/%s' % alias.new
if view:
timecodes = re.compile('(\d{2}:\d{2}:\d{2}\.\d{3})-(\d{2}:\d{2}:\d{2}\.\d{3})').findall(view) timecodes = re.compile('(\d{2}:\d{2}:\d{2}\.\d{3})-(\d{2}:\d{2}:\d{2}\.\d{3})').findall(view)
if timecodes: if timecodes:
view = ','.join(timecodes[0]) view = ','.join(timecodes[0])