Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
E
erp5_workflow
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
wenjie.zheng
erp5_workflow
Commits
580db262
Commit
580db262
authored
Jan 23, 2012
by
Arnaud Fontaine
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Allow export/import of Extensions (metadata (XML) and source code (python)).
parent
5e49155a
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
28 additions
and
0 deletions
+28
-0
product/ERP5/Document/BusinessTemplate.py
product/ERP5/Document/BusinessTemplate.py
+28
-0
No files found.
product/ERP5/Document/BusinessTemplate.py
View file @
580db262
...
@@ -3779,6 +3779,34 @@ class ExtensionTemplateItem(FilesystemToZodbTemplateItem):
...
@@ -3779,6 +3779,34 @@ class ExtensionTemplateItem(FilesystemToZodbTemplateItem):
local_file_importer_name
=
None
local_file_importer_name
=
None
local_file_remover_name
=
staticmethod
(
removeLocalExtension
)
local_file_remover_name
=
staticmethod
(
removeLocalExtension
)
def
_importFile
(
self
,
file_name
,
file_obj
):
if
(
file_name
.
endswith
(
'.py'
)
and
file_obj
.
name
.
rsplit
(
os
.
path
.
sep
,
2
)[
-
2
]
==
'portal_components'
):
return
FilesystemToZodbTemplateItem
.
_importFile
(
self
,
file_name
,
file_obj
)
if
file_name
.
endswith
(
'.xml'
):
obj
=
self
.
_objects
[
file_name
[:
-
4
]]
with
open
(
"%s.py"
%
file_obj
.
name
[:
-
4
])
as
f
:
obj
.
text_content
=
f
.
read
()
def
export
(
self
,
context
,
bta
,
**
kw
):
path
=
self
.
__class__
.
__name__
for
key
,
obj
in
self
.
_objects
.
iteritems
():
obj
=
obj
.
_getCopy
(
context
)
f
=
StringIO
(
obj
.
text_content
)
bta
.
addObject
(
f
,
key
,
path
=
path
,
ext
=
'.py'
)
del
obj
.
text_content
transaction
.
commit
()
# export object in xml
f
=
StringIO
()
XMLExportImport
.
exportXML
(
obj
.
_p_jar
,
obj
.
_p_oid
,
f
)
bta
.
addObject
(
f
,
key
,
path
=
path
)
@
staticmethod
@
staticmethod
def
_getZodbObjectId
(
id
):
def
_getZodbObjectId
(
id
):
return
'erp5.component.extension.%s'
%
id
return
'erp5.component.extension.%s'
%
id
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment