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
Labels
Merge Requests
144
Merge Requests
144
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
Jobs
Commits
Open sidebar
nexedi
erp5
Commits
0ee3f476
Commit
0ee3f476
authored
Jan 26, 2021
by
Jérome Perrin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ERP5Form: implement a basic _checkConsistency for ProxyField WIP
parent
cb5aeb8f
Pipeline
#13290
running with stage
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
21 additions
and
0 deletions
+21
-0
product/ERP5Form/Form.py
product/ERP5Form/Form.py
+7
-0
product/ERP5Form/ProxyField.py
product/ERP5Form/ProxyField.py
+14
-0
No files found.
product/ERP5Form/Form.py
View file @
0ee3f476
...
...
@@ -1386,6 +1386,13 @@ class ERP5Form(Base, ZMIForm, ZopePageTemplate):
addMessage
(
'erp5-Guideline.Use.Correct.Names.For.Simulation.And.Validation.Titles'
,
'Workflow state fields should be named my_translated_${state_variable}_title'
)
# check fields, if they implement _checkConsistency
for
field
in
self
.
objectValues
():
_checkConsitency
=
getattr
(
field
,
'_checkConsistency'
,
None
)
if
_checkConsitency
is
not
None
:
message_list
.
extend
(
_checkConsitency
(
fixit
=
fixit
))
return
message_list
...
...
product/ERP5Form/ProxyField.py
View file @
0ee3f476
...
...
@@ -35,6 +35,7 @@ from Products.Formulator.Errors import ValidationError
from
Products.Formulator
import
MethodField
from
Products.ERP5Type.Utils
import
convertToUpperCase
from
Products.ERP5Type.TransactionalVariable
import
getTransactionalVariable
from
Products.ERP5Type.ObjectMessage
import
ObjectMessage
from
Products.PageTemplates.PageTemplateFile
import
PageTemplateFile
...
...
@@ -790,6 +791,19 @@ class ProxyField(ZMIField):
return
cache
.
__of__
(
parent
)
raise
KeyError
def
_checkConsistency
(
self
,
fixit
=
False
):
"""Check the proxy field internal data structures are consistent
"""
object_relative_url
=
'/'
.
join
(
self
.
getPhysicalPath
())[
len
(
self
.
getPortalObject
().
getPath
()):]
difference
=
set
(
self
.
tales
).
difference
(
self
.
values
)
assert
not
fixit
,
"todo"
if
difference
:
return
[
ObjectMessage
(
object_relative_url
=
object_relative_url
,
message
=
"Internal proxy field data structures are inconsistent. "
"Differences: {}"
.
format
(
difference
))]
return
[]
#
# get_value exception dict
...
...
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