From 90bf14cb6a4c9676b2e0b1f326424109d37cfffd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20P=C3=A9ters?= Date: Tue, 11 Oct 2011 10:35:21 -0400 Subject: [PATCH] previewdoc: add correct handling of width/height --- themis/fields/__init__.py | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/themis/fields/__init__.py b/themis/fields/__init__.py index a0f8b41..784dd60 100644 --- a/themis/fields/__init__.py +++ b/themis/fields/__init__.py @@ -398,3 +398,11 @@ class DocHistoLines(Field): class PreviewDoc(Field): implements(IPreviewDoc, IFromUnicode) + + def __init__(self, **kw): + for attr in ('height', 'width'): + if kw.get(attr): + setattr(self, attr, kw.get('attr')) + if attr in kw: + del kw[attr] + super(PreviewDoc, self).__init__(**kw)