[Moin-devel] Generate and Modify Pages with python
Nir Soffer
nirs at actcom.net.il
Sat Feb 19 00:24:26 EST 2005
> I just install 1.3.3 and find out that pages structure
> is more complicate then before.
> In old days, I can just place text files in directory
> and moinmoin will recognize it just like apache do.
> Now, there is a whole directory of various things.
The structure is not really more complicated, but more structured. The
old way used to put one page data in multiple directories. For example,
in the old structure it was almost impossible to remove a page, or to
get the first revision of a page.
The page structure is quite simple now:
PageName - the directory name is the page name
edit-log - the page private log of changes
current - this file contain the name of the current revision, e.g
00000001. If there is no such revision, the page is considered deleted
page.
revisions/ - the directory containing the revisions
00000001 - the first revision
attachments - the directory containing the page attachments, if
there are any attachments
cache/ - automatically created by the wiki, contain page caches
So you can see that its quite easy to add a page with a shell script:
cd /www/MyWiki/data/pages
mkdir PageName
echo 00000001 > PageName/current
mkdir PageName/revisions
echo "That was quite easy!\n" > PageName/revisions/00000001
Or to remove a page from the system - including all backups,
attachments:
rm -rf PageName
Or to rename a page:
mv PageName NewName
Try to do that with 1.2 - don't forget to rename all backups,
attachments and the logs...
Or move a page to another wiki instance:
mv WikiA/data/pages/PageName WikiB/data/pages/
> I try to follow the MoinDev/Storage and try a
> from MoinMoin.Page import Page
> page = Page("NewPage")
The wiki pages are outdated. You will have to read the code if you want
to write python. Pages and many other functions have a request object
as first argument. Its little harder now to create pages, but its not
related to the new structure. The best way is to see how this is done
in other code.
Best Regards,
Nir Soffer
More information about the Moin-devel
mailing list