Commit 2d5cffaf authored by Julien Muchembled's avatar Julien Muchembled

Fix import/export of new ERP5 Python Scripts

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@38344 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 4288b353
......@@ -582,11 +582,13 @@ class BaseTemplateItem(Implicit, Persistent):
Remove unneeded properties for export
"""
meta_type = getattr(aq_base(obj), 'meta_type', None)
if meta_type == 'Script (Python)':
meta_type = 'ERP5 Python Script'
attr_list = [ '_dav_writelocks', '_filepath', '_owner', 'uid',
'workflow_history', '__ac_local_roles__' ]
attr_list += {
'Script (Python)': ('_lazy_compilation', 'Python_magic'),
'ERP5 Python Script': ('_lazy_compilation', 'Python_magic'),
}.get(meta_type, ())
for attr in attr_list:
......@@ -596,7 +598,7 @@ class BaseTemplateItem(Implicit, Persistent):
if meta_type == 'ERP5 PDF Form':
if not obj.getProperty('business_template_include_content', 1):
obj.deletePdfContent()
elif meta_type == 'Script (Python)':
elif meta_type == 'ERP5 Python Script':
obj._code = None
elif interfaces.IIdGenerator.providedBy(obj):
for dict_name in ('last_max_id_dict', 'last_id_dict'):
......@@ -1036,7 +1038,8 @@ class ObjectTemplateItem(BaseTemplateItem):
# install object
obj = self._objects[path]
if getattr(obj, 'meta_type', None) == 'Script (Python)':
if getattr(obj, 'meta_type', None) in ('Script (Python)',
'ERP5 Python Script'):
if getattr(obj, '_code') is None:
obj._compile()
if getattr(aq_base(obj), 'groups', None) is not None:
......@@ -1825,7 +1828,8 @@ class WorkflowTemplateItem(ObjectTemplateItem):
self._backupObject(action, trashbin, container_path, object_id, keep_subobjects=1)
container.manage_delObjects([object_id])
obj = self._objects[path]
if getattr(obj, 'meta_type', None) == 'Script (Python)':
if getattr(obj, 'meta_type', None) in ('Script (Python)',
'ERP5 Python Script'):
if getattr(obj, '_code') is None:
obj._compile()
obj = obj._getCopy(container)
......
......@@ -6,10 +6,6 @@
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>Python_magic</string> </key>
<value> <string encoding="base64">0fINCg==</string> </value>
</item>
<item>
<key> <string>Script_magic</string> </key>
<value> <int>3</int> </value>
......@@ -52,17 +48,9 @@ return False\n
</item>
<item>
<key> <string>_code</string> </key>
<value> <string encoding="base64">YwAAAAAAAAAAAQAAAAAAAABzDQAAAGQBAIQAAFoAAGQAAFMoAgAAAE5jAgAAAAYAAAAJAAAAAwAA
AHN4AAAAdAAAfAAAgwEAZAEAagIAb1IAAXQAAHwBAIMBAGQCAGoCAG8/AAF0AwB8AABkAwCDAgBk
BABqAgBvKQABdAMAfAAAZAIAgwIAZAUAagIAbxMAAXQDAHwBAGQDAIMCAGQGAGoCAG8IAAF0BABT
bgEAAXQFAFNkAABTKAcAAABOaQIAAABpAQAAAGkAAAAAcxcAAAA8c3RyaW5nPmFwcGVuZDwvc3Ry
aW5nPnMZAAAAPHN0cmluZz4kYXBwZW5kMDwvc3RyaW5nPnMXAAAAPHN0cmluZz4kbGlzdDA8L3N0
cmluZz4oBgAAAHQDAAAAbGVudA0AAABvbGRfbGluZV9saXN0dA0AAABuZXdfbGluZV9saXN0dAkA
AABfZ2V0aXRlbV90BAAAAFRydWV0BQAAAEZhbHNlKAYAAABSAQAAAFICAAAAUgAAAABSAwAAAFIE
AAAAUgUAAAAoAAAAACgAAAAAcxIAAABFUlA1IFB5dGhvbiBTY3JpcHR0IwAAAFRlbXBsYXRlVG9v
bF9maWx0ZXJBcHBlbmRUb0xpc3REaWZmAQAAAHMKAAAAKQEWARYBEwEIAigBAAAAUgYAAAAoAQAA
AFIGAAAAKAAAAAAoAAAAAHMSAAAARVJQNSBQeXRob24gU2NyaXB0cwgAAAA8bW9kdWxlPgEAAAB0
AAAAAA==</string> </value>
<value>
<none/>
</value>
</item>
<item>
<key> <string>_params</string> </key>
......
......@@ -6,10 +6,6 @@
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>Python_magic</string> </key>
<value> <string encoding="base64">0fINCg==</string> </value>
</item>
<item>
<key> <string>Script_magic</string> </key>
<value> <int>3</int> </value>
......@@ -53,16 +49,9 @@ return False\n
</item>
<item>
<key> <string>_code</string> </key>
<value> <string encoding="base64">YwAAAAAAAAAAAQAAAAAAAABzDQAAAGQBAIQAAFoAAGQAAFMoAgAAAE5jAgAAAAYAAAAMAAAAAwAA
AHOXAAAAdAAAfAAAgwEAZAEAagIAb3EAAXQAAHwBAIMBAGQCAGoCAG9eAAF0AwB8AABkAwCDAgBk
BABqAgBvSAABdAMAfAAAZAUAgwIAZAYAagIAbzIAAXQDAHwAAGQHAIMCAGQIAGoCAG8cAAF0AwB8
AABkAgCDAgB0AwB8AQBkAwCDAgBqAgBvCAABdAQAU24BAAF0BQBTZAAAUygJAAAATmkEAAAAaQEA
AABpAAAAAHMHAAAAPHR1cGxlPmkCAAAAcwgAAAA8dHVwbGUvPmkDAAAAcwgAAAA8L3R1cGxlPigG
AAAAdAMAAABsZW50DQAAAG9sZF9saW5lX2xpc3R0DQAAAG5ld19saW5lX2xpc3R0CQAAAF9nZXRp
dGVtX3QEAAAAVHJ1ZXQFAAAARmFsc2UoBgAAAFIBAAAAUgIAAABSAAAAAFIDAAAAUgQAAABSBQAA
ACgAAAAAKAAAAABzEgAAAEVSUDUgUHl0aG9uIFNjcmlwdHQhAAAAVGVtcGxhdGVUb29sX2ZpbHRl
ckNsYXNzVHVwbGVEaWZmAQAAAHMMAAAAKQEWARYBFgEcAQgCKAEAAABSBgAAACgBAAAAUgYAAAAo
AAAAACgAAAAAcxIAAABFUlA1IFB5dGhvbiBTY3JpcHRzCAAAADxtb2R1bGU+AQAAAHQAAAAA</string> </value>
<value>
<none/>
</value>
</item>
<item>
<key> <string>_params</string> </key>
......
......@@ -6,10 +6,6 @@
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>Python_magic</string> </key>
<value> <string encoding="base64">0fINCg==</string> </value>
</item>
<item>
<key> <string>Script_magic</string> </key>
<value> <int>3</int> </value>
......@@ -46,16 +42,9 @@ return False\n
</item>
<item>
<key> <string>_code</string> </key>
<value> <string encoding="base64">YwAAAAAAAAAAAQAAAAAAAABzDQAAAGQBAIQAAFoAAGQAAFMoAgAAAE5jAgAAAAcAAAAHAAAAAwAA
AHNnAAAAdAAAfAAAgwEAZAEAagIAb0EAAXQAAHwBAIMBAGQBAGoCAG8uAAF0AwB8AQBkAgCDAgB0
BAB0AwB8AABkAgCDAgBkAwCDAgBkBABkBQCDAgBqAgBvCAABdAUAU24BAAF0BgBTZAAAUygGAAAA
TmkBAAAAaQAAAAB0BwAAAHJlcGxhY2VzDwAAAEJUcmVlcy5fT09CVHJlZXMOAAAAQlRyZWVzLk9P
QlRyZWUoBwAAAHQDAAAAbGVudA0AAABvbGRfbGluZV9saXN0dA0AAABuZXdfbGluZV9saXN0dAkA
AABfZ2V0aXRlbV90CQAAAF9nZXRhdHRyX3QEAAAAVHJ1ZXQFAAAARmFsc2UoBwAAAFICAAAAUgMA
AABSAQAAAFIEAAAAUgUAAABSBgAAAFIHAAAAKAAAAAAoAAAAAHMSAAAARVJQNSBQeXRob24gU2Ny
aXB0cyMAAABUZW1wbGF0ZVRvb2xfZmlsdGVyT09CVHJlZUNsYXNzRGlmZgEAAABzBgAAACkBLgEI
AigBAAAAdCMAAABUZW1wbGF0ZVRvb2xfZmlsdGVyT09CVHJlZUNsYXNzRGlmZigBAAAAUggAAAAo
AAAAACgAAAAAcxIAAABFUlA1IFB5dGhvbiBTY3JpcHRzCAAAADxtb2R1bGU+AQAAAHQAAAAA</string> </value>
<value>
<none/>
</value>
</item>
<item>
<key> <string>_params</string> </key>
......
......@@ -6,10 +6,6 @@
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>Python_magic</string> </key>
<value> <string encoding="base64">0fINCg==</string> </value>
</item>
<item>
<key> <string>Script_magic</string> </key>
<value> <int>3</int> </value>
......@@ -55,24 +51,9 @@ return False\n
</item>
<item>
<key> <string>_code</string> </key>
<value> <string encoding="base64">YwAAAAAAAAAAAQAAAAAAAABzDQAAAGQBAIQAAFoAAGQAAFMoAgAAAE5jAgAAAAkAA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bmljb2RlRGlmZgEAAABzGAAAABAB
DQENATcBJgE0ARMBCAI0ARMBDAEKASgBAAAAdCYAAABUZW1wbGF0ZVRvb2xfZmlsdGVyVGVtcGxh
dGVVbmljb2RlRGlmZigBAAAAUgwAAAAoAAAAACgAAAAAcxIAAABFUlA1IFB5dGhvbiBTY3JpcHRz
CAAAADxtb2R1bGU+AQAAAHQAAAAA</string> </value>
<value>
<none/>
</value>
</item>
<item>
<key> <string>_params</string> </key>
......
1714
\ No newline at end of file
1715
\ No newline at end of file
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