[Checkins] SVN: z3c.imagewidget/trunk/src/z3c/imagewidget/form.py
Do not rely on the content of the session. If adding widget
for the first time
Jürgen Kartnaller
juergen at kartnaller.at
Wed Jan 31 09:02:49 EST 2007
Log message for revision 72276:
Do not rely on the content of the session. If adding widget for the first time
'data' is not set in the session.
Changed:
U z3c.imagewidget/trunk/src/z3c/imagewidget/form.py
-=-
Modified: z3c.imagewidget/trunk/src/z3c/imagewidget/form.py
===================================================================
--- z3c.imagewidget/trunk/src/z3c/imagewidget/form.py 2007-01-31 12:07:30 UTC (rev 72275)
+++ z3c.imagewidget/trunk/src/z3c/imagewidget/form.py 2007-01-31 14:02:49 UTC (rev 72276)
@@ -138,14 +138,14 @@
"""
def update(self):
- image = self.context.session['data']
+ image = self.context.session.get('data', None)
if not image:
# show the add form and call update
self.imageForm = AddImageForm(self.context, self.request)
self.imageForm.update()
- if self.context.session['data']:
+ if self.context.session.get('data', None):
# after adding a image show the edit form and return
- image = self.context.session['data']
+ image = self.context.session.get('data', None)
self.imageForm = EditImageForm(image, self.request)
self.imageForm.widget = self.context
self.imageForm.update()
@@ -155,7 +155,7 @@
self.imageForm = EditImageForm(image, self.request)
self.imageForm.widget = self.context
self.imageForm.update()
- if not self.context.session['data']:
+ if not self.context.session.get('data', None):
self.imageForm = AddImageForm(self.context, self.request)
self.imageForm.update()
More information about the Checkins
mailing list