# HG changeset patch # User Sylvain Thénault <sylvain.thenault@logilab.fr> # Date 1286203680 -7200 # Mon Oct 04 16:48:00 2010 +0200 # Branch stable # Node ID 7e89c67363824ef31785cfab4987cbdc1268181b # Parent 8d097456fa5b90d5a51e2ecca5bd2c962d82c3d5 take care: lhsvar/rhsvar may be None diff --git a/nodes.py b/nodes.py --- a/nodes.py +++ b/nodes.py @@ -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')