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
Levin Zimmermann
erp5
Commits
e3e53b04
Commit
e3e53b04
authored
Mar 31, 2022
by
Arnaud Fontaine
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
WIP
parent
bc39dd99
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
58 additions
and
39 deletions
+58
-39
product/ERP5/Document/BusinessTemplate.py
product/ERP5/Document/BusinessTemplate.py
+51
-30
product/ERP5/ERP5Site.py
product/ERP5/ERP5Site.py
+1
-0
product/ERP5Type/patches/ppml.py
product/ERP5Type/patches/ppml.py
+6
-9
No files found.
product/ERP5/Document/BusinessTemplate.py
View file @
e3e53b04
...
@@ -141,33 +141,41 @@ SEPARATELY_EXPORTED_PROPERTY_DICT = {
...
@@ -141,33 +141,41 @@ SEPARATELY_EXPORTED_PROPERTY_DICT = {
# separate file, with extension specified by 'extension'.
# separate file, with extension specified by 'extension'.
# 'extension' must be None for auto-detection.
# 'extension' must be None for auto-detection.
#
#
# class_name: (extension, unicode_data, property_name),
# class_name: (extension, unicode_data, property_name, text),
"Document Component"
:
(
"py"
,
0
,
"text_content"
),
"Document Component"
:
(
"py"
,
0
,
"text_content"
,
True
),
"DTMLDocument"
:
(
None
,
0
,
"raw"
),
"DTMLDocument"
:
(
None
,
0
,
"raw"
,
True
),
"DTMLMethod"
:
(
None
,
0
,
"raw"
),
"DTMLMethod"
:
(
None
,
0
,
"raw"
,
True
),
"Extension Component"
:
(
"py"
,
0
,
"text_content"
),
"Extension Component"
:
(
"py"
,
0
,
"text_content"
,
True
),
"File"
:
(
None
,
0
,
"data"
),
"File"
:
(
None
,
0
,
"data"
,
lambda
obj
:
(
obj
.
content_type
.
startswith
(
'text/'
)
or
"Image"
:
(
None
,
0
,
"data"
),
obj
.
content_type
in
(
'application/javascript'
,
"Interface Component"
:
(
"py"
,
0
,
"text_content"
),
'application/js'
,
"OOoTemplate"
:
(
"oot"
,
1
,
"_text"
),
'application/json'
,
"Mixin Component"
:
(
"py"
,
0
,
"text_content"
),
'application/schema+json'
,
"Module Component"
:
(
"py"
,
0
,
"text_content"
),
'application/x-javascript'
,
"PDF"
:
(
"pdf"
,
0
,
"data"
),
'application/xml'
,
"PyData Script"
:
(
"py"
,
0
,
"_body"
),
'application/x-php'
,
"Python Script"
:
(
"py"
,
0
,
"_body"
),
'image/svg+xml'
))),
"Workflow Script"
:
(
"py"
,
0
,
"_body"
),
"Image"
:
(
None
,
0
,
"data"
,
False
),
"PythonScript"
:
(
"py"
,
0
,
"_body"
),
"Interface Component"
:
(
"py"
,
0
,
"text_content"
,
True
),
"Spreadsheet"
:
(
None
,
0
,
"data"
),
"OOoTemplate"
:
(
"oot"
,
1
,
"_text"
,
True
),
"SQL"
:
(
"sql"
,
0
,
"src"
),
"Mixin Component"
:
(
"py"
,
0
,
"text_content"
,
True
),
"SQL Method"
:
(
"sql"
,
0
,
"src"
),
"Module Component"
:
(
"py"
,
0
,
"text_content"
,
True
),
"Test Component"
:
(
"py"
,
0
,
"text_content"
),
"PDF"
:
(
"pdf"
,
0
,
"data"
,
False
),
"Test Page"
:
(
None
,
0
,
"text_content"
),
"PyData Script"
:
(
"py"
,
0
,
"_body"
,
True
),
"Tool Component"
:
(
"py"
,
0
,
"text_content"
),
"Python Script"
:
(
"py"
,
0
,
"_body"
,
True
),
"Web Illustration"
:
(
"svg"
,
0
,
"text_content"
),
"Workflow Script"
:
(
"py"
,
0
,
"_body"
,
True
),
"Web Page"
:
(
None
,
0
,
"text_content"
),
"PythonScript"
:
(
"py"
,
0
,
"_body"
,
True
),
"Web Script"
:
(
None
,
0
,
"text_content"
),
"Spreadsheet"
:
(
None
,
0
,
"data"
,
False
),
"Web Style"
:
(
None
,
0
,
"text_content"
),
"SQL"
:
(
"sql"
,
0
,
"src"
,
True
),
"ZopePageTemplate"
:
(
"zpt"
,
1
,
"_text"
),
"SQL Method"
:
(
"sql"
,
0
,
"src"
,
True
),
"Test Component"
:
(
"py"
,
0
,
"text_content"
,
True
),
"Test Page"
:
(
None
,
0
,
"text_content"
,
True
),
"Tool Component"
:
(
"py"
,
0
,
"text_content"
,
True
),
"Web Illustration"
:
(
"svg"
,
0
,
"text_content"
,
True
),
"Web Page"
:
(
None
,
0
,
"text_content"
,
True
),
"Web Script"
:
(
None
,
0
,
"text_content"
,
True
),
"Web Style"
:
(
None
,
0
,
"text_content"
,
True
),
"ZopePageTemplate"
:
(
"zpt"
,
1
,
"_text"
,
True
),
}
}
def
_getCatalog
(
acquisition_context
):
def
_getCatalog
(
acquisition_context
):
...
@@ -823,7 +831,7 @@ class ObjectTemplateItem(BaseTemplateItem):
...
@@ -823,7 +831,7 @@ class ObjectTemplateItem(BaseTemplateItem):
bta
.
addObject
(
obj
,
name
=
key
,
ext
=
'.py'
)
bta
.
addObject
(
obj
,
name
=
key
,
ext
=
'.py'
)
else
:
else
:
try
:
try
:
extension
,
unicode_data
,
record_id
=
\
extension
,
unicode_data
,
record_id
,
_
=
\
SEPARATELY_EXPORTED_PROPERTY_DICT
[
obj
.
__class__
.
__name__
]
SEPARATELY_EXPORTED_PROPERTY_DICT
[
obj
.
__class__
.
__name__
]
except
KeyError
:
except
KeyError
:
pass
pass
...
@@ -877,10 +885,14 @@ class ObjectTemplateItem(BaseTemplateItem):
...
@@ -877,10 +885,14 @@ class ObjectTemplateItem(BaseTemplateItem):
bta
.
addObject
(
xml_data
,
key
+
'.catalog_keys'
,
path
=
path
)
bta
.
addObject
(
xml_data
,
key
+
'.catalog_keys'
,
path
=
path
)
def
_restoreSeparatelyExportedProperty
(
self
,
obj
,
data
):
def
_restoreSeparatelyExportedProperty
(
self
,
obj
,
data
):
unicode_data
,
property_name
=
SEPARATELY_EXPORTED_PROPERTY_DICT
[
class_name
=
obj
.
__class__
.
__name__
obj
.
__class__
.
__name__
][
1
:]
unicode_data
,
property_name
,
is_text
=
SEPARATELY_EXPORTED_PROPERTY_DICT
[
class_name
][
1
:]
if
unicode_data
:
if
unicode_data
:
data
=
data
.
decode
(
obj
.
output_encoding
)
data
=
data
.
decode
(
obj
.
output_encoding
)
elif
((
callable
(
is_text
)
and
is_text
(
obj
))
or
(
not
callable
(
is_text
)
and
is_text
)):
data
=
data
.
decode
(
'utf-8'
)
try
:
try
:
setattr
(
obj
,
property_name
,
data
)
setattr
(
obj
,
property_name
,
data
)
except
BrokenModified
:
except
BrokenModified
:
...
@@ -897,6 +909,7 @@ class ObjectTemplateItem(BaseTemplateItem):
...
@@ -897,6 +909,7 @@ class ObjectTemplateItem(BaseTemplateItem):
obj_key
,
file_ext
=
os
.
path
.
splitext
(
file_name
)
obj_key
,
file_ext
=
os
.
path
.
splitext
(
file_name
)
# id() for installing several bt5 in the same transaction
# id() for installing several bt5 in the same transaction
transactional_variable_obj_key
=
"%s-%s"
%
(
id
(
self
),
obj_key
)
transactional_variable_obj_key
=
"%s-%s"
%
(
id
(
self
),
obj_key
)
obj
=
None
if
file_ext
!=
'.xml'
:
if
file_ext
!=
'.xml'
:
# if the document has not been migrated yet (its class is file and
# if the document has not been migrated yet (its class is file and
# it is not in portal_components) use legacy importer
# it is not in portal_components) use legacy importer
...
@@ -943,6 +956,12 @@ class ObjectTemplateItem(BaseTemplateItem):
...
@@ -943,6 +956,12 @@ class ObjectTemplateItem(BaseTemplateItem):
pass
pass
if
catalog_method_template_item
:
if
catalog_method_template_item
:
self
.
removeProperties
(
obj
,
0
)
self
.
removeProperties
(
obj
,
0
)
if
obj
is
not
None
:
bytes_item_list
=
[(
k
,
v
)
for
k
,
v
in
obj
.
__dict__
.
items
()
if
isinstance
(
k
,
bytes
)
or
isinstance
(
v
,
bytes
)
]
if
bytes_item_list
:
print
(
"%r: %s"
%
(
getattr
(
obj
,
'content_type'
,
None
),
file_name
))
import
pdb
;
pdb
.
set_trace
()
def
build_sub_objects
(
self
,
context
,
id_list
,
url
,
**
kw
):
def
build_sub_objects
(
self
,
context
,
id_list
,
url
,
**
kw
):
# XXX duplicates code from build
# XXX duplicates code from build
...
@@ -3954,6 +3973,7 @@ class FilesystemDocumentTemplateItem(BaseTemplateItem):
...
@@ -3954,6 +3973,7 @@ class FilesystemDocumentTemplateItem(BaseTemplateItem):
LOG
(
'Business Template'
,
0
,
'Skipping file "%s"'
%
(
file_name
,
))
LOG
(
'Business Template'
,
0
,
'Skipping file "%s"'
%
(
file_name
,
))
return
return
text
=
file
.
read
()
text
=
file
.
read
()
import
pdb
;
pdb
.
set_trace
()
self
.
_objects
[
file_name
[:
-
3
]]
=
text
self
.
_objects
[
file_name
[:
-
3
]]
=
text
class
FilesystemToZodbTemplateItem
(
FilesystemDocumentTemplateItem
,
class
FilesystemToZodbTemplateItem
(
FilesystemDocumentTemplateItem
,
...
@@ -4885,6 +4905,7 @@ class MessageTranslationTemplateItem(BaseTemplateItem):
...
@@ -4885,6 +4905,7 @@ class MessageTranslationTemplateItem(BaseTemplateItem):
bta
.
addObject
(
'
\
n
'
.
join
(
xml_data
),
'language'
,
path
=
path
)
bta
.
addObject
(
'
\
n
'
.
join
(
xml_data
),
'language'
,
path
=
path
)
def
_importFile
(
self
,
file_name
,
file
):
def
_importFile
(
self
,
file_name
,
file
):
import
pdb
;
pdb
.
set_trace
()
name
=
posixpath
.
split
(
file_name
)[
1
]
name
=
posixpath
.
split
(
file_name
)[
1
]
if
name
==
'translation.po'
:
if
name
==
'translation.po'
:
text
=
file
.
read
()
text
=
file
.
read
()
...
...
product/ERP5/ERP5Site.py
View file @
e3e53b04
...
@@ -2524,6 +2524,7 @@ def initialize(self):
...
@@ -2524,6 +2524,7 @@ def initialize(self):
time
.
sleep
(
5
)
time
.
sleep
(
5
)
except
:
except
:
import
pdb
;
pdb
.
post_mortem
()
import
pdb
;
pdb
.
post_mortem
()
raise
from
Products.TimerService.timerserver.TimerServer
import
TimerRequest
from
Products.TimerService.timerserver.TimerServer
import
TimerRequest
def
traverse
(
*
args
,
**
kw
):
def
traverse
(
*
args
,
**
kw
):
del
TimerRequest
.
traverse
del
TimerRequest
.
traverse
...
...
product/ERP5Type/patches/ppml.py
View file @
e3e53b04
...
@@ -83,7 +83,7 @@ def unconvert(encoding,S):
...
@@ -83,7 +83,7 @@ def unconvert(encoding,S):
if
encoding
==
'base64'
:
if
encoding
==
'base64'
:
return
base64
.
decodestring
(
S
)
return
base64
.
decodestring
(
S
)
else
:
else
:
return
bytes
(
eval
(
b"'"
+
S
.
replace
(
b'
\
n
'
,
b''
)
+
b"'"
),
'utf-8'
)
return
eval
(
b"'"
+
S
.
replace
(
b'
\
n
'
,
b''
)
+
b"'"
).
encode
(
'utf-8'
)
ppml
.
unconvert
=
unconvert
ppml
.
unconvert
=
unconvert
...
@@ -328,9 +328,8 @@ class NoBlanks(object):
...
@@ -328,9 +328,8 @@ class NoBlanks(object):
"""
"""
# Ignore element data between elements (eg '<e> <f> </f> </e>')...
# Ignore element data between elements (eg '<e> <f> </f> </e>')...
if
data
.
strip
():
if
data
.
strip
():
if
isinstance
(
data
,
bytes
):
if
isinstance
(
data
,
str
):
import
pdb
;
pdb
.
set_trace
()
data
=
data
.
encode
(
'utf-8'
)
data
=
data
.
encode
(
'raw_unicode_escape'
)
self
.
append
(
data
)
self
.
append
(
data
)
# Except for strings and unicode data as whitespaces should be
# Except for strings and unicode data as whitespaces should be
...
@@ -353,9 +352,8 @@ class NoBlanks(object):
...
@@ -353,9 +352,8 @@ class NoBlanks(object):
self
.
previous_discarded_data
=
None
self
.
previous_discarded_data
=
None
self
.
previous_stack_end
=
None
self
.
previous_stack_end
=
None
if
isinstance
(
data
,
bytes
):
if
isinstance
(
data
,
str
):
import
pdb
;
pdb
.
set_trace
()
data
=
data
.
encode
(
'utf-8'
)
data
=
data
.
encode
(
'raw_unicode_escape'
)
self
.
append
(
data
)
self
.
append
(
data
)
...
@@ -769,8 +767,7 @@ class xmlPickler(NoBlanks, xyap):
...
@@ -769,8 +767,7 @@ class xmlPickler(NoBlanks, xyap):
if
tag
in
end
:
if
tag
in
end
:
top
=
end
[
tag
](
self
,
tag
,
top
)
top
=
end
[
tag
](
self
,
tag
,
top
)
if
isinstance
(
top
,
str
):
if
isinstance
(
top
,
str
):
import
pdb
;
pdb
.
set_trace
()
top
=
top
.
encode
(
'utf-8'
)
top
=
top
.
encode
(
'raw_unicode_escape'
)
append
(
top
)
append
(
top
)
start_handlers
=
{
start_handlers
=
{
...
...
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