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
Laurent S
erp5
Commits
02489da3
Commit
02489da3
authored
Aug 31, 2012
by
Arnaud Fontaine
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Implement migration of StringAttributeMatch from filesystem to ZODB.
parent
69dfec4e
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
48 additions
and
1 deletion
+48
-1
product/ERP5/Document/StringAttributeMatchConstraint.py
product/ERP5/Document/StringAttributeMatchConstraint.py
+48
-1
No files found.
product/ERP5/Document/StringAttributeMatchConstraint.py
View file @
02489da3
...
@@ -66,4 +66,51 @@ class StringAttributeMatchConstraint(PropertyExistenceConstraint):
...
@@ -66,4 +66,51 @@ class StringAttributeMatchConstraint(PropertyExistenceConstraint):
regular_expression
=
repr
(
regular_expression
))))
regular_expression
=
repr
(
regular_expression
))))
return
error_list
return
error_list
_message_id_tuple
=
(
'message_attribute_not_match'
,)
_message_id_tuple
=
PropertyExistenceConstraint
.
_message_id_tuple
+
\
(
'message_attribute_not_match'
,)
@
staticmethod
def
_preConvertBaseFromFilesystemDefinition
(
filesystem_definition_dict
):
"""
'message_property_does_not_match' has been renamed to
'message_property_not_match' to follow ERP5 naming conventions
"""
filesystem_definition_dict
[
'message_property_not_match'
]
=
\
filesystem_definition_dict
.
pop
(
'message_property_does_not_match'
,
None
)
return
PropertyExistenceConstraint
.
_preConvertBaseFromFilesystemDefinition
(
filesystem_definition_dict
)
@
staticmethod
def
_convertFromFilesystemDefinition
(
**
property_dict
):
"""
@see ERP5Type.mixin.constraint.ConstraintMixin._convertFromFilesystemDefinition
One constraint per regular expression and containing one or several
properties is created. Filesystem definition example:
{ 'id' : 'title_not_empty',
'description' : 'Title must be defined',
'type' : 'StringAttributeMatch',
'title' : '^[^ ]'
}
"""
property_list
=
property_dict
.
keys
()
regex_list
=
property_dict
.
values
()
regex_list_len
=
len
(
regex_list
)
seen_property_set
=
set
()
for
property_index
,
property_id
in
enumerate
(
property_list
):
if
property_id
in
seen_property_set
:
continue
constraint_property_list
=
[
property_id
]
constraint_regex
=
regex_list
[
property_index
]
property_index
+=
1
for
regex_index
,
regex
in
enumerate
(
regex_list
[
property_index
:],
property_index
):
if
constraint_regex
==
regex
:
regex_property_id
=
property_list
[
regex_index
]
constraint_property_list
.
append
(
regex_property_id
)
seen_property_set
.
add
(
regex_property_id
)
yield
dict
(
constraint_property_list
=
constraint_property_list
,
regular_expression
=
constraint_regex
)
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