Commit 655ee640 authored by Arnaud Fontaine's avatar Arnaud Fontaine

When importing from filesystem, do not check whether the source code is syntactically correct.

Errors may occur if in the same transaction a Component is created and
another one depending upon the former...
parent 801a347e
......@@ -222,16 +222,18 @@ class ComponentMixin(Base):
with open(path) as f:
source_code = f.read()
# Try to load it first
namespace_dict = {}
exec source_code in namespace_dict
# Checking that the source code is syntactically correct is not
# needed when importing from filesystem, moreover errors may occur
# if in the same transaction a Component is created and another
# one depending upon the former...
new_component = context.newContent(id=object_id,
reference=reference,
version=version,
text_content=source_code,
portal_type=cls.portal_type)
# Validate the Component once it is imported so it can be used
# straightaway as there should be no error
new_component.validate()
# XXX-arnau: is it really safe?
......
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