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
Hardik Juneja
erp5
Commits
e2fa25fc
Commit
e2fa25fc
authored
May 11, 2016
by
Julien Muchembled
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
erp5_forge: improve script to compare fields of 2 skins, to make results easier to read
parent
e1d57590
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
44 additions
and
44 deletions
+44
-44
bt5/erp5_forge/SkinTemplateItem/portal_skins/erp5_toolbox/Base_checkSkinFolderForms.py
...em/portal_skins/erp5_toolbox/Base_checkSkinFolderForms.py
+44
-44
No files found.
bt5/erp5_forge/SkinTemplateItem/portal_skins/erp5_toolbox/Base_checkSkinFolderForms.py
View file @
e2fa25fc
skin_folder
=
getattr
(
context
.
portal_skins
,
original_skin_name
)
from
cgi
import
escape
new_skin_folder
=
getattr
(
context
.
portal_skins
,
new_skin_name
)
portal
=
context
.
getPortalObject
()
skin_folder
=
portal
.
portal_skins
[
original_skin_name
]
output_list
=
[]
new_skin_folder
=
portal
.
portal_skins
[
new_skin_name
]
output_list
=
[
"""<html><head><style>
table { border-collapse: collapse; }
th, td { border: 1px solid gray; padding: 0 .3em; }
</style></head><body>"""
]
output_append
=
output_list
.
append
output_append
=
output_list
.
append
output_append
(
"<html>"
)
output_append
(
" <body>"
)
for
original_form
in
skin_folder
.
objectValues
():
for
original_form
in
skin_folder
.
objectValues
():
if
(
original_form
.
meta_type
==
'ERP5 Form'
or
original_form
.
meta_type
==
'ERP5 Report'
)
and
not
original_form
.
getId
().
endswith
(
'FieldLibrary'
):
if
original_form
.
meta_type
in
(
'ERP5 Form'
,
'ERP5 Report'
)
and
\
new_form
=
getattr
(
new_skin_folder
,
original_form
.
id
)
not
original_form
.
getId
().
endswith
(
'FieldLibrary'
):
new_form
=
new_skin_folder
[
original_form
.
id
]
for
original_field
in
original_form
.
objectValues
():
for
original_field
in
original_form
.
objectValues
():
new_field
=
getattr
(
new_form
,
original_field
.
id
,
None
)
try
:
if
new_field
is
None
:
new_field
=
new_form
[
original_field
.
id
]
output_append
(
"Missing %s in %s"
%
(
original_field
.
id
,
new_form
))
except
KeyError
:
output_append
(
"<p>Missing %s in %s</p>"
%
(
original_field
.
id
,
new_form
.
id
))
else
:
continue
try
:
original_value_dict
,
original_value_tales
=
context
.
Base_getFieldData
(
original_field
)
new_value_dict
,
new_value_tales
=
portal
.
Base_getFieldData
(
new_field
)
except
AttributeError
:
try
:
output_append
(
"<p>Dead proxy field %s %s</p>"
%
(
original_field
.
id
,
new_form
.
id
))
new_value_dict
,
new_value_tales
=
context
.
Base_getFieldData
(
new_field
)
continue
except
AttributeError
:
new_value_dict
=
new_value_tales
=
None
original_value_dict
,
original_value_tales
=
portal
.
Base_getFieldData
(
output_append
(
"Dead proxy field %s %s"
%
(
original_field
.
id
,
new_form
))
original_field
)
if
original_value_dict
==
new_value_dict
and
\
if
new_value_dict
is
not
None
:
original_value_tales
==
new_value_tales
:
continue
if
(
original_value_dict
!=
new_value_dict
)
or
\
(
original_value_tales
!=
new_value_tales
):
output_append
(
"<p>%s/%s<blockquote><table><tr><th>name</th>"
"<th><a href='%s/manage_main'>old</a></th>"
output_append
(
"%s %s <a href='%s'>old</a> <a href='%s'>new</a>"
%
(
"<th><a href='%s/manage_main'>new</a></th>"
new_form
.
id
,
new_field
.
id
,
"</tr>"
%
(
original_field
.
absolute_url
()
+
'/manage_main'
,
new_form
.
id
,
new_field
.
id
,
new_field
.
absolute_url
()
+
'/manage_main'
))
original_field
.
absolute_url
(),
new_field
.
absolute_url
()))
output_append
(
"<blockquote><ul>"
)
output_list
+=
(
"<tr><td>%s</td></tr>"
%
"</td><td>"
.
join
(
map
(
escape
,
(
'[%s]'
%
key
if
T
else
key
,
str
(
old
),
str
(
new
[
key
]))))
for
key
,
original_value
in
original_value_dict
.
items
():
for
T
,
old
,
new
in
((
0
,
original_value_dict
,
new_value_dict
),
if
original_value
!=
new_value_dict
[
key
]:
(
1
,
original_value_tales
,
new_value_tales
))
output_append
(
" <li>"
+
key
+
' Origin: %s '
%
original_value
\
for
key
,
old
in
old
.
iteritems
()
+
' New: %s</li>'
%
new_value_dict
[
key
])
if
old
!=
new
[
key
])
for
key
,
original_value
in
original_value_tales
.
items
():
output_append
(
"</table></blockquote><p>"
)
if
original_value
!=
new_value_tales
[
key
]:
output_append
(
" <li>"
+
key
+
' Origin: %s '
%
original_value
\
+
' New: %s<br></li>'
%
new_value_tales
[
key
])
output_append
(
"</ul></blockquote>"
)
output_append
(
"Finished<br>"
)
output_append
(
"Finished<br>"
)
output_append
(
" </body>"
)
output_append
(
" </body>"
)
...
...
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