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
Carlos Ramos Carreño
erp5
Commits
afb48dd5
Commit
afb48dd5
authored
Jan 31, 2024
by
Jérome Perrin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
configurator: py3
parent
c7209e70
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
20 additions
and
17 deletions
+20
-17
bt5/erp5_configurator/DocumentTemplateItem/portal_components/document.erp5.CategoriesSpreadsheetConfiguratorItem.py
...ts/document.erp5.CategoriesSpreadsheetConfiguratorItem.py
+2
-6
bt5/erp5_configurator/ExtensionTemplateItem/portal_components/extension.erp5.ConfigurationTemplate_readOOoCalcFile.py
...s/extension.erp5.ConfigurationTemplate_readOOoCalcFile.py
+12
-4
bt5/erp5_configurator/ToolComponentTemplateItem/portal_components/tool.erp5.ConfiguratorTool.py
...plateItem/portal_components/tool.erp5.ConfiguratorTool.py
+4
-2
bt5/erp5_configurator_standard/TestTemplateItem/portal_components/test.erp5.testStandardConfigurationWorkflow.py
...components/test.erp5.testStandardConfigurationWorkflow.py
+2
-5
No files found.
bt5/erp5_configurator/DocumentTemplateItem/portal_components/document.erp5.CategoriesSpreadsheetConfiguratorItem.py
View file @
afb48dd5
...
...
@@ -27,7 +27,7 @@
##############################################################################
import
zope.interface
from
six.moves
import
cStringIO
as
StringIO
import
io
from
Acquisition
import
aq_base
from
AccessControl
import
ClassSecurityInfo
from
Products.ERP5Type
import
Permissions
,
PropertySheet
...
...
@@ -37,10 +37,6 @@ from erp5.component.interface.IConfiguratorItem import IConfiguratorItem
import
six
class
UnrestrictedStringIO
(
StringIO
):
__allow_access_to_unprotected_subobjects__
=
1
@
zope
.
interface
.
implementer
(
IConfiguratorItem
)
class
CategoriesSpreadsheetConfiguratorItem
(
ConfiguratorItemMixin
,
XMLObject
):
"""Import a categories spreadsheet.
...
...
@@ -117,7 +113,7 @@ class CategoriesSpreadsheetConfiguratorItem(ConfiguratorItemMixin, XMLObject):
# TODO use a invalid_spreadsheet_error_handler to report invalid
# spreadsheet messages (see http://svn.erp5.org?rev=24908&view=rev )
aq_self
.
_category_cache
=
self
.
Base_getCategoriesSpreadSheetMapping
(
UnrestrictedString
IO
(
self
.
getDefaultConfigurationSpreadsheetData
()))
io
.
Bytes
IO
(
self
.
getDefaultConfigurationSpreadsheetData
()))
security
.
declareProtected
(
Permissions
.
ModifyPortalContent
,
'setDefaultConfigurationSpreadsheetFile'
)
...
...
bt5/erp5_configurator/ExtensionTemplateItem/portal_components/extension.erp5.ConfigurationTemplate_readOOoCalcFile.py
View file @
afb48dd5
...
...
@@ -30,6 +30,8 @@
# This extension should be replaced by a clever parser provided by
# ERP5OOo or probably by CloudOOo itself.
import
six
from
io
import
BytesIO
def
read
(
self
,
filename
,
data
):
...
...
@@ -38,7 +40,7 @@ def read(self, filename, data):
"""
if
data
is
None
:
oo_template_file
=
getattr
(
self
,
filename
)
fp
=
BytesIO
(
oo_template_file
)
fp
=
BytesIO
(
bytes
(
oo_template_file
)
)
else
:
fp
=
BytesIO
(
data
)
fp
.
filename
=
filename
...
...
@@ -61,7 +63,9 @@ def getIdFromString(string):
# Following line is a workaround for this,
# because \u2013 does not exist in latin1
string
=
string
.
replace
(
u'
\
u2013
'
,
'-'
)
for
char
in
string
.
encode
(
'utf-8'
):
#('iso8859_1'):
if
six
.
PY2
:
string
=
string
.
encode
(
'utf-8'
)
for
char
in
string
:
if
char
==
'_'
or
char
.
isalnum
():
clean_id
+=
char
elif
char
.
isspace
()
or
char
in
(
'+'
,
'-'
):
...
...
@@ -119,12 +123,16 @@ def convert(self, filename, data=None):
# Get the property corresponding to the cell data
property_id
=
property_map
[
cell_index
]
# Convert the value to something like '\xc3\xa9' not '\xc3\xa9'
object_property_dict
[
property_id
]
=
cell
.
encode
(
'UTF-8'
)
if
six
.
PY2
:
cell
=
cell
.
encode
(
'UTF-8'
)
object_property_dict
[
property_id
]
=
cell
cell_index
+=
1
if
len
(
object_property_dict
)
>
0
:
object_list
.
append
(
object_property_dict
)
table_dict
[
table_name
.
encode
(
'UTF-8'
)]
=
object_list
if
six
.
PY2
:
table_name
=
table_name
.
encode
(
'UTF-8'
)
table_dict
[
table_name
]
=
object_list
if
len
(
table_dict
.
keys
())
==
1
:
return
object_list
...
...
bt5/erp5_configurator/ToolComponentTemplateItem/portal_components/tool.erp5.ConfiguratorTool.py
View file @
afb48dd5
...
...
@@ -53,12 +53,14 @@ def _validateFormToRequest(form, REQUEST, **kw):
form
.
validate_all_to_request
(
REQUEST
)
validation_status
=
0
validation_errors
=
None
except
FormValidationError
as
validation_errors
:
except
FormValidationError
as
e
:
## not all fields valid
validation_status
=
1
except
Exception
as
validation_errors
:
validation_errors
=
e
except
Exception
as
e
:
## missing fields
validation_status
=
2
validation_errors
=
e
## extract form arguments and remove leading prefixes
if
validation_status
==
0
:
for
field
in
form
.
get_fields
():
...
...
bt5/erp5_configurator_standard/TestTemplateItem/portal_components/test.erp5.testStandardConfigurationWorkflow.py
View file @
afb48dd5
...
...
@@ -1981,11 +1981,8 @@ class TestConsultingConfiguratorWorkflow(StandardConfigurationMixin):
def
uploadFile
(
self
,
file_id
):
file_obj
=
getattr
(
self
.
portal
,
file_id
)
file_path
=
tests_home
+
'/%s'
%
file_id
temp_file
=
open
(
file_path
,
'w+b'
)
try
:
temp_file
.
write
(
str
(
file_obj
))
finally
:
temp_file
.
close
()
with
open
(
file_path
,
'w+b'
)
as
temp_file
:
temp_file
.
write
(
bytes
(
file_obj
))
return
(
file_path
,
FileUpload
(
file_path
,
file_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