web/views/basecontrollers.py
changeset 5174 78438ad513ca
parent 5159 2543cfa5d54a
child 5177 395e1ff018ae
equal deleted inserted replaced
5173:73760bbb66bd 5174:78438ad513ca
   178             if target == 'subject':
   178             if target == 'subject':
   179                 rql = 'SET X %s Y WHERE X eid %%(x)s, Y eid %%(y)s' % rtype
   179                 rql = 'SET X %s Y WHERE X eid %%(x)s, Y eid %%(y)s' % rtype
   180             else:
   180             else:
   181                 rql = 'SET Y %s X WHERE X eid %%(x)s, Y eid %%(y)s' % rtype
   181                 rql = 'SET Y %s X WHERE X eid %%(x)s, Y eid %%(y)s' % rtype
   182             for teid in eids:
   182             for teid in eids:
   183                 req.execute(rql, {'x': eid, 'y': typed_eid(teid)}, ('x', 'y'))
   183                 req.execute(rql, {'x': eid, 'y': typed_eid(teid)})
   184 
   184 
   185 
   185 
   186 def _validation_error(req, ex):
   186 def _validation_error(req, ex):
   187     req.cnx.rollback()
   187     req.cnx.rollback()
   188     # XXX necessary to remove existant validation error?
   188     # XXX necessary to remove existant validation error?
   315         # simulate click on __action_%s button to help the controller
   315         # simulate click on __action_%s button to help the controller
   316         if action:
   316         if action:
   317             form['__action_%s' % action] = u'whatever'
   317             form['__action_%s' % action] = u'whatever'
   318         return form
   318         return form
   319 
   319 
   320     def _exec(self, rql, args=None, eidkey=None, rocheck=True):
   320     def _exec(self, rql, args=None, rocheck=True):
   321         """json mode: execute RQL and return resultset as json"""
   321         """json mode: execute RQL and return resultset as json"""
   322         if rocheck:
   322         if rocheck:
   323             self._cw.ensure_ro_rql(rql)
   323             self._cw.ensure_ro_rql(rql)
   324         try:
   324         try:
   325             return self._cw.execute(rql, args, eidkey)
   325             return self._cw.execute(rql, args)
   326         except Exception, ex:
   326         except Exception, ex:
   327             self.exception("error in _exec(rql=%s): %s", rql, ex)
   327             self.exception("error in _exec(rql=%s): %s", rql, ex)
   328             return None
   328             return None
   329         return None
   329         return None
   330 
   330