[Moin-user] Import text file in MoinMoin
Olivier Lauret
olivier.lauret at googlemail.com
Wed Nov 19 17:15:25 EST 2008
Hello,
A few days ago, I open a thread asking how to import the content of a text
file into a MoinMoin page. I had some answers which really helped me a lot.
Here is the quick summary of the script that I used:
******************
import sys
sys.path.insert(0, '/usr/local/lib/python2.5/site-packages')
sys.path.insert(0, '/opt/mywiki/')
sys.path.insert(0, '/usr/local/lib/python2.5/site-packages/MoinMoin')
import urllib, sgmllib, re
from MoinMoin.request.request_cli import Request
from MoinMoin.user import get_by_email_address
from MoinMoin.PageEditor import PageEditor
from xml.dom import minidom as dom
pagen = 'testpage3'
textContent = "This is a automated test page."
emailad = "olivier.lauret at googlemail.com"
request = Request(url = 'localhost/mywiki', pagename = pagen)
p = PageEditor(request, pagen)
try:
p.saveText(textContent, 0)
except PageEditor.SaveError, e:
print "Got %r" % (e, )
**********************
However, when I run this script, the page was created but instead of seeing
the page, I was getting the following error inteh browser:
IOError: [Errno 13] Permission denied:
'/opt/mywiki/data/pages/testpage3/revisions/99999999'
I found out why I had this error: I was running the script under root (cmd:
"python myscript.py") and it was creating some files into MoinMoin havingn
root as the owner. Therefore, the browser which was using the apache user
couldn't have access to it.
Solution: run the script under the apache user (cmd: sudo -u apache python
myscript.py). You might need to replace apache by the user used by your
httpd server such as www-data.
Thank you Dylan and Reimar.
Regards,
Olivier
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/moin-user/attachments/20081119/ac8d8e00/attachment.html>
More information about the Moin-user
mailing list