Back to index

moin  1.9.0~rc2
Functions
MoinMoin.action.bookmark Namespace Reference

Functions

def execute

Function Documentation

def MoinMoin.action.bookmark.execute (   pagename,
  request 
)
set bookmarks (in time) for RecentChanges or delete them 

Definition at line 14 of file bookmark.py.

00014 
00015 def execute(pagename, request):
00016     """ set bookmarks (in time) for RecentChanges or delete them """
00017     _ = request.getText
00018     if not request.user.valid:
00019         actname = __name__.split('.')[-1]
00020         request.theme.add_msg(_("You must login to use this action: %(action)s.") % {"action": actname}, "error")
00021         return Page(request, pagename).send_page()
00022 
00023     timestamp = request.values.get('time')
00024     if timestamp is not None:
00025         if timestamp == 'del':
00026             tm = None
00027         else:
00028             try:
00029                 tm = int(timestamp)
00030             except StandardError:
00031                 tm = wikiutil.timestamp2version(time.time())
00032     else:
00033         tm = wikiutil.timestamp2version(time.time())
00034 
00035     if tm is None:
00036         request.user.delBookmark()
00037     else:
00038         request.user.setBookmark(tm)
00039     request.page.send_page()