Attachment 'append-text.patch'
Download 1 The append-text.py script from the script market does not seem to work with
2 MoinMoin 1.6. This patch attempts to make it work.
3
4 Please note that you must edit append-text.py to add your config dir
5 (where wikiconfig.py is) and the directory where the MoinMoin library
6 scripts are located to sys.path. If you want to edit MoinMoin pages that
7 are not world-writable, you must edit append-text.py to set the
8 'editor_email' variable.
9
10 To apply this patch run "patch -p 1 < append-text.patch" in the same dir as append-text.py.
11
12 -Dylan
13
14 --- old/append-text.py 2005-05-28 21:18:27.000000000 -0700
15 +++ patched/append-text.py 2008-11-11 14:27:00.000000000 -0800
16 @@ -44,14 +44,22 @@
17 # The path to moinmoin, not needed if its installed with setup.py
18 '/Volumes/Home/nir/Projects/moin/fix'] + sys.path
19
20 +# set this to the email addr of the moin user who this script should act as
21 +# or leave as None
22 +editor_email = None
23 +# editor_email = 'editor@example.com'
24
25 from MoinMoin.PageEditor import PageEditor
26 -from MoinMoin.request import RequestCLI
27 -
28 +from MoinMoin.request.request_cli import Request
29 +from MoinMoin.user import get_by_email_address
30
31 def append(url, pagename, text):
32 - request = RequestCLI(url=url, pagename=pagename)
33 + request = Request(url=url, pagename=pagename)
34 editor = PageEditor(request, pagename)
35 + if editor_email:
36 + if not get_by_email_address(request,editor_email):
37 + raise Exception, 'No MoinMoin user found with email address ' + editor_email
38 + request.user = get_by_email_address(request,editor_email)
39 text = editor.get_raw_body() + editor.normalizeText(text)
40 dummy, revision, exists = editor.get_rev()
41 return editor.saveText(text, revision)
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.