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
Yusei Tahara
erp5
Commits
020473fa
Commit
020473fa
authored
11 years ago
by
Arnaud Fontaine
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Reindent code following removal of Business Template format version 0.
parent
c1746228
No related merge requests found
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
705 additions
and
721 deletions
+705
-721
product/ERP5/Document/BusinessTemplate.py
product/ERP5/Document/BusinessTemplate.py
+670
-685
product/ERP5/Tool/TemplateTool.py
product/ERP5/Tool/TemplateTool.py
+35
-36
No files found.
product/ERP5/Document/BusinessTemplate.py
View file @
020473fa
...
@@ -472,7 +472,6 @@ class BaseTemplateItem(Implicit, Persistent):
...
@@ -472,7 +472,6 @@ class BaseTemplateItem(Implicit, Persistent):
XXX: -12 used here is -len('TemplateItem')
XXX: -12 used here is -len('TemplateItem')
"""
"""
modified_object_list
=
{}
modified_object_list
=
{}
if
1
:
for
path
in
self
.
_objects
:
for
path
in
self
.
_objects
:
if
installed_item
.
_objects
.
has_key
(
path
):
if
installed_item
.
_objects
.
has_key
(
path
):
# compare objects to see it there are changes
# compare objects to see it there are changes
...
@@ -817,7 +816,6 @@ class ObjectTemplateItem(BaseTemplateItem):
...
@@ -817,7 +816,6 @@ class ObjectTemplateItem(BaseTemplateItem):
def
preinstall
(
self
,
context
,
installed_item
,
**
kw
):
def
preinstall
(
self
,
context
,
installed_item
,
**
kw
):
modified_object_list
=
{}
modified_object_list
=
{}
if
1
:
upgrade_list
=
[]
upgrade_list
=
[]
type_name
=
self
.
__class__
.
__name__
.
split
(
'TemplateItem'
)[
-
2
]
type_name
=
self
.
__class__
.
__name__
.
split
(
'TemplateItem'
)[
-
2
]
for
path
,
obj
in
self
.
_objects
.
iteritems
():
for
path
,
obj
in
self
.
_objects
.
iteritems
():
...
@@ -999,7 +997,7 @@ class ObjectTemplateItem(BaseTemplateItem):
...
@@ -999,7 +997,7 @@ class ObjectTemplateItem(BaseTemplateItem):
self.beforeInstall()
self.beforeInstall()
update_dict = kw.get('
object_to_update
')
update_dict = kw.get('
object_to_update
')
force = kw.get('
force
')
force = kw.get('
force
')
if 1:
def recurse(hook, document, prefix=''):
def recurse(hook, document, prefix=''):
my_prefix = '
%
s
/%
s
' % (prefix, document.id)
my_prefix = '
%
s
/%
s
' % (prefix, document.id)
if (hook(document, my_prefix)):
if (hook(document, my_prefix)):
...
@@ -1835,7 +1833,6 @@ class RegisteredSkinSelectionTemplateItem(BaseTemplateItem):
...
@@ -1835,7 +1833,6 @@ class RegisteredSkinSelectionTemplateItem(BaseTemplateItem):
def
preinstall
(
self
,
context
,
installed_item
,
**
kw
):
def
preinstall
(
self
,
context
,
installed_item
,
**
kw
):
modified_object_list
=
{}
modified_object_list
=
{}
if
1
:
for
path
in
self
.
_objects
:
for
path
in
self
.
_objects
:
if
installed_item
.
_objects
.
has_key
(
path
):
if
installed_item
.
_objects
.
has_key
(
path
):
# compare object to see it there is changes
# compare object to see it there is changes
...
@@ -2022,7 +2019,6 @@ class WorkflowTemplateItem(ObjectTemplateItem):
...
@@ -2022,7 +2019,6 @@ class WorkflowTemplateItem(ObjectTemplateItem):
return
modified_workflow_dict
return
modified_workflow_dict
def
install
(
self
,
context
,
trashbin
,
**
kw
):
def
install
(
self
,
context
,
trashbin
,
**
kw
):
if
1
:
portal
=
context
.
getPortalObject
()
portal
=
context
.
getPortalObject
()
update_dict
=
kw
.
get
(
'object_to_update'
)
update_dict
=
kw
.
get
(
'object_to_update'
)
force
=
kw
.
get
(
'force'
)
force
=
kw
.
get
(
'force'
)
...
@@ -2359,7 +2355,6 @@ class PortalTypeWorkflowChainTemplateItem(BaseTemplateItem):
...
@@ -2359,7 +2355,6 @@ class PortalTypeWorkflowChainTemplateItem(BaseTemplateItem):
def
preinstall
(
self
,
context
,
installed_item
,
**
kw
):
def
preinstall
(
self
,
context
,
installed_item
,
**
kw
):
modified_object_list
=
{}
modified_object_list
=
{}
if
1
:
new_dict
=
PersistentMapping
()
new_dict
=
PersistentMapping
()
# Fix key from installed bt if necessary
# Fix key from installed bt if necessary
for
key
,
value
in
installed_item
.
_objects
.
iteritems
():
for
key
,
value
in
installed_item
.
_objects
.
iteritems
():
...
@@ -2465,7 +2460,6 @@ class PortalTypeAllowedContentTypeTemplateItem(BaseTemplateItem):
...
@@ -2465,7 +2460,6 @@ class PortalTypeAllowedContentTypeTemplateItem(BaseTemplateItem):
def
preinstall
(
self
,
context
,
installed_item
,
**
kw
):
def
preinstall
(
self
,
context
,
installed_item
,
**
kw
):
modified_object_list
=
{}
modified_object_list
=
{}
if
1
:
new_dict
=
PersistentMapping
()
new_dict
=
PersistentMapping
()
# fix key if necessary in installed bt for diff
# fix key if necessary in installed bt for diff
for
key
,
value
in
installed_item
.
_objects
.
iteritems
():
for
key
,
value
in
installed_item
.
_objects
.
iteritems
():
...
@@ -2749,7 +2743,6 @@ class CatalogMethodTemplateItem(ObjectTemplateItem):
...
@@ -2749,7 +2743,6 @@ class CatalogMethodTemplateItem(ObjectTemplateItem):
# Restore filter
# Restore filter
if
self
.
_is_filtered_archive
.
get
(
method_id
,
0
):
if
self
.
_is_filtered_archive
.
get
(
method_id
,
0
):
expression
=
self
.
_filter_expression_archive
[
method_id
]
expression
=
self
.
_filter_expression_archive
[
method_id
]
if
1
:
if
expression
and
expression
.
strip
():
if
expression
and
expression
.
strip
():
# only compile non-empty expressions
# only compile non-empty expressions
expr_instance
=
Expression
(
expression
)
expr_instance
=
Expression
(
expression
)
...
@@ -2961,7 +2954,6 @@ class ActionTemplateItem(ObjectTemplateItem):
...
@@ -2961,7 +2954,6 @@ class ActionTemplateItem(ObjectTemplateItem):
def
install
(
self
,
context
,
trashbin
,
**
kw
):
def
install
(
self
,
context
,
trashbin
,
**
kw
):
update_dict
=
kw
.
get
(
'object_to_update'
)
update_dict
=
kw
.
get
(
'object_to_update'
)
force
=
kw
.
get
(
'force'
)
force
=
kw
.
get
(
'force'
)
if
1
:
portal_type_dict
=
{}
portal_type_dict
=
{}
p
=
context
.
getPortalObject
()
p
=
context
.
getPortalObject
()
for
id
in
self
.
_objects
.
keys
():
for
id
in
self
.
_objects
.
keys
():
...
@@ -3248,7 +3240,6 @@ class SitePropertyTemplateItem(BaseTemplateItem):
...
@@ -3248,7 +3240,6 @@ class SitePropertyTemplateItem(BaseTemplateItem):
def
install
(
self
,
context
,
trashbin
,
**
kw
):
def
install
(
self
,
context
,
trashbin
,
**
kw
):
update_dict
=
kw
.
get
(
'object_to_update'
)
update_dict
=
kw
.
get
(
'object_to_update'
)
force
=
kw
.
get
(
'force'
)
force
=
kw
.
get
(
'force'
)
if
1
:
p
=
context
.
getPortalObject
()
p
=
context
.
getPortalObject
()
for
path
in
self
.
_objects
.
keys
():
for
path
in
self
.
_objects
.
keys
():
if
update_dict
.
has_key
(
path
)
or
force
:
if
update_dict
.
has_key
(
path
)
or
force
:
...
@@ -3491,7 +3482,6 @@ class FilesystemDocumentTemplateItem(BaseTemplateItem):
...
@@ -3491,7 +3482,6 @@ class FilesystemDocumentTemplateItem(BaseTemplateItem):
def
preinstall
(
self
,
context
,
installed_item
,
**
kw
):
def
preinstall
(
self
,
context
,
installed_item
,
**
kw
):
modified_object_list
=
{}
modified_object_list
=
{}
if
1
:
# fix key if necessary in installed bt for diff
# fix key if necessary in installed bt for diff
extra_prefix
=
self
.
__class__
.
__name__
+
'/'
extra_prefix
=
self
.
__class__
.
__name__
+
'/'
for
key
in
installed_item
.
_objects
.
keys
():
for
key
in
installed_item
.
_objects
.
keys
():
...
@@ -3539,7 +3529,6 @@ class FilesystemDocumentTemplateItem(BaseTemplateItem):
...
@@ -3539,7 +3529,6 @@ class FilesystemDocumentTemplateItem(BaseTemplateItem):
def
install
(
self
,
context
,
trashbin
,
**
kw
):
def
install
(
self
,
context
,
trashbin
,
**
kw
):
update_dict
=
kw
.
get
(
'object_to_update'
)
update_dict
=
kw
.
get
(
'object_to_update'
)
force
=
kw
.
get
(
'force'
)
force
=
kw
.
get
(
'force'
)
if
1
:
need_reset
=
isinstance
(
self
,
FilesystemDocumentTemplateItem
)
need_reset
=
isinstance
(
self
,
FilesystemDocumentTemplateItem
)
for
key
in
self
.
_objects
.
keys
():
for
key
in
self
.
_objects
.
keys
():
# to achieve non data migration fresh installation parameters
# to achieve non data migration fresh installation parameters
...
@@ -4112,7 +4101,6 @@ class RoleTemplateItem(BaseTemplateItem):
...
@@ -4112,7 +4101,6 @@ class RoleTemplateItem(BaseTemplateItem):
def
preinstall
(
self
,
context
,
installed_item
,
**
kw
):
def
preinstall
(
self
,
context
,
installed_item
,
**
kw
):
modified_object_list
=
{}
modified_object_list
=
{}
if
1
:
# BBB it might be necessary to change the data structure.
# BBB it might be necessary to change the data structure.
obsolete_key
=
self
.
__class__
.
__name__
+
'/role_list'
obsolete_key
=
self
.
__class__
.
__name__
+
'/role_list'
if
obsolete_key
in
installed_item
.
_objects
:
if
obsolete_key
in
installed_item
.
_objects
:
...
@@ -4235,7 +4223,6 @@ class CatalogKeyTemplateItemBase(BaseTemplateItem):
...
@@ -4235,7 +4223,6 @@ class CatalogKeyTemplateItemBase(BaseTemplateItem):
return
return
catalog_key_list
=
list
(
getattr
(
catalog
,
self
.
key_list_attr
,
[]))
catalog_key_list
=
list
(
getattr
(
catalog
,
self
.
key_list_attr
,
[]))
if
1
:
if
len
(
self
.
_objects
.
keys
())
==
0
:
# needed because of pop()
if
len
(
self
.
_objects
.
keys
())
==
0
:
# needed because of pop()
return
return
keys
=
[]
keys
=
[]
...
@@ -4408,7 +4395,6 @@ class MessageTranslationTemplateItem(BaseTemplateItem):
...
@@ -4408,7 +4395,6 @@ class MessageTranslationTemplateItem(BaseTemplateItem):
def
preinstall
(
self
,
context
,
installed_item
,
**
kw
):
def
preinstall
(
self
,
context
,
installed_item
,
**
kw
):
modified_object_list
=
{}
modified_object_list
=
{}
if
1
:
for
path
in
self
.
_objects
:
for
path
in
self
.
_objects
:
if
installed_item
.
_objects
.
has_key
(
path
):
if
installed_item
.
_objects
.
has_key
(
path
):
# compare object to see if there is changes
# compare object to see if there is changes
...
@@ -4454,7 +4440,6 @@ class MessageTranslationTemplateItem(BaseTemplateItem):
...
@@ -4454,7 +4440,6 @@ class MessageTranslationTemplateItem(BaseTemplateItem):
localizer
=
context
.
getPortalObject
().
Localizer
localizer
=
context
.
getPortalObject
().
Localizer
update_dict
=
kw
.
get
(
'object_to_update'
,
{})
update_dict
=
kw
.
get
(
'object_to_update'
,
{})
force
=
kw
.
get
(
'force'
)
force
=
kw
.
get
(
'force'
)
if
1
:
for
key
in
sorted
(
self
.
_objects
.
keys
()):
for
key
in
sorted
(
self
.
_objects
.
keys
()):
if
update_dict
.
has_key
(
key
)
or
force
:
if
update_dict
.
has_key
(
key
)
or
force
:
if
not
force
:
if
not
force
:
...
...
This diff is collapsed.
Click to expand it.
product/ERP5/Tool/TemplateTool.py
View file @
020473fa
...
@@ -307,7 +307,6 @@ class TemplateTool (BaseTool):
...
@@ -307,7 +307,6 @@ class TemplateTool (BaseTool):
file
.
seek
(
0
)
file
.
seek
(
0
)
magic
=
file
.
read
(
5
)
magic
=
file
.
read
(
5
)
if
1
:
# XXX: should really check for a magic and offer a falback if it
# XXX: should really check for a magic and offer a falback if it
# doens't correspond to anything handled.
# doens't correspond to anything handled.
tar
=
tarfile
.
open
(
path
,
'r:gz'
)
tar
=
tarfile
.
open
(
path
,
'r:gz'
)
...
...
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