Commit f5a65620 authored by Jean-Paul Smets's avatar Jean-Paul Smets

merged Coramy fast input code


git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@626 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 4a77c011
...@@ -36,6 +36,7 @@ from Products.Formulator.MethodField import BoundMethod ...@@ -36,6 +36,7 @@ from Products.Formulator.MethodField import BoundMethod
from Selection import Selection from Selection import Selection
from DateTime import DateTime from DateTime import DateTime
from Products.ERP5Type.Utils import getPath from Products.ERP5Type.Utils import getPath
from Products.ERP5Type.Document import newTempBase
from xml.sax.saxutils import escape from xml.sax.saxutils import escape
from copy import copy from copy import copy
...@@ -1185,6 +1186,32 @@ class ListBoxValidator(Validator.Validator): ...@@ -1185,6 +1186,32 @@ class ListBoxValidator(Validator.Validator):
listbox_uids = REQUEST.get('%s_uid' % field.id, []) listbox_uids = REQUEST.get('%s_uid' % field.id, [])
errors = [] errors = []
for uid in listbox_uids: for uid in listbox_uids:
if str(uid).find('new') == 0:
# First case: dialog input to create new objects
o = newTempBase(here, uid[4:])
o.uid = uid
result[uid[4:]] = {}
for sql in editable_column_ids:
alias = '_'.join(sql.split('.'))
if '.' in sql:
property_id = '.'.join(sql.split('.')[1:]) # Only take trailing part
else:
property_id = alias
my_field_id = '%s_%s' % (field.id, alias)
if form.has_field( my_field_id ):
my_field = form.get_field(my_field_id)
key = 'field_' + my_field.id + '_%s' % o.uid
error_result_key = my_field.id + '_%s' % o.uid
REQUEST.cell = o
try:
value = my_field.validator.validate(my_field, key, REQUEST) # We need cell
result[uid[4:]][sql] = value
except ValidationError, err: # XXXX import missing
#LOG("ListBox ValidationError",0,str(err))
err.field_id = error_result_key
errors.append(err)
else:
# Second case: modification of existing objects
try: try:
# We must try this # We must try this
# because sometimes, we can be provided bad uids # because sometimes, we can be provided bad uids
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment