[Moin-user] Import text file
Olivier Lauret
olivier.lauret at googlemail.com
Wed Nov 12 06:43:01 EST 2008
Hi Dylan,
Thank you for your message. Very appreciated. Indeed, the changes below
works perfectly. Thank you.
I tried to apply this script to a non-existing page, in order to create
pages automatically from another source, but I encountered some ACL issues.
Would you know how to create a page and set its ACL?
I guess you have to use the PageEditor import and the parseACL, but I have
no idea how this works since the parseACL doesn't take any argument.
Sorry if the question is too basic.
Regards,
Woody.
2008/11/11 Dylan Martin <dmartin at sccd.ctc.edu>
> The append-text.py script from the script market does not seem to work with
> MoinMoin 1.6. This patch attempts to make it work.
>
> Please note that you must edit append-text.py to add your config dir
> (where wikiconfig.py is) and the directory where the MoinMoin library
> scripts are located to sys.path. If you want to edit MoinMoin pages that
> are not world-writable, you must edit append-text.py to set the
> 'editor_email' variable.
>
> To apply this patch run "patch -p 1 < append-text.py" in the same dir
> as append-text.py.
>
> -Dylan
>
> --- old/append-text.py 2005-05-28 21:18:27.000000000 -0700
> +++ patched/append-text.py 2008-11-11 14:27:00.000000000 -0800
> @@ -44,14 +44,22 @@
> # The path to moinmoin, not needed if its installed with
> setup.py
> '/Volumes/Home/nir/Projects/moin/fix'] + sys.path
>
> +# set this to the email addr of the moin user who this script should act
> as
> +# or leave as None
> +editor_email = None
> +# editor_email = 'editor at example.com'
>
> from MoinMoin.PageEditor import PageEditor
> -from MoinMoin.request import RequestCLI
> -
> +from MoinMoin.request.request_cli import Request
> +from MoinMoin.user import get_by_email_address
>
> def append(url, pagename, text):
> - request = RequestCLI(url=url, pagename=pagename)
> + request = Request(url=url, pagename=pagename)
> editor = PageEditor(request, pagename)
> + if editor_email:
> + if not get_by_email_address(request,editor_email):
> + raise Exception, 'No MoinMoin user found with email
> address ' + editor_email
> + request.user = get_by_email_address(request,editor_email)
> text = editor.get_raw_body() + editor.normalizeText(text)
> dummy, revision, exists = editor.get_rev()
> return editor.saveText(text, revision)
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/moin-user/attachments/20081112/dd873bc8/attachment.html>
More information about the Moin-user
mailing list