Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
erp5
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
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
alecs_myu
erp5
Commits
b424287d
Commit
b424287d
authored
Jan 26, 2017
by
Ayush Tiwari
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
bt5_prototype: Change the path where we save bp5 version and other files
parent
0ac3906d
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
12 additions
and
8 deletions
+12
-8
product/ERP5/Document/BusinessPackage.py
product/ERP5/Document/BusinessPackage.py
+12
-8
No files found.
product/ERP5/Document/BusinessPackage.py
View file @
b424287d
...
@@ -211,15 +211,15 @@ class BusinessPackage(XMLObject):
...
@@ -211,15 +211,15 @@ class BusinessPackage(XMLObject):
prop_type
=
prop
[
'type'
]
prop_type
=
prop
[
'type'
]
id
=
prop
[
'id'
]
id
=
prop
[
'id'
]
if
id
in
(
'id'
,
'uid'
,
'rid'
,
'sid'
,
'id_group'
,
'last_id'
,
'revision'
,
if
id
in
(
'id'
,
'uid'
,
'rid'
,
'sid'
,
'id_group'
,
'last_id'
,
'revision'
,
'install_object_list_list'
,
'id_generator'
,
'b
t
_for_diff'
):
'install_object_list_list'
,
'id_generator'
,
'b
p
_for_diff'
):
continue
continue
value
=
self
.
getProperty
(
id
)
value
=
self
.
getProperty
(
id
)
if
not
value
:
if
not
value
:
continue
continue
if
prop_type
in
(
'text'
,
'string'
,
'int'
,
'boolean'
):
if
prop_type
in
(
'text'
,
'string'
,
'int'
,
'boolean'
):
bpa
.
addObject
(
str
(
value
),
name
=
id
,
path
=
'b
t
'
,
ext
=
''
)
bpa
.
addObject
(
str
(
value
),
name
=
id
,
path
=
'b
p
'
,
ext
=
''
)
elif
prop_type
in
(
'lines'
,
'tokens'
):
elif
prop_type
in
(
'lines'
,
'tokens'
):
bpa
.
addObject
(
'
\
n
'
.
join
(
value
),
name
=
id
,
path
=
'b
t
'
,
ext
=
''
)
bpa
.
addObject
(
'
\
n
'
.
join
(
value
),
name
=
id
,
path
=
'b
p
'
,
ext
=
''
)
item_name_list
=
[
'_path_item'
,
'_object_property_item'
]
item_name_list
=
[
'_path_item'
,
'_object_property_item'
]
# Export each part
# Export each part
...
@@ -334,7 +334,7 @@ class BusinessPackageFolder(BusinessPackageArchive):
...
@@ -334,7 +334,7 @@ class BusinessPackageFolder(BusinessPackageArchive):
file_name
=
posixpath
.
normpath
(
file_name
[
root_path_len
:])
file_name
=
posixpath
.
normpath
(
file_name
[
root_path_len
:])
if
'%'
in
file_name
:
if
'%'
in
file_name
:
file_name
=
unquote
(
file_name
)
file_name
=
unquote
(
file_name
)
elif
item_name
==
'b
t
'
and
file_name
==
'revision'
:
elif
item_name
==
'b
p
'
and
file_name
==
'revision'
:
continue
continue
#self.revision.hash(item_name + '/' + file_name, f.read())
#self.revision.hash(item_name + '/' + file_name, f.read())
f
.
seek
(
0
)
f
.
seek
(
0
)
...
@@ -388,7 +388,7 @@ class BusinessPackageTarball(BusinessPackageArchive):
...
@@ -388,7 +388,7 @@ class BusinessPackageTarball(BusinessPackageArchive):
for
file_name
,
info
in
self
.
item_dict
.
get
(
item_name
,
()):
for
file_name
,
info
in
self
.
item_dict
.
get
(
item_name
,
()):
if
'%'
in
file_name
:
if
'%'
in
file_name
:
file_name
=
unquote
(
file_name
)
file_name
=
unquote
(
file_name
)
elif
item_name
==
'b
t
'
and
file_name
==
'revision'
:
elif
item_name
==
'b
p
'
and
file_name
==
'revision'
:
continue
continue
f
=
extractfile
(
info
)
f
=
extractfile
(
info
)
self
.
revision
.
hash
(
item_name
+
'/'
+
file_name
,
f
.
read
())
self
.
revision
.
hash
(
item_name
+
'/'
+
file_name
,
f
.
read
())
...
@@ -916,6 +916,7 @@ class ObjectPropertyTemplatePackageItem(Implicit, Persistent):
...
@@ -916,6 +916,7 @@ class ObjectPropertyTemplatePackageItem(Implicit, Persistent):
property_value
=
p
.
unrestrictedTraverse
(
relative_url
)
\
property_value
=
p
.
unrestrictedTraverse
(
relative_url
)
\
.
getProperty
(
property_name
)
.
getProperty
(
property_name
)
self
.
_objects
.
setdefault
(
relative_url
,
{})[
property_name
]
=
property_value
self
.
_objects
.
setdefault
(
relative_url
,
{})[
property_name
]
=
property_value
# XXX: Add property_type in the xml generated for the objects
self
.
_hash
[
relative_url
]
=
hashlib
.
sha1
(
self
.
generateXml
(
relative_url
)).
hexdigest
()
self
.
_hash
[
relative_url
]
=
hashlib
.
sha1
(
self
.
generateXml
(
relative_url
)).
hexdigest
()
def
generateXml
(
self
,
path
):
def
generateXml
(
self
,
path
):
...
@@ -923,6 +924,7 @@ class ObjectPropertyTemplatePackageItem(Implicit, Persistent):
...
@@ -923,6 +924,7 @@ class ObjectPropertyTemplatePackageItem(Implicit, Persistent):
relative_url
=
path
relative_url
=
path
xml_data
+=
'
\
n
<object relative_url="%s">'
%
relative_url
xml_data
+=
'
\
n
<object relative_url="%s">'
%
relative_url
for
property_name
,
property_value
in
self
.
_objects
[
relative_url
].
iteritems
():
for
property_name
,
property_value
in
self
.
_objects
[
relative_url
].
iteritems
():
# XXX: Replacing '_list' is not very safely handled for exceptional cases
xml_data
+=
'
\
n
<property name="%s">'
%
property_name
.
replace
(
'_list'
,
''
)
xml_data
+=
'
\
n
<property name="%s">'
%
property_name
.
replace
(
'_list'
,
''
)
if
property_name
.
endswith
(
'_list'
):
if
property_name
.
endswith
(
'_list'
):
for
value
in
property_value
:
for
value
in
property_value
:
...
@@ -935,10 +937,12 @@ class ObjectPropertyTemplatePackageItem(Implicit, Persistent):
...
@@ -935,10 +937,12 @@ class ObjectPropertyTemplatePackageItem(Implicit, Persistent):
return
xml_data
return
xml_data
def
export
(
self
,
context
,
bpa
,
**
kw
):
def
export
(
self
,
context
,
bpa
,
**
kw
):
path
=
self
.
__class__
.
__name__
path
=
self
.
__class__
.
__name__
+
'/'
if
self
.
_objects
.
keys
():
if
self
.
_objects
.
keys
():
xml_data
=
self
.
generateXml
()
for
relative_url
in
self
.
_objects
.
keys
():
bpa
.
addObject
(
xml_data
,
name
=
self
.
xml_tag
,
path
=
path
)
xml_data
=
self
.
generateXml
(
relative_url
)
obj_path
=
path
+
relative_url
bpa
.
addObject
(
xml_data
,
name
=
self
.
xml_tag
,
path
=
obj_path
)
def
importFile
(
self
,
bpa
,
**
kw
):
def
importFile
(
self
,
bpa
,
**
kw
):
bpa
.
importFiles
(
self
)
bpa
.
importFiles
(
self
)
...
...
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