[ms] cleanups stable
authorSylvain Thénault <sylvain.thenault@logilab.fr>
Tue, 03 Aug 2010 12:17:20 +0200
branchstable
changeset 6057 cb5c8852cbda
parent 6056 37a37e5ba330
child 6058 151b6b73acc6
[ms] cleanups
server/msplanner.py
server/sources/__init__.py
server/test/unittest_msplanner.py
--- a/server/msplanner.py	Tue Aug 03 12:17:01 2010 +0200
+++ b/server/msplanner.py	Tue Aug 03 12:17:20 2010 +0200
@@ -419,9 +419,9 @@
                         self._set_source_for_term(source, const)
                         # if system source is used, add every rewritten constant
                         # to its supported terms even when associated entity
-                        # doesn't actually come from it so we get a changes
-                        # that allequals will return True as expected when
-                        # computing needsplit
+                        # doesn't actually come from it so we get a changes that
+                        # allequals will return True as expected when computing
+                        # needsplit
                         # check const is used in a relation restriction
                         if const.relation() and self.system_source in sourcesterms:
                             self._set_source_for_term(self.system_source, const)
@@ -432,7 +432,7 @@
             # process non final relations only
             # note: don't try to get schema for 'is' relation (not available
             # during bootstrap)
-            if not rel.is_types_restriction() and not rschema(rel.r_type).final:
+            if not (rel.is_types_restriction() or rschema(rel.r_type).final):
                 # nothing to do if relation is not supported by multiple sources
                 # or if some source has it listed in its cross_relations
                 # attribute
@@ -1429,8 +1429,8 @@
         if not node.is_types_restriction():
             if node in self.skip and self.solindices.issubset(self.skip[node]):
                 if not self.schema.rschema(node.r_type).final:
-                    # can't really skip the relation if one variable is selected and only
-                    # referenced by this relation
+                    # can't really skip the relation if one variable is selected
+                    # and only referenced by this relation
                     for vref in node.iget_nodes(VariableRef):
                         stinfo = vref.variable.stinfo
                         if stinfo['selected'] and len(stinfo['relations']) == 1:
--- a/server/sources/__init__.py	Tue Aug 03 12:17:01 2010 +0200
+++ b/server/sources/__init__.py	Tue Aug 03 12:17:20 2010 +0200
@@ -182,7 +182,7 @@
             wsupport = self.support_relations[rtype]
         except KeyError:
             rschema = self.schema.rschema(rtype)
-            if not rschema.final or rschema == 'has_text':
+            if not rschema.final or rschema.type == 'has_text':
                 return False
             for etype in rschema.subjects():
                 try:
--- a/server/test/unittest_msplanner.py	Tue Aug 03 12:17:01 2010 +0200
+++ b/server/test/unittest_msplanner.py	Tue Aug 03 12:17:20 2010 +0200
@@ -2256,8 +2256,6 @@
     support_entities = {'Card': True, 'Note': True}
     support_relations = {'multisource_inlined_rel': True,
                          'multisource_rel': True}
-    #dont_cross_relations = set(('fiche', 'in_state'))
-    #cross_relations = set(('multisource_crossed_rel',))
 
     def syntax_tree_search(self, *args, **kwargs):
         return []