schema.py
branchtls-sprint
changeset 1045 5040a5835e4d
parent 1034 0356bbfb2f26
child 1090 a99dc223c583
--- a/schema.py	Wed Mar 11 11:01:52 2009 +0100
+++ b/schema.py	Wed Mar 11 11:02:32 2009 +0100
@@ -968,6 +968,7 @@
                        )
     def __init__(self):
         pass
+    
     def serialize(self):
         """called to make persistent valuable data of a constraint"""
         return None
@@ -979,8 +980,10 @@
         """
         return cls()
     
-    def vocabulary(self, entity=None):
-        if entity and entity.req.user.has_permission(PERM_USE_TEMPLATE_FORMAT):
+    def vocabulary(self, entity=None, req=None):
+        if req is None and entity is not None:
+            req = entity.req
+        if req is not None and req.user.has_permission(PERM_USE_TEMPLATE_FORMAT):
             return self.regular_formats + tuple(self.need_perm_formats)
         return self.regular_formats