web/views/autoform.py
changeset 5174 78438ad513ca
parent 4932 dce5ebe5d598
child 5223 6abd6e3599f4
equal deleted inserted replaced
5173:73760bbb66bd 5174:78438ad513ca
   287     """delete relations from the repository"""
   287     """delete relations from the repository"""
   288     # FIXME convert to using the syntax subject:relation:eids
   288     # FIXME convert to using the syntax subject:relation:eids
   289     execute = req.execute
   289     execute = req.execute
   290     for subj, rtype, obj in parse_relations_descr(rdefs):
   290     for subj, rtype, obj in parse_relations_descr(rdefs):
   291         rql = 'DELETE X %s Y where X eid %%(x)s, Y eid %%(y)s' % rtype
   291         rql = 'DELETE X %s Y where X eid %%(x)s, Y eid %%(y)s' % rtype
   292         execute(rql, {'x': subj, 'y': obj}, ('x', 'y'))
   292         execute(rql, {'x': subj, 'y': obj})
   293     req.set_message(req._('relations deleted'))
   293     req.set_message(req._('relations deleted'))
   294 
   294 
   295 def insert_relations(req, rdefs):
   295 def insert_relations(req, rdefs):
   296     """insert relations into the repository"""
   296     """insert relations into the repository"""
   297     execute = req.execute
   297     execute = req.execute
   298     for subj, rtype, obj in parse_relations_descr(rdefs):
   298     for subj, rtype, obj in parse_relations_descr(rdefs):
   299         rql = 'SET X %s Y where X eid %%(x)s, Y eid %%(y)s' % rtype
   299         rql = 'SET X %s Y where X eid %%(x)s, Y eid %%(y)s' % rtype
   300         execute(rql, {'x': subj, 'y': obj}, ('x', 'y'))
   300         execute(rql, {'x': subj, 'y': obj})
   301 
   301 
   302 
   302 
   303 class GenericRelationsWidget(fw.FieldWidget):
   303 class GenericRelationsWidget(fw.FieldWidget):
   304 
   304 
   305     def render(self, form, field, renderer):
   305     def render(self, form, field, renderer):