equal
deleted
inserted
replaced
279 return self.count > 0 |
279 return self.count > 0 |
280 |
280 |
281 def addpending(self, category, callback): |
281 def addpending(self, category, callback): |
282 """add a callback to be called when the transaction is pending |
282 """add a callback to be called when the transaction is pending |
283 |
283 |
|
284 The transaction will be given as callback's first argument. |
|
285 |
284 Category is a unique identifier to allow overwriting an old callback |
286 Category is a unique identifier to allow overwriting an old callback |
285 with a newer callback. |
287 with a newer callback. |
286 """ |
288 """ |
287 self._pendingcallback[category] = callback |
289 self._pendingcallback[category] = callback |
288 |
290 |
292 |
294 |
293 This is used to allow hooks to view a transaction before commit''' |
295 This is used to allow hooks to view a transaction before commit''' |
294 categories = sorted(self._pendingcallback) |
296 categories = sorted(self._pendingcallback) |
295 for cat in categories: |
297 for cat in categories: |
296 # remove callback since the data will have been flushed |
298 # remove callback since the data will have been flushed |
297 any = self._pendingcallback.pop(cat)() |
299 any = self._pendingcallback.pop(cat)(self) |
298 self._anypending = self._anypending or any |
300 self._anypending = self._anypending or any |
299 return self._anypending |
301 return self._anypending |
300 |
302 |
301 @active |
303 @active |
302 def addfinalize(self, category, callback): |
304 def addfinalize(self, category, callback): |