schema.py
branchtls-sprint
changeset 1100 7ca89f4468e4
parent 1099 2353d1472094
child 1101 0c067de38e46
equal deleted inserted replaced
1099:2353d1472094 1100:7ca89f4468e4
   339         """return an iterator on (attribute, format attribute) of rich text field
   339         """return an iterator on (attribute, format attribute) of rich text field
   340 
   340 
   341         (the first tuple element containing the text and the second the text format)
   341         (the first tuple element containing the text and the second the text format)
   342         """
   342         """
   343         for rschema, _ in self.attribute_definitions():
   343         for rschema, _ in self.attribute_definitions():
   344             if rschema.type.endswith('_format'):
   344             if rschema.type.endswith('_format') and self.has_subject_relation(rschema.type[:-7]):
   345                 for constraint in self.constraints(rschema):
   345                 yield self.subject_relation(rschema.type[:-7]), rschema
   346                     if isinstance(constraint, FormatConstraint):
       
   347                         yield self.subject_relation(rschema.type[:-7]), rschema
       
   348                         break
       
   349                     
   346                     
   350     def check_perm(self, session, action, eid=None):
   347     def check_perm(self, session, action, eid=None):
   351         # NB: session may be a server session or a request object
   348         # NB: session may be a server session or a request object
   352         user = session.user
   349         user = session.user
   353         # check user is in an allowed group, if so that's enough
   350         # check user is in an allowed group, if so that's enough