[cw source ui] fix mapping checking for datafeed source (avoid false positive error, but doesn't check that much things)
--- a/web/views/cwsources.py Thu May 12 10:22:17 2011 +0200
+++ b/web/views/cwsources.py Fri May 13 10:09:52 2011 +0200
@@ -126,6 +126,8 @@
else: # CWAttribute/CWRelation
self.srelations.setdefault(cwerschema.rtype.name, []).append(
(cwerschema.stype.name, cwerschema.otype.name) )
+ self.sentities.add(cwerschema.stype.name)
+ self.sentities.add(cwerschema.otype.name)
def check(self):
self.init()
@@ -154,14 +156,15 @@
warning(_('relation %(rtype)s with %(etype)s as %(role)s is '
'supported but no target type supported') %
{'rtype': rschema, 'role': role, 'etype': etype})
- for rtype in self.srelations:
- rschema = self.schema[rtype]
- for subj, obj in rschema.rdefs:
- if subj in self.sentities and obj in self.sentities:
- break
- else:
- error(_('relation %s is supported but none if its definitions '
- 'matches supported entities') % rtype)
+ for rtype, rdefs in self.srelations.iteritems():
+ if rdefs is None:
+ rschema = self.schema[rtype]
+ for subj, obj in rschema.rdefs:
+ if subj in self.sentities and obj in self.sentities:
+ break
+ else:
+ error(_('relation %s is supported but none of its definitions '
+ 'matches supported entities') % rtype)
self.custom_check()
def custom_check(self):