From fc5e626e8fda6b501fb1128cee6a04f74aa884db Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20P=C3=A9ters?= Date: Wed, 2 May 2012 14:17:18 +0200 Subject: [PATCH] fix handling of attribute_name in PreviewDoc --- themis/fields/__init__.py | 2 +- themis/fields/widgets.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/themis/fields/__init__.py b/themis/fields/__init__.py index 19d31d2..6c2b4fe 100644 --- a/themis/fields/__init__.py +++ b/themis/fields/__init__.py @@ -421,7 +421,7 @@ class PreviewDoc(Field): implements(IPreviewDoc, IFromUnicode) def __init__(self, **kw): - for attr in ('height', 'width'): + for attr in ('height', 'width', 'attribute_name'): if kw.get(attr): setattr(self, attr, kw.get('attr')) if attr in kw: diff --git a/themis/fields/widgets.py b/themis/fields/widgets.py index 5e6447f..5b35db9 100644 --- a/themis/fields/widgets.py +++ b/themis/fields/widgets.py @@ -422,7 +422,7 @@ class PreviewDocWidget(Widget): return u'100px' def get_attribute_name(self): - if hasattr(self.field, 'attribute_name'): + if hasattr(self.field, 'attribute_name') and self.field.attribute_name: return self.field.attribute_name else: return 'fichier'