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
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Aaron Chen
erp5
Commits
4670ed55
Commit
4670ed55
authored
Sep 21, 2011
by
Leonardo Rochael Almeida
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Allow a skin folder to no longer exist when being uninstalled
Allow it to no longer be registered as well
parent
17f19226
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
16 additions
and
14 deletions
+16
-14
product/ERP5/Document/BusinessTemplate.py
product/ERP5/Document/BusinessTemplate.py
+16
-14
No files found.
product/ERP5/Document/BusinessTemplate.py
View file @
4670ed55
...
@@ -297,7 +297,7 @@ def deleteSkinSelection(skin_tool, skin_name):
...
@@ -297,7 +297,7 @@ def deleteSkinSelection(skin_tool, skin_name):
del_skin
=
1
)
del_skin
=
1
)
skin_tool
.
getPortalObject
().
changeSkin
(
None
)
skin_tool
.
getPortalObject
().
changeSkin
(
None
)
def
unregisterSkinFolder
(
skin_tool
,
skin_folder
,
skin_selection_list
):
def
unregisterSkinFolder
Id
(
skin_tool
,
skin_folder_id
,
skin_selection_list
):
skin_folder_id
=
skin_folder
.
getId
()
skin_folder_id
=
skin_folder
.
getId
()
for
skin_selection
in
skin_selection_list
:
for
skin_selection
in
skin_selection_list
:
...
@@ -1296,8 +1296,7 @@ class ObjectTemplateItem(BaseTemplateItem):
...
@@ -1296,8 +1296,7 @@ class ObjectTemplateItem(BaseTemplateItem):
if
container
.
meta_type
==
'CMF Skins Tool'
:
if
container
.
meta_type
==
'CMF Skins Tool'
:
# we are removing a skin folder, check and
# we are removing a skin folder, check and
# remove if registered skin selection
# remove if registered skin selection
skin_folder
=
container
[
object_id
]
unregisterSkinFolderId
(
container
,
object_id
,
unregisterSkinFolder
(
container
,
skin_folder
,
container
.
getSkinSelections
())
container
.
getSkinSelections
())
container
.
manage_delObjects
([
object_id
])
container
.
manage_delObjects
([
object_id
])
...
@@ -1697,7 +1696,7 @@ class RegisteredSkinSelectionTemplateItem(BaseTemplateItem):
...
@@ -1697,7 +1696,7 @@ class RegisteredSkinSelectionTemplateItem(BaseTemplateItem):
'business_template_registered_skin_selections'
,
'business_template_registered_skin_selections'
,
selection_list
)
selection_list
)
unregisterSkinFolder
(
skin_tool
,
skin_folder
,
unregisterSkinFolder
Id
(
skin_tool
,
skin_folder_id
,
skin_tool
.
getSkinSelections
())
skin_tool
.
getSkinSelections
())
registerSkinFolder
(
skin_tool
,
skin_folder
)
registerSkinFolder
(
skin_tool
,
skin_folder
)
...
@@ -1712,7 +1711,9 @@ class RegisteredSkinSelectionTemplateItem(BaseTemplateItem):
...
@@ -1712,7 +1711,9 @@ class RegisteredSkinSelectionTemplateItem(BaseTemplateItem):
object_keys
=
self
.
_objects
.
keys
()
object_keys
=
self
.
_objects
.
keys
()
for
skin_folder_id
in
object_keys
:
for
skin_folder_id
in
object_keys
:
skin_folder
=
skin_tool
[
skin_folder_id
]
current_selection_list
=
[]
skin_folder
=
skin_tool
.
get
(
skin_folder_id
,
None
)
if
skin_folder
is
not
None
:
current_selection_list
=
skin_folder
.
getProperty
(
current_selection_list
=
skin_folder
.
getProperty
(
'business_template_registered_skin_selections'
,
[])
'business_template_registered_skin_selections'
,
[])
current_selection_set
=
set
(
current_selection_list
)
current_selection_set
=
set
(
current_selection_list
)
...
@@ -1721,7 +1722,7 @@ class RegisteredSkinSelectionTemplateItem(BaseTemplateItem):
...
@@ -1721,7 +1722,7 @@ class RegisteredSkinSelectionTemplateItem(BaseTemplateItem):
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
:
for
skin_selection
in
skin_selection_list
:
current_selection_set
.
remove
(
skin_selection
)
current_selection_set
.
discard
(
skin_selection
)
current_selection_list
=
list
(
current_selection_set
)
current_selection_list
=
list
(
current_selection_set
)
if
current_selection_list
:
if
current_selection_list
:
...
@@ -1730,16 +1731,17 @@ class RegisteredSkinSelectionTemplateItem(BaseTemplateItem):
...
@@ -1730,16 +1731,17 @@ class RegisteredSkinSelectionTemplateItem(BaseTemplateItem):
current_selection_list
)
current_selection_list
)
# Unregister skin folder from skin selection
# Unregister skin folder from skin selection
unregisterSkinFolder
(
skin_tool
,
skin_folder
,
skin_selection_list
)
unregisterSkinFolder
Id
(
skin_tool
,
skin_folder_id
,
skin_selection_list
)
else
:
else
:
delattr
(
skin_folder
,
'business_template_registered_skin_selections'
)
# 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
:
delattr
(
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