dont fail if clipLayers is missing

This commit is contained in:
j 2012-04-02 17:33:09 +02:00
parent 513e79b431
commit 9da8c75f70
3 changed files with 3 additions and 3 deletions

View file

@ -141,7 +141,7 @@ class Annotation(models.Model):
self.sortvalue = None self.sortvalue = None
#no clip or update clip #no clip or update clip
if self.layer in settings.CONFIG['clipLayers']: if self.layer in settings.CONFIG.get('clipLayers', []):
if not self.clip or self.start != self.clip.start or self.end != self.clip.end: if not self.clip or self.start != self.clip.start or self.end != self.clip.end:
self.clip, created = Clip.get_or_create(self.item, self.start, self.end) self.clip, created = Clip.get_or_create(self.item, self.start, self.end)
elif self.clip: elif self.clip:

View file

@ -37,7 +37,7 @@ def parseCondition(condition, user):
op = condition.get('operator') op = condition.get('operator')
if not op: if not op:
op = '' op = ''
if k in settings.CONFIG['clipLayers']: if k in settings.CONFIG.get('clipLayers', []):
return parseCondition({'key': 'annotations__findvalue', return parseCondition({'key': 'annotations__findvalue',
'value': v, 'value': v,
'operator': op}, user) \ 'operator': op}, user) \

View file

@ -39,7 +39,7 @@ class MetaClip:
if self.id: if self.id:
sortvalue = '' sortvalue = ''
if self.id: if self.id:
for l in settings.CONFIG['clipLayers']: for l in settings.CONFIG.get('clipLayers', []):
sortvalue += ''.join(filter(lambda s: s, sortvalue += ''.join(filter(lambda s: s,
[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')]))