(My Provider finally updated to Python 2.3.4 so i could move up to the current Version of MoinMoin. The following comments are for a lot older version 1.0 ... )


I just started looking into MoinMoin after trying some other Wikis. Mostly I got disappointed, 'cause I got the feeling that such an easy task was implemented in too much to complicated code :) But I liked MoinMoin and so I got started... This page is an unsorted collection of notes about my progress. Just to document what I did in the last 2 days and why...

First of all my hoster has just Python 2.01 installed :( I built a "new" PC from spare parts, got python 2.01 from the Python website and installed it. Then I installed MoinMoin into that and started it to compile it. The resulting *.pyc went into my directory on my webspace. I saw no need to install the source files, too.

First Problem: In utils is a helper function "getPackageModules" that scans a directory for Python modules to register them as additional Macros and/or Actions. The regular expression in that just looks for *.py files :( I got no error message or the like, but some parts of MoinMoin just did not work.

I copied the function to "moin.py", modified the regular expression a little and replaced it in the original "util.py" by

   1     from MoinMoin import util
   2     util.getPackageModules = getPackageModules

That fixes that. A correct fix would be to scan for all "*.py*"-Files and remove all duplicates.


Everyone can create and modify files as long as he knows the correct action. I wanted a simple way out of this since my Wiki was planned to be modified just by me. But there was no way to disable actions. I modified "config.py" so that "excluded_actions" now is a config-item with a default of   ['DeletePage', 'AttachFile']  and added a line to my "moin_config.py" to add 'edit' to that list. That looks like it makes it now impossible to change the pages. ( /!\ I might be wrong here)


Wikis in a way look all the same. I wanted mine to fit seamlessly into my already existing design. I expected MoinMoin to use a HTML-Template like Blogger is using it ... They seem to parse a standard HTML file looking for "<blogentry> ... </blogentry>" tags and use them (and the code and the defined variables within) to generate the page. Sample (to be seen here Blog):

        <div class="box">
            <BloggerArchives>
            <a href='<$BlogArchiveLink$>'><$BlogArchiveName$></a>
            </BloggerArchives>
        </div>

I didn't found anything like that ...

So instead I picked "send_title" and "send_footer" from "wikiutil", created replacement function in my "moin.py" and did set them accordingly ...

   1     from MoinMoin import wikiutil
   2     wikiutil.send_footer   = send_footer
   3     wikiutil.send_title    = send_title

Now my Wiki looks in a way like my pages ... :)


If you have seen my design you may have noted a kind of Main-Menu on the left. If I create that menu like the original "send_title" that is a big mess. And the menu is not editable from the net. So I created a page called MainMenu and used the following code

   1     print """<div class="box">"""
   2 
   3     from MoinMoin import Page
   4 
   5     page = Page.Page("MainMenu")
   6     request = cgimain.createRequest();
   7     import cgi
   8     request.form = cgi.FieldStorage(environ = {'QUERY_STRING': 'action=content'})
   9     page.send_page(request, content_only=1)
  10 
  11     print """</div>"""

to get the content of the page. That even looks complicated to me. But I found no easier way to just translate a page to its contents (yet). It would be nice if I could do something like (just a sample).

    InsertHere("[wiki:Self:FrontPage Home][[Include(MainMenu)]]")

And one annoyance is that in my solution there is a "<p>" in front of the content that I can't get rid of.


I tried to do the same to create myself a Edit-Menu. But that is impossible since there is no way to create links that reference to the (what I call it) main page. It would be nice if there is a special pagename "this" that allows references to the current displayed page  [wiki:Self:this Edit me]  .

But this only makes sense if we can add parameters to the link. But that could be useful anyway. Think of something like  [wiki:MoinMoin:Bugs?action=edit&template=BugNote Enter Bug]  . If you try to do that now it creates a Page with the literal name  Bugs?action=edit&template=BugNote  .

That should be two simple changes ...


Well, one slightly annoying bug is hidden somewhere in the handling of subpages. When i use a new subpage in a link the generated hyperlink contains the slash ...

    [wiki:Self:ThomasFanslau/picture]

if you click on ThomasFanslau/picture the generated template-selection-page is on  ..../ThomasFanslau/picture . Only when you selected the template the WikiName is converted to "ThomasFanslau_2fpicture" .

The problem is, that if your template-selection-page contains any relative links in HTML, that those may not be found anymore.

if seems that browser take the line

    http://twistedmatrix.com/users/jh.twistd/moin/moin.cgi/ThomasFanslau/picture

literally when they calculate relative paths, instead of noticing that processing of the path already had stopped at the CGI-Script ...

But I don't know where to fix that...


I wanted to build in some kind of Blog. It seems that everyone wants that :) Subpages seems to be a nice place to handle that. So I replaced the function "quoteFilename" with one that checks the LAST letter of the name. if that is a "*" then I remove the letter and add a timestamp instead. So if I write

    [wiki:Self:ThomasFanslau/*]

the new generated Page is different and new every time. In combination with the PageList-Macro I can get a list of subpages ...

All I need now is a new Macro InsertTeaser, that does include a Page just up to the end of the first paragraph. And another one InsertTeasers that takes a pattern as WikiName and a additional parameter for the maximum number of pages to be include my blog.


I added some comments above. Welcome to MoinMoin! -- ThomasWaldmann 2003-08-28 23:25:04


(Changing Source is like scratching a itch. Once you started it's hard to stop....) All the time I had wondered if there is a way to render a Page without storing it in a File first. I found a simple way around that. Assuming that I did put the virtual Page into the Variable "ret" I can do as follows

   1     page = Page.Page("Title")
   2     page.raw_body = ret
   3     stdout = sys.stdout
   4     sys.stdout = cStringIO.StringIO()
   5     page.send_page(request, content_only=1)
   6     ret = sys.stdout.getvalue()
   7     sys.stdout = stdout

(I just have to get that "request"-variable from somewhere ... A

   1     request = cgimain.createRequest();
   2     request.form = cgi.FieldStorage(environ = {'QUERY_STRING': 'action=content'})

should be enough.)

All the Time I disliked the way  [[SystemInfo]  displayed the Info. Embedding HTML directly into Source without need is "A Bad Thing" (TM). So how about using the Syntax of Definitionlists? Here is SystemInfo2 to show how I think that could be done better. It's a rough sketch but it shows what I want to say ...


MoinMoin: ThomasFanslau/0.x (last edited 2007-10-29 19:14:24 by localhost)