web/views/cwsources.py
branchstable
changeset 7375 c8a8fb32733b
parent 7019 46413742f9b5
child 7455 694b21f0fc62
child 7524 c019c3426049
equal deleted inserted replaced
7374:3c9850d929e5 7375:c8a8fb32733b
   124             assert not cwerschema.name in self.srelations
   124             assert not cwerschema.name in self.srelations
   125             self.srelations[cwerschema.name] = None
   125             self.srelations[cwerschema.name] = None
   126         else: # CWAttribute/CWRelation
   126         else: # CWAttribute/CWRelation
   127             self.srelations.setdefault(cwerschema.rtype.name, []).append(
   127             self.srelations.setdefault(cwerschema.rtype.name, []).append(
   128                 (cwerschema.stype.name, cwerschema.otype.name) )
   128                 (cwerschema.stype.name, cwerschema.otype.name) )
       
   129             self.sentities.add(cwerschema.stype.name)
       
   130             self.sentities.add(cwerschema.otype.name)
   129 
   131 
   130     def check(self):
   132     def check(self):
   131         self.init()
   133         self.init()
   132         error = self.errors.append
   134         error = self.errors.append
   133         warning = self.warnings.append
   135         warning = self.warnings.append
   152                             warning(_('%s could be supported') % rdef)
   154                             warning(_('%s could be supported') % rdef)
   153                 elif not ttypes:
   155                 elif not ttypes:
   154                     warning(_('relation %(rtype)s with %(etype)s as %(role)s is '
   156                     warning(_('relation %(rtype)s with %(etype)s as %(role)s is '
   155                               'supported but no target type supported') %
   157                               'supported but no target type supported') %
   156                             {'rtype': rschema, 'role': role, 'etype': etype})
   158                             {'rtype': rschema, 'role': role, 'etype': etype})
   157         for rtype in self.srelations:
   159         for rtype, rdefs in self.srelations.iteritems():
   158             rschema = self.schema[rtype]
   160             if rdefs is None:
   159             for subj, obj in rschema.rdefs:
   161                 rschema = self.schema[rtype]
   160                 if subj in self.sentities and obj in self.sentities:
   162                 for subj, obj in rschema.rdefs:
   161                     break
   163                     if subj in self.sentities and obj in self.sentities:
   162             else:
   164                         break
   163                 error(_('relation %s is supported but none if its definitions '
   165                 else:
   164                         'matches supported entities') % rtype)
   166                     error(_('relation %s is supported but none of its definitions '
       
   167                             'matches supported entities') % rtype)
   165         self.custom_check()
   168         self.custom_check()
   166 
   169 
   167     def custom_check(self):
   170     def custom_check(self):
   168         pass
   171         pass
   169 
   172