schema.py
branchstable
changeset 3347 428f95118556
parent 3287 19c1011736a6
child 3369 7b88d12b4ee2
child 3554 26e586f3c15c
--- a/schema.py	Mon Sep 21 18:02:21 2009 +0200
+++ b/schema.py	Mon Sep 21 18:02:48 2009 +0200
@@ -958,9 +958,12 @@
 NEED_PERM_FORMATS = [_('text/cubicweb-page-template')]
 
 @monkeypatch(FormatConstraint)
-def vocabulary(self, entity=None, req=None):
-    if req is None and entity is not None:
+def vocabulary(self, entity=None, form=None):
+    req = None
+    if form is None and entity is not None:
         req = entity.req
+    elif form is not None:
+        req = form.req
     if req is not None and req.user.has_permission(PERM_USE_TEMPLATE_FORMAT):
         return self.regular_formats + tuple(NEED_PERM_FORMATS)
     return self.regular_formats