web/views/autoform.py
changeset 5223 6abd6e3599f4
parent 5174 78438ad513ca
child 5385 b6e250dd7a7d
equal deleted inserted replaced
5216:4f4369e63f5e 5223:6abd6e3599f4
   254     """shortcut to access req's pending_insert entry
   254     """shortcut to access req's pending_insert entry
   255 
   255 
   256     This is where are stored relations being added while editing
   256     This is where are stored relations being added while editing
   257     an entity. This used to be stored in a temporary cookie.
   257     an entity. This used to be stored in a temporary cookie.
   258     """
   258     """
   259     pending = req.get_session_data('pending_insert') or ()
   259     pending = req.session.data.get('pending_insert', ())
   260     return ['%s:%s:%s' % (subj, rel, obj) for subj, rel, obj in pending
   260     return ['%s:%s:%s' % (subj, rel, obj) for subj, rel, obj in pending
   261             if eid is None or eid in (subj, obj)]
   261             if eid is None or eid in (subj, obj)]
   262 
   262 
   263 def get_pending_deletes(req, eid=None):
   263 def get_pending_deletes(req, eid=None):
   264     """shortcut to access req's pending_delete entry
   264     """shortcut to access req's pending_delete entry
   265 
   265 
   266     This is where are stored relations being removed while editing
   266     This is where are stored relations being removed while editing
   267     an entity. This used to be stored in a temporary cookie.
   267     an entity. This used to be stored in a temporary cookie.
   268     """
   268     """
   269     pending = req.get_session_data('pending_delete') or ()
   269     pending = req.session.data.get('pending_delete', ())
   270     return ['%s:%s:%s' % (subj, rel, obj) for subj, rel, obj in pending
   270     return ['%s:%s:%s' % (subj, rel, obj) for subj, rel, obj in pending
   271             if eid is None or eid in (subj, obj)]
   271             if eid is None or eid in (subj, obj)]
   272 
   272 
   273 def parse_relations_descr(rdescr):
   273 def parse_relations_descr(rdescr):
   274     """parse a string describing some relations, in the form
   274     """parse a string describing some relations, in the form