take care: lhsvar/rhsvar may be None stable
authorSylvain Thénault <sylvain.thenault@logilab.fr>
Mon, 04 Oct 2010 16:48:00 +0200
branchstable
changeset 593 7e89c6736382
parent 592 8d097456fa5b
child 594 6eac2a0ea919
take care: lhsvar/rhsvar may be None
nodes.py
--- a/nodes.py	Mon Oct 04 14:44:45 2010 +0200
+++ b/nodes.py	Mon Oct 04 16:48:00 2010 +0200
@@ -926,13 +926,13 @@
             rtype = rel.r_type
             lhs, rhs = rel.get_variable_parts()
             # use getattr, may not be a variable ref (rewritten, constant...)
-            lhsvar = getattr(lhs, 'variable', None)
             rhsvar = getattr(rhs, 'variable', None)
             if mainindex is not None:
                 # relation to the main variable, stop searching
-                if mainindex in lhsvar.stinfo['selected']:
+                lhsvar = getattr(lhs, 'variable', None)
+                if lhsvar is not None and mainindex in lhsvar.stinfo['selected']:
                     return tr(rtype)
-                if mainindex in rhsvar.stinfo['selected']:
+                if rhsvar is not None and mainindex in rhsvar.stinfo['selected']:
                     if schema is not None and rschema.symmetric:
                         return tr(rtype)
                     return tr(rtype + '_object')