5 :contact: http://www.logilab.fr/ -- mailto:contact@logilab.fr |
5 :contact: http://www.logilab.fr/ -- mailto:contact@logilab.fr |
6 :license: GNU Lesser General Public License, v2.1 - http://www.gnu.org/licenses |
6 :license: GNU Lesser General Public License, v2.1 - http://www.gnu.org/licenses |
7 """ |
7 """ |
8 __docformat__ = "restructuredtext en" |
8 __docformat__ = "restructuredtext en" |
9 |
9 |
10 from decimal import Decimal |
|
11 |
|
12 from rql.utils import rqlvar_maker |
10 from rql.utils import rqlvar_maker |
|
11 |
|
12 from logilab.common.textutils import splitstrip |
13 |
13 |
14 from cubicweb import Binary, ValidationError, typed_eid |
14 from cubicweb import Binary, ValidationError, typed_eid |
15 from cubicweb.web import INTERNAL_FIELD_VALUE, RequestError, NothingToEdit, ProcessFormError |
15 from cubicweb.web import INTERNAL_FIELD_VALUE, RequestError, NothingToEdit, ProcessFormError |
16 from cubicweb.web.controller import parse_relations_descr |
16 from cubicweb.web.controller import parse_relations_descr |
17 from cubicweb.web.views.basecontrollers import ViewController |
17 from cubicweb.web.views.basecontrollers import ViewController |
18 |
18 |
19 |
|
20 class ToDoLater(Exception): |
|
21 """exception used in the edit controller to indicate that a relation |
|
22 can't be handled right now and have to be handled later |
|
23 """ |
|
24 |
19 |
25 class RqlQuery(object): |
20 class RqlQuery(object): |
26 def __init__(self): |
21 def __init__(self): |
27 self.edited = [] |
22 self.edited = [] |
28 self.restrictions = [] |
23 self.restrictions = [] |
45 rql = 'SET %s WHERE X eid %%(%s)s' % (','.join(self.edited), var) |
40 rql = 'SET %s WHERE X eid %%(%s)s' % (','.join(self.edited), var) |
46 if self.restrictions: |
41 if self.restrictions: |
47 rql += ', %s' % ','.join(self.restrictions) |
42 rql += ', %s' % ','.join(self.restrictions) |
48 self.kwargs[var] = eid |
43 self.kwargs[var] = eid |
49 return rql |
44 return rql |
|
45 |
50 |
46 |
51 class EditController(ViewController): |
47 class EditController(ViewController): |
52 __regid__ = 'edit' |
48 __regid__ = 'edit' |
53 |
49 |
54 def publish(self, rset=None): |
50 def publish(self, rset=None): |