13 # FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more |
13 # FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more |
14 # details. |
14 # details. |
15 # |
15 # |
16 # You should have received a copy of the GNU Lesser General Public License along |
16 # You should have received a copy of the GNU Lesser General Public License along |
17 # with CubicWeb. If not, see <http://www.gnu.org/licenses/>. |
17 # with CubicWeb. If not, see <http://www.gnu.org/licenses/>. |
18 """bookmark related hooks |
18 """bookmark related hooks""" |
19 |
19 |
20 """ |
|
21 __docformat__ = "restructuredtext en" |
20 __docformat__ = "restructuredtext en" |
22 |
21 |
23 from cubicweb.server import hook |
22 from cubicweb.server import hook |
24 |
23 |
25 |
24 |
26 class AutoDeleteBookmarkOp(hook.Operation): |
25 class AutoDeleteBookmarkOp(hook.Operation): |
27 bookmark = None # make pylint happy |
26 bookmark = None # make pylint happy |
28 def precommit_event(self): |
27 def precommit_event(self): |
29 if not self.session.deleted_in_transaction(self.bookmark.eid): |
28 if not self.session.deleted_in_transaction(self.bookmark.eid): |
30 if not self.bookmark.bookmarked_by: |
29 if not self.bookmark.bookmarked_by: |
31 self.bookmark.delete() |
30 self.bookmark.cw_delete() |
32 |
31 |
33 |
32 |
34 class DelBookmarkedByHook(hook.Hook): |
33 class DelBookmarkedByHook(hook.Hook): |
35 """ensure user logins are stripped""" |
34 """ensure user logins are stripped""" |
36 __regid__ = 'autodelbookmark' |
35 __regid__ = 'autodelbookmark' |