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
Leo Le Bouter
erp5
Commits
e308b004
Commit
e308b004
authored
Sep 06, 2017
by
Tomáš Peterka
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[erp5_core] Carefull refactoring of Base_edit
parent
f7efa99f
Changes
2
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
182 additions
and
178 deletions
+182
-178
bt5/erp5_hal_json_style/SkinTemplateItem/portal_skins/erp5_hal_json_style/Base_edit.py
...emplateItem/portal_skins/erp5_hal_json_style/Base_edit.py
+8
-3
product/ERP5/bootstrap/erp5_core/SkinTemplateItem/portal_skins/erp5_core/Base_edit.py
...core/SkinTemplateItem/portal_skins/erp5_core/Base_edit.py
+174
-175
No files found.
bt5/erp5_hal_json_style/SkinTemplateItem/portal_skins/erp5_hal_json_style/Base_edit.py
View file @
e308b004
...
...
@@ -91,7 +91,10 @@ def editListBox(listbox_field, listbox):
def
editMatrixBox
(
matrixbox_field
,
matrixbox
):
""" Function called to edit a Matrix box
"""Go through every field in matrix and call edit on it.
Most of the code is just a copy&paste from ERP5Form/MatrixBox:render and
should be in (non-yet-existing) MatrixBoxEditor instead of here (XXX TODO).
"""
if
matrixbox
is
None
:
return
...
...
@@ -170,7 +173,7 @@ def editMatrixBox(matrixbox_field, matrixbox):
matrix_context
.
setCellRange
(
base_id
=
cell_base_id
,
*
matrixbox_cell_range
)
for
cell_index_tuple
,
cell_value_dict
in
matrixbox
.
items
():
#
Only update cells which still exist
#
after constructing the cell-range we can edit all existing cells
if
not
matrix_context
.
hasInRange
(
*
cell_index_tuple
,
**
kd
):
return
"Cell %s does not exist"
%
str
(
cell_index_tuple
)
...
...
@@ -204,7 +207,7 @@ MARKER = [] # placeholder for an empty value
message
=
Base_translateString
(
"Data updated."
)
try
:
#
extract all listbox's object form fields from the request and `edit` the object
#
Extract all form fields from the request and call `edit` on them
for
field
in
form
.
get_fields
():
# Dispatch field either to `edit_kwargs` (in case of simple fields) or to `encapsulated_editor_list` in case of editors
field_name
=
field
.
id
if
not
field
.
has_value
(
'alternate_name'
)
else
(
field
.
get_value
(
'alternate_name'
)
or
field
.
id
)
...
...
@@ -217,6 +220,7 @@ try:
edit_kwargs
[
field_name
[
len
(
field_prefix
):]]
=
field_value
if
field_value
!=
''
else
None
## XXX We need to find a way not to use meta_type.
# Kato: can be done simply by implementing 'Editors' for fields which are here
field_meta_type
=
field
.
meta_type
if
field_meta_type
==
'ProxyField'
:
field_meta_type
=
field
.
getRecursiveTemplateField
().
meta_type
...
...
@@ -235,6 +239,7 @@ try:
context
.
edit
(
REQUEST
=
request
,
edit_order
=
edit_order
,
**
edit_kwargs
)
for
encapsulated_editor
in
encapsulated_editor_list
:
encapsulated_editor
.
edit
(
context
)
except
ActivityPendingError
as
e
:
message
=
Base_translateString
(
str
(
e
))
...
...
product/ERP5/bootstrap/erp5_core/SkinTemplateItem/portal_skins/erp5_core/Base_edit.py
View file @
e308b004
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