accept req as parameter for convenience tls-sprint
authorsylvain.thenault@logilab.fr
Wed, 11 Mar 2009 11:02:32 +0100
branchtls-sprint
changeset 1045 5040a5835e4d
parent 1044 3672a7c86784
child 1046 52ee022d87e3
accept req as parameter for convenience
schema.py
--- 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