sobjects/hooks.py
branchstable
changeset 2101 08003e0354a7
parent 1977 606923dff11b
child 2495 abcbadcc110a
equal deleted inserted replaced
2100:89b825cdec74 2101:08003e0354a7
    24 
    24 
    25 class AutoDeleteBookmark(PreCommitOperation):
    25 class AutoDeleteBookmark(PreCommitOperation):
    26     beid = None # make pylint happy
    26     beid = None # make pylint happy
    27     def precommit_event(self):
    27     def precommit_event(self):
    28         session = self.session
    28         session = self.session
    29         if not self.beid in session.query_data('pendingeids', ()):
    29         if not self.beid in session.transaction_data.get('pendingeids', ()):
    30             if not session.unsafe_execute('Any X WHERE X bookmarked_by U, X eid %(x)s',
    30             if not session.unsafe_execute('Any X WHERE X bookmarked_by U, X eid %(x)s',
    31                                           {'x': self.beid}, 'x'):
    31                                           {'x': self.beid}, 'x'):
    32                 session.unsafe_execute('DELETE Bookmark X WHERE X eid %(x)s',
    32                 session.unsafe_execute('DELETE Bookmark X WHERE X eid %(x)s',
    33                                        {'x': self.beid}, 'x')
    33                                        {'x': self.beid}, 'x')
    34 
    34