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
Labels
Merge Requests
7
Merge Requests
7
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Jobs
Commits
Open sidebar
Jérome Perrin
erp5
Commits
4aa04301
Commit
4aa04301
authored
Jan 31, 2024
by
Jérome Perrin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
configurator: py3
parent
5539d2de
Changes
9
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
268 additions
and
264 deletions
+268
-264
bt5/erp5_configurator/DocumentTemplateItem/portal_components/document.erp5.BusinessConfiguration.py
.../portal_components/document.erp5.BusinessConfiguration.py
+3
-4
bt5/erp5_configurator/DocumentTemplateItem/portal_components/document.erp5.CategoriesSpreadsheetConfiguratorItem.py
...ts/document.erp5.CategoriesSpreadsheetConfiguratorItem.py
+3
-9
bt5/erp5_configurator/DocumentTemplateItem/portal_components/document.erp5.PortalTypeRolesSpreadsheetConfiguratorItem.py
...cument.erp5.PortalTypeRolesSpreadsheetConfiguratorItem.py
+1
-1
bt5/erp5_configurator/ExtensionTemplateItem/portal_components/extension.erp5.ConfigurationTemplate_readOOoCalcFile.py
...s/extension.erp5.ConfigurationTemplate_readOOoCalcFile.py
+12
-4
bt5/erp5_configurator/ModuleComponentTemplateItem/portal_components/module.erp5.ConfiguratorTestMixin.py
...em/portal_components/module.erp5.ConfiguratorTestMixin.py
+2
-3
bt5/erp5_configurator/SkinTemplateItem/portal_skins/erp5_configurator/BusinessConfiguration_validateCustomerPassword.py
...gurator/BusinessConfiguration_validateCustomerPassword.py
+0
-2
bt5/erp5_configurator/ToolComponentTemplateItem/portal_components/tool.erp5.ConfiguratorTool.py
...plateItem/portal_components/tool.erp5.ConfiguratorTool.py
+4
-2
bt5/erp5_configurator_standard/SkinTemplateItem/portal_skins/erp5_configurator_standard/BusinessConfiguration_getFunctionTitleItemList.py
...tandard/BusinessConfiguration_getFunctionTitleItemList.py
+5
-1
bt5/erp5_configurator_standard/SkinTemplateItem/portal_skins/erp5_configurator_standard/BusinessConfiguration_getRegionTitleItemList.py
..._standard/BusinessConfiguration_getRegionTitleItemList.py
+238
-238
No files found.
bt5/erp5_configurator/DocumentTemplateItem/portal_components/document.erp5.BusinessConfiguration.py
View file @
4aa04301
...
@@ -150,7 +150,6 @@ class StateError(Exception):
...
@@ -150,7 +150,6 @@ class StateError(Exception):
"""
"""
Must call only an available transition
Must call only an available transition
"""
"""
pass
def
executeTransition
(
state
,
transition
,
document
,
form_kw
=
None
):
def
executeTransition
(
state
,
transition
,
document
,
form_kw
=
None
):
"""
"""
Execute transition on the object.
Execute transition on the object.
...
@@ -347,9 +346,9 @@ class BusinessConfiguration(Item):
...
@@ -347,9 +346,9 @@ class BusinessConfiguration(Item):
## we have already created configuration save for this state
## we have already created configuration save for this state
## so remove from it already existing configuration items
## so remove from it already existing configuration items
if
configuration_save
!=
self
:
# don't delete ourselves
if
configuration_save
!=
self
:
# don't delete ourselves
existing_conf_items
=
configuration_save
.
objectIds
(
)
existing_conf_items
=
list
(
configuration_save
.
objectIds
()
)
existing_conf_items
=
map
(
None
,
existing_conf_items
)
if
existing_conf_items
:
configuration_save
.
manage_delObjects
(
existing_conf_items
)
configuration_save
.
manage_delObjects
(
existing_conf_items
)
modified_form_kw
=
{}
modified_form_kw
=
{}
for
k
in
form_kw
.
keys
():
for
k
in
form_kw
.
keys
():
...
...
bt5/erp5_configurator/DocumentTemplateItem/portal_components/document.erp5.CategoriesSpreadsheetConfiguratorItem.py
View file @
4aa04301
...
@@ -27,7 +27,7 @@
...
@@ -27,7 +27,7 @@
##############################################################################
##############################################################################
import
zope.interface
import
zope.interface
from
six.moves
import
cStringIO
as
StringIO
import
io
from
Acquisition
import
aq_base
from
Acquisition
import
aq_base
from
AccessControl
import
ClassSecurityInfo
from
AccessControl
import
ClassSecurityInfo
from
Products.ERP5Type
import
Permissions
,
PropertySheet
from
Products.ERP5Type
import
Permissions
,
PropertySheet
...
@@ -37,10 +37,6 @@ from erp5.component.interface.IConfiguratorItem import IConfiguratorItem
...
@@ -37,10 +37,6 @@ from erp5.component.interface.IConfiguratorItem import IConfiguratorItem
import
six
import
six
class
UnrestrictedStringIO
(
StringIO
):
__allow_access_to_unprotected_subobjects__
=
1
@
zope
.
interface
.
implementer
(
IConfiguratorItem
)
@
zope
.
interface
.
implementer
(
IConfiguratorItem
)
class
CategoriesSpreadsheetConfiguratorItem
(
ConfiguratorItemMixin
,
XMLObject
):
class
CategoriesSpreadsheetConfiguratorItem
(
ConfiguratorItemMixin
,
XMLObject
):
"""Import a categories spreadsheet.
"""Import a categories spreadsheet.
...
@@ -95,9 +91,7 @@ class CategoriesSpreadsheetConfiguratorItem(ConfiguratorItemMixin, XMLObject):
...
@@ -95,9 +91,7 @@ class CategoriesSpreadsheetConfiguratorItem(ConfiguratorItemMixin, XMLObject):
path
=
path
[
cat
]
path
=
path
[
cat
]
edit_dict
=
category_info
.
copy
()
edit_dict
=
category_info
.
copy
()
edit_dict
.
pop
(
'path'
)
edit_dict
.
pop
(
'path'
)
if
'id'
in
edit_dict
.
keys
():
edit_dict
.
pop
(
'id'
,
None
)
edit_dict
.
pop
(
'id'
)
path
.
edit
(
**
edit_dict
)
path
.
edit
(
**
edit_dict
)
## add to customer template
## add to customer template
business_configuration
=
self
.
getBusinessConfigurationValue
()
business_configuration
=
self
.
getBusinessConfigurationValue
()
...
@@ -117,7 +111,7 @@ class CategoriesSpreadsheetConfiguratorItem(ConfiguratorItemMixin, XMLObject):
...
@@ -117,7 +111,7 @@ class CategoriesSpreadsheetConfiguratorItem(ConfiguratorItemMixin, XMLObject):
# TODO use a invalid_spreadsheet_error_handler to report invalid
# TODO use a invalid_spreadsheet_error_handler to report invalid
# spreadsheet messages (see http://svn.erp5.org?rev=24908&view=rev )
# spreadsheet messages (see http://svn.erp5.org?rev=24908&view=rev )
aq_self
.
_category_cache
=
self
.
Base_getCategoriesSpreadSheetMapping
(
aq_self
.
_category_cache
=
self
.
Base_getCategoriesSpreadSheetMapping
(
UnrestrictedString
IO
(
self
.
getDefaultConfigurationSpreadsheetData
()))
io
.
Bytes
IO
(
self
.
getDefaultConfigurationSpreadsheetData
()))
security
.
declareProtected
(
Permissions
.
ModifyPortalContent
,
security
.
declareProtected
(
Permissions
.
ModifyPortalContent
,
'setDefaultConfigurationSpreadsheetFile'
)
'setDefaultConfigurationSpreadsheetFile'
)
...
...
bt5/erp5_configurator/DocumentTemplateItem/portal_components/document.erp5.PortalTypeRolesSpreadsheetConfiguratorItem.py
View file @
4aa04301
...
@@ -93,7 +93,7 @@ class PortalTypeRolesSpreadsheetConfiguratorItem(ConfiguratorItemMixin, XMLObjec
...
@@ -93,7 +93,7 @@ class PortalTypeRolesSpreadsheetConfiguratorItem(ConfiguratorItemMixin, XMLObjec
business_configuration
=
self
.
getBusinessConfigurationValue
()
business_configuration
=
self
.
getBusinessConfigurationValue
()
bt5_obj
=
business_configuration
.
getSpecialiseValue
()
bt5_obj
=
business_configuration
.
getSpecialiseValue
()
if
bt5_obj
is
not
None
:
if
bt5_obj
is
not
None
:
bt5_obj
.
edit
(
template_portal_type_role_list
=
portal_type_role_dict
.
keys
(
))
bt5_obj
.
edit
(
template_portal_type_role_list
=
list
(
portal_type_role_dict
.
keys
()
))
return
error_list
return
error_list
...
...
bt5/erp5_configurator/ExtensionTemplateItem/portal_components/extension.erp5.ConfigurationTemplate_readOOoCalcFile.py
View file @
4aa04301
...
@@ -30,6 +30,8 @@
...
@@ -30,6 +30,8 @@
# This extension should be replaced by a clever parser provided by
# This extension should be replaced by a clever parser provided by
# ERP5OOo or probably by CloudOOo itself.
# ERP5OOo or probably by CloudOOo itself.
import
six
from
io
import
BytesIO
from
io
import
BytesIO
def
read
(
self
,
filename
,
data
):
def
read
(
self
,
filename
,
data
):
...
@@ -38,7 +40,7 @@ def read(self, filename, data):
...
@@ -38,7 +40,7 @@ def read(self, filename, data):
"""
"""
if
data
is
None
:
if
data
is
None
:
oo_template_file
=
getattr
(
self
,
filename
)
oo_template_file
=
getattr
(
self
,
filename
)
fp
=
BytesIO
(
oo_template_file
)
fp
=
BytesIO
(
bytes
(
oo_template_file
)
)
else
:
else
:
fp
=
BytesIO
(
data
)
fp
=
BytesIO
(
data
)
fp
.
filename
=
filename
fp
.
filename
=
filename
...
@@ -61,7 +63,9 @@ def getIdFromString(string):
...
@@ -61,7 +63,9 @@ def getIdFromString(string):
# Following line is a workaround for this,
# Following line is a workaround for this,
# because \u2013 does not exist in latin1
# because \u2013 does not exist in latin1
string
=
string
.
replace
(
u'
\
u2013
'
,
'-'
)
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
():
if
char
==
'_'
or
char
.
isalnum
():
clean_id
+=
char
clean_id
+=
char
elif
char
.
isspace
()
or
char
in
(
'+'
,
'-'
):
elif
char
.
isspace
()
or
char
in
(
'+'
,
'-'
):
...
@@ -119,12 +123,16 @@ def convert(self, filename, data=None):
...
@@ -119,12 +123,16 @@ def convert(self, filename, data=None):
# Get the property corresponding to the cell data
# Get the property corresponding to the cell data
property_id
=
property_map
[
cell_index
]
property_id
=
property_map
[
cell_index
]
# Convert the value to something like '\xc3\xa9' not '\xc3\xa9'
# 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
cell_index
+=
1
if
len
(
object_property_dict
)
>
0
:
if
len
(
object_property_dict
)
>
0
:
object_list
.
append
(
object_property_dict
)
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
:
if
len
(
table_dict
.
keys
())
==
1
:
return
object_list
return
object_list
...
...
bt5/erp5_configurator/ModuleComponentTemplateItem/portal_components/module.erp5.ConfiguratorTestMixin.py
View file @
4aa04301
##############################################################################
##############################################################################
# coding: utf-8
# Copyright (c) 2010 Nexedi SA and Contributors. All Rights Reserved.
# Copyright (c) 2010 Nexedi SA and Contributors. All Rights Reserved.
# Rafael Monnerat <rafael@nexedi.com>
# Rafael Monnerat <rafael@nexedi.com>
# Ivan Tyagov <ivan@nexedi.com>
# Ivan Tyagov <ivan@nexedi.com>
...
@@ -340,9 +341,7 @@ class TestLiveConfiguratorWorkflowMixin(SecurityTestCase):
...
@@ -340,9 +341,7 @@ class TestLiveConfiguratorWorkflowMixin(SecurityTestCase):
# title is translated here
# title is translated here
title
=
account_business_configuration_item
.
getTitle
()
title
=
account_business_configuration_item
.
getTitle
()
self
.
assertIn
(
title
,
(
'Capital'
,
'Gezeichnetes Kapital'
,
self
.
assertIn
(
title
,
(
'Capital'
,
'Gezeichnetes Kapital'
,
'Уставный капитал'
))
'
\
xd0
\
xa3
\
xd1
\
x81
\
xd1
\
x82
\
xd0
\
xb0
\
xd0
\
xb2
\
xd0
\
xbd
\
xd1
\
x8b
\
xd0
\
xb9
'
\
'
\
xd0
\
xba
\
xd0
\
xb0
\
xd0
\
xbf
\
xd0
\
xb8
\
xd1
\
x82
\
xd0
\
xb0
\
xd0
\
xbb
'
))
# 4. An accounting period configuration item
# 4. An accounting period configuration item
accounting_period_configuration_item
=
\
accounting_period_configuration_item
=
\
...
...
bt5/erp5_configurator/SkinTemplateItem/portal_skins/erp5_configurator/BusinessConfiguration_validateCustomerPassword.py
View file @
4aa04301
password_confirm
=
request
.
get
(
'field_your_password_confirm'
,
None
)
password_confirm
=
request
.
get
(
'field_your_password_confirm'
,
None
)
if
editor
.
encode
(
'ascii'
,
'ignore'
)
!=
editor
:
return
False
return
password_confirm
==
editor
return
password_confirm
==
editor
bt5/erp5_configurator/ToolComponentTemplateItem/portal_components/tool.erp5.ConfiguratorTool.py
View file @
4aa04301
...
@@ -53,12 +53,14 @@ def _validateFormToRequest(form, REQUEST, **kw):
...
@@ -53,12 +53,14 @@ def _validateFormToRequest(form, REQUEST, **kw):
form
.
validate_all_to_request
(
REQUEST
)
form
.
validate_all_to_request
(
REQUEST
)
validation_status
=
0
validation_status
=
0
validation_errors
=
None
validation_errors
=
None
except
FormValidationError
as
validation_errors
:
except
FormValidationError
as
e
:
## not all fields valid
## not all fields valid
validation_status
=
1
validation_status
=
1
except
Exception
as
validation_errors
:
validation_errors
=
e
except
Exception
as
e
:
## missing fields
## missing fields
validation_status
=
2
validation_status
=
2
validation_errors
=
e
## extract form arguments and remove leading prefixes
## extract form arguments and remove leading prefixes
if
validation_status
==
0
:
if
validation_status
==
0
:
for
field
in
form
.
get_fields
():
for
field
in
form
.
get_fields
():
...
...
bt5/erp5_configurator_standard/SkinTemplateItem/portal_skins/erp5_configurator_standard/BusinessConfiguration_getFunctionTitleItemList.py
View file @
4aa04301
# coding: utf-8
# coding: utf-8
import
six
from
Products.ERP5Type.Message
import
translateString
from
Products.ERP5Type.Message
import
translateString
if
context
.
getGlobalConfigurationAttr
(
'categories_spreadsheet_configuration_save_relative_url'
):
if
context
.
getGlobalConfigurationAttr
(
'categories_spreadsheet_configuration_save_relative_url'
):
...
@@ -54,7 +55,10 @@ function_item_list = [
...
@@ -54,7 +55,10 @@ function_item_list = [
]
]
prefix
=
u"
\
N{NO-BREAK SPACE}
"
* 4
if six.PY2:
prefix = prefix.encode('utf-8')
return [['', '']] + [[
return [['', '']] + [[
(
u"
\
N{NO-BREAK SPACE}
"
* 4 * depth ).encode('utf-8'
) + str(translateString(title)),
(
prefix * depth
) + str(translateString(title)),
relative_url,
relative_url,
] for (title, relative_url, depth) in function_item_list]
] for (title, relative_url, depth) in function_item_list]
bt5/erp5_configurator_standard/SkinTemplateItem/portal_skins/erp5_configurator_standard/BusinessConfiguration_getRegionTitleItemList.py
View file @
4aa04301
This diff is collapsed.
Click to expand it.
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