Skip to content

Commit

Permalink
attr.getFileInfo() no longer crashes if the context element wasn't pa…
Browse files Browse the repository at this point in the history
…rsed.
  • Loading branch information
regebro committed Oct 23, 2017
1 parent 5206896 commit 2a7f86c
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 0 deletions.
2 changes: 2 additions & 0 deletions CHANGES.rst
Expand Up @@ -27,6 +27,8 @@ CHANGES

- Support for Python 3.5 [Kyle MacFarlane]

- attr.getFileInfo() crashed if the context element wasn't parsed.


3.1.0 (2016-04-04)
------------------
Expand Down
4 changes: 4 additions & 0 deletions src/z3c/rml/attr.py
Expand Up @@ -37,6 +37,10 @@ def getFileInfo(directive):
root = directive
while root.parent:
root = root.parent
# Elements added through API won't have a sourceline
if directive.element.sourceline is None:
return '(file %s)' % (root.filename)

return '(file %s, line %i)' % (
root.filename, directive.element.sourceline)

Expand Down
Binary file modified src/z3c/rml/rml-reference.pdf
Binary file not shown.
Binary file modified src/z3c/rml/tests/expected/rml-examples-032-images.pdf
Binary file not shown.

0 comments on commit 2a7f86c

Please sign in to comment.