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
Iliya Manolov
erp5
Commits
02489da3
Commit
02489da3
authored
12 years ago
by
Arnaud Fontaine
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Implement migration of StringAttributeMatch from filesystem to ZODB.
parent
69dfec4e
master
allow_login_change
allow_login_change_differentiate_id_and_login
allow_login_change_wip
arnau
arnau-kns
arnau-kns-without-property-mapping
authentication_policy_fixes
auto_extend_select_list
autoflake
backup_erp5_workflow
bk_erp5ish_actions_tool
bk_sqlcatalog
bt_owner
cache
catalog_fulltext
catalog_fulltext_old
cedric
cedriclen
cedriclen-eos
cherry-pick-4a8e045d
cherry-pick-bca64206
clean_up_upgrader
compact_title_no_reference
credential_update_action
datetimefield
douglas_forum
dream_distributor
eos-dev
erp5-component
erp5-data-notebook
erp5-forum
erp5-preference
erp5-release
erp5-slapos-upgrade
erp5-vifib
erp5-vifib-cleanup
erp5_calendar
erp5_free_subscription
erp5_workflow
floatArrayTest
for_testrunner_1
for_testrunner_2
formbox
gabriel
gabriel-fix-rounding-in-accounting-generation
gabriel-fix-rounding-in-accounting-generation2
gadget-json-value
http_cache_fix
import_fixes
import_fixes_complete
improve_default_caching_policy_manager
isDeletable
item_tracking_graph_editor
jerome-bt-reference-doc
jerome-test
jerome_events
jerome_graph_editor_renderjs
jerome_new_style_solve_divergence
jerome_user_preference_time_zone
jm/form-action-guard
joblib-activity
jupyter_egg_tests
jupyter_import_dot_fix
jupyter_import_dot_quickfix
jupyter_kernel_fixes
jupyter_reference_warning
jupyter_restricted
kns
mame-erp5_project-cleanup
mame-test-stock-indexation
mame-work
master-erp5-test-result-scalability
master-erp5-test-result-scalability-rebase
master_calendar_wip_patches
master_calendar_wip_patches_extend_security
master_no_guard_on_workflow_transition
master_no_guard_on_workflow_transition_plus_calendar_wip_patchs
mmariani-inventory
mrp
nexedi-erp5-jp
no_reindex_data_stream
officejs
portal_callables
portal_solver_process_security_configuration
rebased_mrp
reindex_calendar_after_change_calendar_exception
removed_portal_skin_redundancy
romain-fulltext
scalability-master2-rebase
scalability-rebase
shop-box
shop-box-rebased
sms_more_than_140_characters
strict_catalog
syncml
test_page
testnode_software_link
timezones
tristan
tristan-merge
tristan-performance
view-aggregated-amounts
vivekpab_erp5webrenderjs_layoutconfig
vivekpab_jabberclient
vivekpab_renderjs_interfaces
wenjie
wenjie_branch
xiaowu_newui
erp5.util-0.4.46
erp5.util-0.4.44
erp5.util-0.4.43
erp5.util-0.4.41
erp5.util-0.4.40
erp5.util-0.4.37
No related merge requests found
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):
regular_expression
=
repr
(
regular_expression
))))
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
)
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