web/views/editcontroller.py
changeset 8748 f5027f8d2478
parent 8697 574bb05e40a4
child 8848 08bb2dd18fd2
equal deleted inserted replaced
8747:c0d4244e5abc 8748:f5027f8d2478
    23 
    23 
    24 from logilab.common.deprecation import deprecated
    24 from logilab.common.deprecation import deprecated
    25 
    25 
    26 from rql.utils import rqlvar_maker
    26 from rql.utils import rqlvar_maker
    27 
    27 
    28 from cubicweb import Binary, ValidationError, typed_eid
    28 from cubicweb import Binary, ValidationError
    29 from cubicweb.view import EntityAdapter, implements_adapter_compat
    29 from cubicweb.view import EntityAdapter, implements_adapter_compat
    30 from cubicweb.predicates import is_instance
    30 from cubicweb.predicates import is_instance
    31 from cubicweb.web import (INTERNAL_FIELD_VALUE, RequestError, NothingToEdit,
    31 from cubicweb.web import (INTERNAL_FIELD_VALUE, RequestError, NothingToEdit,
    32                           ProcessFormError)
    32                           ProcessFormError)
    33 from cubicweb.web.views import basecontrollers, autoform
    33 from cubicweb.web.views import basecontrollers, autoform
    65         pass
    65         pass
    66 
    66 
    67 
    67 
    68 def valerror_eid(eid):
    68 def valerror_eid(eid):
    69     try:
    69     try:
    70         return typed_eid(eid)
    70         return int(eid)
    71     except (ValueError, TypeError):
    71     except (ValueError, TypeError):
    72         return eid
    72         return eid
    73 
    73 
    74 class RqlQuery(object):
    74 class RqlQuery(object):
    75     def __init__(self):
    75     def __init__(self):
   215         if '__delete' in formparams:
   215         if '__delete' in formparams:
   216             # XXX deprecate?
   216             # XXX deprecate?
   217             todelete = self._cw.list_form_param('__delete', formparams, pop=True)
   217             todelete = self._cw.list_form_param('__delete', formparams, pop=True)
   218             autoform.delete_relations(self._cw, todelete)
   218             autoform.delete_relations(self._cw, todelete)
   219         if '__cloned_eid' in formparams:
   219         if '__cloned_eid' in formparams:
   220             entity.copy_relations(typed_eid(formparams['__cloned_eid']))
   220             entity.copy_relations(int(formparams['__cloned_eid']))
   221         if is_main_entity: # only execute linkto for the main entity
   221         if is_main_entity: # only execute linkto for the main entity
   222             self.execute_linkto(entity.eid)
   222             self.execute_linkto(entity.eid)
   223         return eid
   223         return eid
   224 
   224 
   225     def handle_formfield(self, form, field, rqlquery=None):
   225     def handle_formfield(self, form, field, rqlquery=None):