From 666489360f76bd17084a3cea8526897871290ca2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20P=C3=A9ters?= Date: Wed, 19 Oct 2011 12:06:00 +0200 Subject: [PATCH] json: check polgroup is set before inserting it --- themis/datatypes/views.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/themis/datatypes/views.py b/themis/datatypes/views.py index 722ed70..17df8d4 100644 --- a/themis/datatypes/views.py +++ b/themis/datatypes/views.py @@ -10,7 +10,6 @@ class DeputyJson(BrowserView): 'lastname': self.context.lastname, 'active': self.context.active, 'sex': self.context.sex, - 'polgroup': self.context.polgroup.to_object.title, 'district': self.context.district, 'birthplace': self.context.birthplace, 'bio': self.context.bio, @@ -18,6 +17,8 @@ class DeputyJson(BrowserView): 'degrees': self.context.degrees, 'mandates': self.context.mandates, } + if self.context.polgroup: + d['polgroup'] = self.context.polgroup.to_object.title if self.context.picture: d['picture'] = self.context.absolute_url() + '/photo' if self.context.birthdate: