Commit 074e1cdb authored by Arnaud Fontaine's avatar Arnaud Fontaine

ZODB Components: When checking source, improve message when a SyntaxError is...

ZODB Components: When checking source, improve message when a SyntaxError is raised through compile().
parent 9c78c104
...@@ -297,6 +297,11 @@ class ComponentMixin(PropertyRecordableMixin, Base): ...@@ -297,6 +297,11 @@ class ComponentMixin(PropertyRecordableMixin, Base):
compile(source_code, '<string>', 'exec') compile(source_code, '<string>', 'exec')
return [], [] return [], []
except BaseException, error: except BaseException, error:
if isinstance(error, SyntaxError):
error = '%4d, %4d: %s' % (error.lineno,
error.offset,
error.message)
return ['F: %s' % error], [] return ['F: %s' % error], []
import cStringIO import cStringIO
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment