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
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Eteri
erp5
Commits
fd340567
Commit
fd340567
authored
Nov 23, 2011
by
Julien Muchembled
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
BT: simplify some code related to RegisteredSkinSelectionTemplateItem
parent
88552f9f
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
24 additions
and
44 deletions
+24
-44
product/ERP5/Document/BusinessTemplate.py
product/ERP5/Document/BusinessTemplate.py
+24
-44
No files found.
product/ERP5/Document/BusinessTemplate.py
View file @
fd340567
...
@@ -279,21 +279,15 @@ def createSkinSelection(skin_tool, skin_name):
...
@@ -279,21 +279,15 @@ def createSkinSelection(skin_tool, skin_name):
def
deleteSkinSelection
(
skin_tool
,
skin_name
):
def
deleteSkinSelection
(
skin_tool
,
skin_name
):
# Do not delete default skin
# Do not delete default skin
if
skin_tool
.
getDefaultSkin
()
!=
skin_name
:
if
skin_tool
.
getDefaultSkin
()
!=
skin_name
:
skin_selection_registered
=
False
for
skin_folder
in
skin_tool
.
objectValues
():
for
skin_folder
in
skin_tool
.
objectValues
():
try
:
try
:
skin_selection_list
=
skin_folder
.
getProperty
(
if
skin_name
in
skin_folder
.
getProperty
(
'business_template_registered_skin_selections'
,
())
'business_template_registered_skin_selections'
,
()):
if
skin_name
in
skin_selection_list
:
skin_selection_registered
=
True
break
break
except
AttributeError
:
except
AttributeError
:
pass
pass
else
:
if
(
not
skin_selection_registered
):
skin_tool
.
manage_skinLayers
(
chosen
=
[
skin_name
],
del_skin
=
1
)
skin_tool
.
manage_skinLayers
(
chosen
=
[
skin_name
],
del_skin
=
1
)
skin_tool
.
getPortalObject
().
changeSkin
(
None
)
skin_tool
.
getPortalObject
().
changeSkin
(
None
)
def
unregisterSkinFolderId
(
skin_tool
,
skin_folder_id
,
skin_selection_list
):
def
unregisterSkinFolderId
(
skin_tool
,
skin_folder_id
,
skin_selection_list
):
...
@@ -1708,45 +1702,31 @@ class RegisteredSkinSelectionTemplateItem(BaseTemplateItem):
...
@@ -1708,45 +1702,31 @@ class RegisteredSkinSelectionTemplateItem(BaseTemplateItem):
def
uninstall
(
self
,
context
,
**
kw
):
def
uninstall
(
self
,
context
,
**
kw
):
portal
=
context
.
getPortalObject
()
portal
=
context
.
getPortalObject
()
skin_tool
=
getToolByName
(
portal
,
'portal_skins'
)
skin_tool
=
getToolByName
(
portal
,
'portal_skins'
)
object_path
=
kw
.
get
(
'object_path'
)
object_path
=
kw
.
get
(
'object_path'
,
None
)
for
skin_folder_id
in
(
object_path
,)
if
object_path
else
self
.
_objects
:
if
object_path
is
not
None
:
object_keys
=
[
object_path
]
else
:
object_keys
=
self
.
_objects
.
keys
()
for
skin_folder_id
in
object_keys
:
current_selection_list
=
[]
skin_folder
=
skin_tool
.
get
(
skin_folder_id
,
None
)
if
skin_folder
is
not
None
:
current_selection_list
=
skin_folder
.
getProperty
(
'business_template_registered_skin_selections'
,
[])
current_selection_set
=
set
(
current_selection_list
)
skin_selection_list
=
self
.
_objects
[
skin_folder_id
]
skin_selection_list
=
self
.
_objects
[
skin_folder_id
]
if
isinstance
(
skin_selection_list
,
str
):
if
isinstance
(
skin_selection_list
,
str
):
skin_selection_list
=
skin_selection_list
.
replace
(
','
,
' '
).
split
(
' '
)
skin_selection_list
=
skin_selection_list
.
replace
(
','
,
' '
).
split
(
' '
)
for
skin_selection
in
skin_selection_list
:
skin_folder
=
skin_tool
.
get
(
skin_folder_id
)
current_selection_set
.
discard
(
skin_selection
)
if
skin_folder
is
not
None
:
current_selection_set
=
set
(
skin_folder
.
getProperty
(
current_selection_list
=
list
(
current_selection_set
)
'business_template_registered_skin_selections'
,
()))
if
current_selection_list
:
current_selection_set
.
difference_update
(
skin_selection_list
)
if
current_selection_set
:
skin_folder
.
_updateProperty
(
skin_folder
.
_updateProperty
(
'business_template_registered_skin_selections'
,
'business_template_registered_skin_selections'
,
current_selection_list
)
list
(
current_selection_set
))
# Unregister skin folder from skin selection
# Unregister skin folder from skin selection
unregisterSkinFolderId
(
skin_tool
,
skin_folder_id
,
skin_selection_list
)
unregisterSkinFolderId
(
skin_tool
,
skin_folder_id
,
skin_selection_list
)
else
:
continue
# Delete all skin selection
# Delete all skin selection
for
skin_selection
in
skin_selection_list
:
for
skin_selection
in
skin_selection_list
:
deleteSkinSelection
(
skin_tool
,
skin_selection
)
deleteSkinSelection
(
skin_tool
,
skin_selection
)
if
skin_folder
is
not
None
:
if
skin_folder
is
not
None
:
delattr
(
skin_folder
,
'business_template_registered_skin_selections'
)
del
skin_folder
.
business_template_registered_skin_selections
# Register to all other skin selection
# Register to all other skin selection
registerSkinFolder
(
skin_tool
,
skin_folder
)
registerSkinFolder
(
skin_tool
,
skin_folder
)
def
preinstall
(
self
,
context
,
installed_item
,
**
kw
):
def
preinstall
(
self
,
context
,
installed_item
,
**
kw
):
modified_object_list
=
{}
modified_object_list
=
{}
if
context
.
getTemplateFormatVersion
()
==
1
:
if
context
.
getTemplateFormatVersion
()
==
1
:
...
...
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