schemaviewer.py
changeset 5234 e2476d78b060
parent 5233 673b63953e7a
equal deleted inserted replaced
5233:673b63953e7a 5234:e2476d78b060
    36             acls += (Text(rqlexp.expression) for rqlexp in schema.get_rqlexprs(access_type))
    36             acls += (Text(rqlexp.expression) for rqlexp in schema.get_rqlexprs(access_type))
    37             acls = [n for _n in acls for n in (_n, Text(', '))][:-1]
    37             acls = [n for _n in acls for n in (_n, Text(', '))][:-1]
    38             data.append(Span(children=acls))
    38             data.append(Span(children=acls))
    39         return Section(children=(Table(cols=2, cheaders=1, rheaders=1, children=data),),
    39         return Section(children=(Table(cols=2, cheaders=1, rheaders=1, children=data),),
    40                        klass='acl')
    40                        klass='acl')
    41 
       
    42 
    41 
    43     def visit_schema(self, schema, display_relations=0, skiptypes=()):
    42     def visit_schema(self, schema, display_relations=0, skiptypes=()):
    44         """get a layout for a whole schema"""
    43         """get a layout for a whole schema"""
    45         title = Title(self.req._('Schema %s') % schema.name,
    44         title = Title(self.req._('Schema %s') % schema.name,
    46                       klass='titleUnderline')
    45                       klass='titleUnderline')
   185                 rdef = rschema.rdef(subjtype, objtype)
   184                 rdef = rschema.rdef(subjtype, objtype)
   186                 for prop in properties:
   185                 for prop in properties:
   187                     val = getattr(rdef, prop)
   186                     val = getattr(rdef, prop)
   188                     if val is None:
   187                     if val is None:
   189                         val = ''
   188                         val = ''
       
   189                     elif prop == 'constraints':
       
   190                         val = ', '.join([c.restriction for c in val])
   190                     elif isinstance(val, (list, tuple)):
   191                     elif isinstance(val, (list, tuple)):
   191                         val = ', '.join(str(v) for v in val)
   192                         val = ', '.join(str(v) for v in val)
   192                     elif val and isinstance(val, basestring):
   193                     elif val and isinstance(val, basestring):
   193                         val = _(val)
   194                         val = _(val)
   194                     else:
   195                     else: