annotate MoinMoin/action/bookmark.py @ 1110:b27d720fbc8e

actions: cleanup, fix imports
author Thomas Waldmann <tw AT waldmann-edv DOT de>
date Mon, 31 Jul 2006 01:07:59 +0200
parents 95de1730bedb
children ed44b93599b5
rev   line source
1109
95de1730bedb move bookmark code to action/bookmark.py
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
1 # -*- coding: iso-8859-1 -*-
95de1730bedb move bookmark code to action/bookmark.py
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
2 """
95de1730bedb move bookmark code to action/bookmark.py
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
3 MoinMoin - set or delete bookmarks (in time) for RecentChanges
95de1730bedb move bookmark code to action/bookmark.py
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
4
95de1730bedb move bookmark code to action/bookmark.py
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
5 @copyright: 2000-2004 by Jürgen Hermann <jh@web.de>,
95de1730bedb move bookmark code to action/bookmark.py
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
6 2006 by MoinMoin:ThomasWaldmann
95de1730bedb move bookmark code to action/bookmark.py
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
7 @license: GNU GPL, see COPYING for details.
95de1730bedb move bookmark code to action/bookmark.py
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
8 """
1110
b27d720fbc8e actions: cleanup, fix imports
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 1109
diff changeset
9 import time
b27d720fbc8e actions: cleanup, fix imports
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 1109
diff changeset
10
1109
95de1730bedb move bookmark code to action/bookmark.py
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
11 from MoinMoin import wikiutil
95de1730bedb move bookmark code to action/bookmark.py
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
12 from MoinMoin.Page import Page
95de1730bedb move bookmark code to action/bookmark.py
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
13
95de1730bedb move bookmark code to action/bookmark.py
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
14 def execute(pagename, request):
95de1730bedb move bookmark code to action/bookmark.py
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
15 """ set bookmarks (in time) for RecentChanges or delete them """
95de1730bedb move bookmark code to action/bookmark.py
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
16 timestamp = request.form.get('time', [None])[0]
95de1730bedb move bookmark code to action/bookmark.py
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
17 if timestamp is not None:
95de1730bedb move bookmark code to action/bookmark.py
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
18 if timestamp == 'del':
95de1730bedb move bookmark code to action/bookmark.py
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
19 tm = None
95de1730bedb move bookmark code to action/bookmark.py
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
20 else:
95de1730bedb move bookmark code to action/bookmark.py
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
21 try:
95de1730bedb move bookmark code to action/bookmark.py
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
22 tm = int(timestamp)
95de1730bedb move bookmark code to action/bookmark.py
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
23 except StandardError:
95de1730bedb move bookmark code to action/bookmark.py
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
24 tm = wikiutil.timestamp2version(time.time())
95de1730bedb move bookmark code to action/bookmark.py
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
25 else:
95de1730bedb move bookmark code to action/bookmark.py
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
26 tm = wikiutil.timestamp2version(time.time())
95de1730bedb move bookmark code to action/bookmark.py
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
27
95de1730bedb move bookmark code to action/bookmark.py
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
28 if tm is None:
95de1730bedb move bookmark code to action/bookmark.py
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
29 request.user.delBookmark()
95de1730bedb move bookmark code to action/bookmark.py
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
30 else:
95de1730bedb move bookmark code to action/bookmark.py
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
31 request.user.setBookmark(tm)
95de1730bedb move bookmark code to action/bookmark.py
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
32 request.page.send_page(request)
95de1730bedb move bookmark code to action/bookmark.py
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
33