fix handling of attribute_name in PreviewDoc

This commit is contained in:
Frédéric Péters 2012-05-02 14:17:18 +02:00
parent 65c40ac744
commit fc5e626e8f
2 changed files with 2 additions and 2 deletions

View File

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

View File

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