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