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
Nikola Balog
erp5
Commits
b4dc532d
Commit
b4dc532d
authored
Nov 21, 2022
by
Jérome Perrin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ProxyField: make it possible to repair broken proxy fields
There have been a regression recently
parent
dff34472
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
27 additions
and
6 deletions
+27
-6
bt5/erp5_core_test/TestTemplateItem/portal_components/test.erp5.testProxyField.py
...emplateItem/portal_components/test.erp5.testProxyField.py
+15
-3
product/ERP5Form/ProxyField.py
product/ERP5Form/ProxyField.py
+10
-1
product/ERP5Form/dtml/proxyFieldEdit.dtml
product/ERP5Form/dtml/proxyFieldEdit.dtml
+1
-1
product/ERP5Form/dtml/proxyFieldTales.dtml
product/ERP5Form/dtml/proxyFieldTales.dtml
+1
-1
No files found.
bt5/erp5_core_test/TestTemplateItem/portal_components/test.erp5.testProxyField.py
View file @
b4dc532d
...
...
@@ -398,9 +398,9 @@ return printed
'Base_viewGeek'
,
'View'
)
form
=
skin_folder
.
_getOb
(
'Base_viewGeek'
,
None
)
form
.
manage_addField
(
'my_
title'
,
'Title
'
,
'ProxyField'
)
form
.
manage_addField
(
'my_
proxy_field'
,
'Proxy
'
,
'ProxyField'
)
field
=
form
.
my_
title
field
=
form
.
my_
proxy_field
self
.
assertFalse
(
form
.
get_fields
())
self
.
assertEqual
([
field
],
form
.
get_fields
(
include_disabled
=
True
))
...
...
@@ -409,10 +409,22 @@ return printed
self
.
assertEqual
(
''
,
field
.
get_tales
(
'default'
))
regexp
=
'^%s$'
%
re
.
escape
(
"Can't find the template field of"
" <ProxyField at /%s/portal_skins/erp5_geek/Base_viewGeek/my_
title
>"
" <ProxyField at /%s/portal_skins/erp5_geek/Base_viewGeek/my_
proxy_field
>"
%
self
.
portal
.
getId
())
for
func
in
(
field
.
render
,
partial
(
field
.
get_value
,
'default'
)
,
partial
(
field
.
get_recursive_tales
,
'default'
)
):
self
.
assertRaisesRegexp
(
BrokenProxyField
,
regexp
,
func
)
# we can still view the field in ZMI
form
.
manage_main
()
field
.
manage_main
()
# and repair it
form
.
manage_addField
(
'my_field'
,
'Title'
,
'StringField'
)
field
.
manage_edit
(
{
'field_form_id'
:
'Base_viewGeek'
,
'field_field_id'
:
'my_field'
,
})
self
.
assertEqual
(
field
.
getTemplateField
(),
form
.
my_field
)
product/ERP5Form/ProxyField.py
View file @
b4dc532d
...
...
@@ -171,8 +171,9 @@ class ProxyField(ZMIField):
Surcharged values from proxied field.
"""
# Edit template field attributes
template_field
=
self
.
get
Recursive
TemplateField
()
template_field
=
self
.
getTemplateField
()
if
template_field
is
not
None
:
template_field
=
self
.
getRecursiveTemplateField
()
# Check the surcharged checkboxes
surcharge_list
=
[]
...
...
@@ -581,6 +582,14 @@ class ProxyField(ZMIField):
# ("form_id and field_id don't define a valid template")
pass
security
.
declareProtected
(
'View'
,
'title'
)
def
title
(
self
):
"""The title of this field."""
try
:
return
super
(
ProxyField
,
self
).
title
()
except
BrokenProxyField
:
return
'broken'
security
.
declareProtected
(
'Access contents information'
,
'has_value'
)
def
has_value
(
self
,
id
):
"""
...
...
product/ERP5Form/dtml/proxyFieldEdit.dtml
View file @
b4dc532d
...
...
@@ -11,7 +11,7 @@ Surcharge <dtml-var meta_type> properties here.
<form action="manage_edit" method="POST">
<table cellspacing="0" cellpadding="2" border="0">
<dtml-let proxy_field="this()"
current_field="proxy_field.getRecursiveTemplateField()">
current_field="
None if proxy_field.getTemplateField() is None else
proxy_field.getRecursiveTemplateField()">
<!-- First, display ProxyField properties -->
<!-- see: Formulator/dtml/fieldEdit.dtml -->
...
...
product/ERP5Form/dtml/proxyFieldTales.dtml
View file @
b4dc532d
...
...
@@ -68,7 +68,7 @@ This tab can therefore not be used.
<!-- XXX Loop until find not a proxy field -->
<dtml-let proxy_field="this()"
current_field="proxy_field.getRecursiveTemplateField()">
current_field="
None if proxy_field.getTemplateField() is None else
proxy_field.getRecursiveTemplateField()">
<dtml-if "current_field is not None">
<dtml-let form="current_field.tales_form">
...
...
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