Merge pull request #228 from tkf/fix-full_name

Fix full_name for import statements
This commit is contained in:
David Halter
2013-05-21 09:11:15 -07:00
3 changed files with 103 additions and 23 deletions

View File

@@ -142,9 +142,19 @@ class BaseDefinition(object):
def path(self):
"""The module path."""
path = []
def insert_nonnone(x):
if x:
path.insert(0, x)
if not isinstance(self._definition, keywords.Keyword):
par = self._definition
while par is not None:
if isinstance(par, pr.Import):
insert_nonnone(par.namespace)
insert_nonnone(par.from_ns)
if par.relative_count == 0:
break
with common.ignored(AttributeError):
path.insert(0, par.name)
par = par.parent