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
Leo Le Bouter
erp5
Commits
3f882b61
Commit
3f882b61
authored
Jan 19, 2012
by
Rafael Monnerat
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Do not use dirty local cache.
parent
3ffda553
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
14 additions
and
28 deletions
+14
-28
product/ERP5Configurator/Document/PortalTypeRolesSpreadsheetConfiguratorItem.py
...or/Document/PortalTypeRolesSpreadsheetConfiguratorItem.py
+14
-28
No files found.
product/ERP5Configurator/Document/PortalTypeRolesSpreadsheetConfiguratorItem.py
View file @
3f882b61
...
...
@@ -62,8 +62,8 @@ class PortalTypeRolesSpreadsheetConfiguratorItem(ConfiguratorItemMixin, XMLObjec
def
_build
(
self
,
business_configuration
):
portal
=
self
.
getPortalObject
()
self
.
_readSpreadShee
t
()
for
type_name
,
role_list
in
self
.
_spreadsheet_cache
.
items
():
portal_type_role_dict
=
self
.
_getPortalTypeRoleDic
t
()
for
type_name
,
role_list
in
portal_type_role_dict
.
items
():
portal_type
=
portal
.
portal_types
.
getTypeInfo
(
type_name
)
if
portal_type
is
None
:
LOG
(
"CONFIGURATOR"
,
INFO
,
"Fail to define Roles for %s"
%
portal_type
)
...
...
@@ -90,7 +90,7 @@ class PortalTypeRolesSpreadsheetConfiguratorItem(ConfiguratorItemMixin, XMLObjec
## Update BT5
bt5_obj
=
business_configuration
.
getSpecialiseValue
()
if
bt5_obj
is
not
None
:
bt5_obj
.
edit
(
template_portal_type_roles_list
=
self
.
_spreadsheet_cache
.
keys
())
bt5_obj
.
edit
(
template_portal_type_roles_list
=
portal_type_role_dict
.
keys
())
def
checkSpreadSheetConsistency
(
self
):
"""Check that the spread sheet is consistent with categories spreadsheet.
...
...
@@ -102,32 +102,18 @@ class PortalTypeRolesSpreadsheetConfiguratorItem(ConfiguratorItemMixin, XMLObjec
XXX do we want to use constraint framework here ?
"""
def
_
readSpreadShee
t
(
self
):
"""Read the spreadsheet and pr
epare internal category cache
.
def
_
getPortalTypeRoleDic
t
(
self
):
"""Read the spreadsheet and pr
ovide processed dict
.
"""
aq_self
=
aq_base
(
self
)
if
getattr
(
aq_self
,
'_spreadsheet_cache'
,
None
)
is
None
:
role_dict
=
dict
()
info_dict
=
self
.
ConfigurationTemplate_readOOCalcFile
(
role_dict
=
dict
()
info_dict
=
self
.
ConfigurationTemplate_readOOCalcFile
(
"portal_roles_spreadsheet.ods"
,
data
=
self
.
getDefaultConfigurationSpreadsheetData
())
for
sheet_name
,
table
in
info_dict
.
items
():
for
line
in
table
:
if
'Portal_Type'
in
line
:
ptype_role_list
=
role_dict
.
setdefault
(
line
[
'Portal_Type'
],
[])
ptype_role_list
.
append
(
line
)
aq_self
.
_spreadsheet_cache
=
role_dict
security
.
declareProtected
(
Permissions
.
ModifyPortalContent
,
'setDefaultConfigurationSpreadsheetFile'
)
def
setDefaultConfigurationSpreadsheetFile
(
self
,
*
args
,
**
kw
):
"""Reset the spreadsheet cache."""
self
.
_setDefaultConfigurationSpreadsheetFile
(
*
args
,
**
kw
)
self
.
_spreadsheet_cache
=
None
self
.
reindexObject
()
security
.
declareProtected
(
Permissions
.
ModifyPortalContent
,
'setConfigurationSpreadsheetFile'
)
setConfigurationSpreadsheetFile
=
setDefaultConfigurationSpreadsheetFile
for
sheet_name
,
table
in
info_dict
.
items
():
for
line
in
table
:
if
'Portal_Type'
in
line
:
ptype_role_list
=
role_dict
.
setdefault
(
line
[
'Portal_Type'
],
[])
ptype_role_list
.
append
(
line
)
return
role_dict
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