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
b0da70cb
Commit
b0da70cb
authored
Apr 02, 2022
by
Arnaud Fontaine
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
WIP: BusinessTemplate installation.
parent
396d814c
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
23 additions
and
16 deletions
+23
-16
product/ERP5/Document/BusinessTemplate.py
product/ERP5/Document/BusinessTemplate.py
+17
-13
product/ERP5/Tool/IdTool.py
product/ERP5/Tool/IdTool.py
+2
-1
product/ERP5Type/Accessor/TypeDefinition.py
product/ERP5Type/Accessor/TypeDefinition.py
+4
-2
No files found.
product/ERP5/Document/BusinessTemplate.py
View file @
b0da70cb
...
...
@@ -141,20 +141,25 @@ SEPARATELY_EXPORTED_PROPERTY_DICT = {
# separate file, with extension specified by 'extension'.
# 'extension' must be None for auto-detection.
#
# XXX-zope4py3: `text` was added but what we should do is check the
# PropertySheet ('string' (str) /'data' (bytes)) but for now,
# only work on bootstrap...
#
# class_name: (extension, unicode_data, property_name, text),
"Document Component"
:
(
"py"
,
0
,
"text_content"
,
True
),
"DTMLDocument"
:
(
None
,
0
,
"raw"
,
True
),
"DTMLMethod"
:
(
None
,
0
,
"raw"
,
True
),
"Extension Component"
:
(
"py"
,
0
,
"text_content"
,
True
),
"File"
:
(
None
,
0
,
"data"
,
lambda
obj
:
(
obj
.
content_type
.
startswith
(
'text/'
)
or
obj
.
content_type
in
(
'application/javascript'
,
'application/js'
,
'application/json'
,
'application/schema+json'
,
'application/x-javascript'
,
'application/xml'
,
'application/x-php'
,
'image/svg+xml'
))),
# OFS.File raises ValueError("Must be bytes")
"File"
:
(
None
,
0
,
"data"
,
False
),
# lambda obj: (obj.content_type.startswith('text/') or
# obj.content_type in ('application/javascript',
# 'application/js',
# 'application/json',
# 'application/schema+json',
# 'application/x-javascript',
# 'application/xml',
# 'application/x-php',
# 'image/svg+xml'))),
"Image"
:
(
None
,
0
,
"data"
,
False
),
"Interface Component"
:
(
"py"
,
0
,
"text_content"
,
True
),
"OOoTemplate"
:
(
"oot"
,
1
,
"_text"
,
True
),
...
...
@@ -5073,7 +5078,7 @@ class bt(dict):
"""Fake 'bt' item to read bt/* files through BusinessTemplateArchive"""
def
_importFile
(
self
,
file_name
,
file
):
self
[
file_name
]
=
file
.
read
()
self
[
file_name
]
=
file
.
read
()
.
decode
(
'utf-8'
)
class
BusinessTemplate
(
XMLObject
):
...
...
@@ -5943,12 +5948,11 @@ Business Template is a set of definitions, such as skins, portal types and categ
prop_type
=
prop
[
'type'
]
value
=
bt_item
.
get
(
pid
)
if
prop_type
in
(
'text'
,
'string'
):
prop_dict
[
pid
]
=
value
.
decode
(
'utf-8'
)
if
value
else
''
prop_dict
[
pid
]
=
value
or
''
elif
prop_type
in
(
'int'
,
'boolean'
):
prop_dict
[
pid
]
=
value
or
0
elif
prop_type
in
(
'lines'
,
'tokens'
):
prop_dict
[
pid
[:
-
5
]]
=
(
value
.
decode
(
'utf-8'
)
if
value
else
''
).
splitlines
()
prop_dict
[
pid
[:
-
5
]]
=
(
value
or
''
).
splitlines
()
self
.
_edit
(
**
prop_dict
)
try
:
...
...
product/ERP5/Tool/IdTool.py
View file @
b0da70cb
...
...
@@ -93,7 +93,8 @@ class IdTool(BaseTool):
version_last_generator
=
0
for
generator
in
self
.
objectValues
():
if
generator
.
getReference
()
==
reference
:
version
=
generator
.
getVersion
()
# Version Property Sheet defines 'version' property as a 'string'
version
=
int
(
generator
.
getVersion
())
if
version
>
version_last_generator
:
id_last_generator
=
generator
.
getId
()
version_last_generator
=
version
...
...
product/ERP5Type/Accessor/TypeDefinition.py
View file @
b0da70cb
...
...
@@ -94,8 +94,8 @@ def asString(value):
if
value
is
None
:
result
=
''
else
:
if
isinstance
(
value
,
str
):
result
=
value
.
en
code
(
'utf-8'
)
if
isinstance
(
value
,
bytes
):
result
=
value
.
de
code
(
'utf-8'
)
else
:
result
=
str
(
value
)
except
TypeError
:
...
...
@@ -105,6 +105,8 @@ def asString(value):
def
asList
(
value
):
"""
Return the value as a list or a type-specific default value if it fails.
XXX-zope4py3: bytes()?
"""
if
isinstance
(
value
,
(
list
,
tuple
)):
result
=
list
(
value
)
...
...
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