Fix not working Create views (committed in r864). Check if entity exist in constructKeyNameSuffix funtion and apply changes to affected files.
authorPawel Solyga <Pawel.Solyga@gmail.com>
Wed, 22 Oct 2008 17:03:08 +0000
changeset 407 3cf5630d86d1
parent 406 cc603a815cad
child 408 7cd6bdfbf95c
Fix not working Create views (committed in r864). Check if entity exist in constructKeyNameSuffix funtion and apply changes to affected files. Patch by: Pawel Solyga Review by: to-be-reviewed
app/soc/logic/models/base.py
app/soc/views/models/base.py
--- a/app/soc/logic/models/base.py	Wed Oct 22 16:55:35 2008 +0000
+++ b/app/soc/logic/models/base.py	Wed Oct 22 17:03:08 2008 +0000
@@ -151,6 +151,9 @@
           of this entity.
     """
 
+    if not entity:
+      return None
+    
     suffix = []
 
     for field in entity.KEY_FIELDS:
--- a/app/soc/views/models/base.py	Wed Oct 22 16:55:35 2008 +0000
+++ b/app/soc/views/models/base.py	Wed Oct 22 17:03:08 2008 +0000
@@ -352,10 +352,7 @@
       form: the form that will be used
     """
 
-    if entity:
-      suffix = self._logic.constructKeyNameSuffix(entity)
-    else:
-      suffix = None
+    suffix = self._logic.constructKeyNameSuffix(entity)
 
     context['form'] = form
     context['entity'] = entity