Attachment 'RecentlyCreatedPages.py'
Download 1 # -*- coding: iso-8859-1 -*-
2 """
3 MoinMoin - RecentlyCreatedPages Macro
4
5 Show a list of recently created pages.
6
7 @copyright: 2007 by Christian Groh < chr dot groh at googlemail dot com >
8 @license: GNU GPL
9
10 """
11
12 import time
13 from MoinMoin import wikiutil
14 from MoinMoin.logfile import editlog
15 from MoinMoin.util import timefuncs
16 from MoinMoin.Page import Page
17
18 Dependencies =["namespace"]
19
20 def execute(macro, args):
21
22 request = macro.request
23
24 # get param
25 try:
26 numberOfPages = int(args)
27 except (KeyError, ValueError, TypeError):
28 numberOfPages = 5
29
30 # get data
31 log = editlog.EditLog(request)
32 counter = 0
33
34 html=[]
35
36 for line in log.reverse():
37 page = Page(request, line.pagename)
38
39 if not request.user.may.read(line.pagename):
40 continue
41
42 if not page.isStandardPage(includeDeleted=False):
43 continue
44
45 if line.action != 'SAVENEW':
46 continue
47
48 link = page.url(request)
49 date = time.strftime("%d.%m.%y", timefuncs.tmtuple((wikiutil.version2timestamp(line.ed_time_usecs))) ) # UTC
50
51 html.append(u'%s <a href="%s">%s</a><BR>' % (date, link, line.pagename))
52
53 counter += 1
54 if counter >= numberOfPages:
55 break
56
57 return u''.join(html)
Attached Files
To refer to attachments on a page, use attachment:filename, as shown below in the list of files. Do NOT use the URL of the [get] link, since this is subject to change and can break easily.You are not allowed to attach a file to this page.