# HG changeset patch # User sylvain.thenault@logilab.fr # Date 1236765752 -3600 # Node ID 5040a5835e4d3adccce19cfecc84314edc8e7f7c # Parent 3672a7c86784d2953bab7f7506bf3d487786d36b accept req as parameter for convenience diff -r 3672a7c86784 -r 5040a5835e4d 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