[moin-user] Form input for MoinMoin 1.9?

Paul Boddie paul at boddie.org.uk
Fri Apr 12 06:43:51 EDT 2019

On Thursday 11. April 2019 18.22.32 M. Scott Reynolds wrote:
> Is there a way for MoinMoin 1.9 to be configuered to accept form input, via
> GET, POST, or PUT requests and save it to something like a log file?

Yes, since Moin can understand request parameters in order to interpret the 
query parameters in URLs or the values of form fields, it will be able to 
accept such requests. Typically, you would use an action to handle them, and 
there are a few in MoinMoin/action that might be informative.

> I have an air quality sensor that I can configure to post weather data to a
> custom URL and I would love to be able to use my internal wiki at home to
> save the data.
> I know the sensor can reach the wiki as can see the wiki logging 404s in
> response to whatever the sensor is sending.
> I am ok with Python so if that is necessary I can do it.

I recommend starting off with a simple action, taking something like the 
bookmark action as an example. You will provide an execute function...

def execute(pagename, request):

...and the request parameters will be provided via request.values as a 
mapping. The more difficult part will involve writing the information 
somewhere meaningful.

If you just want to write to an arbitrary file, you can use normal Python 
functions to do that, although it might be interesting to write to a location 
within the wiki/data hierarchy. The MoinMoin.action.AttachFile module provides 
an interface to attachments, which could be one solution.

You can also edit pages within actions and thus log things to pages. This will 
involve the MoinMoin.PageEditor.PageEditor class whose API is demonstrated by 
various actions.

Finally, Moin tends to block "robots" making requests. This may not be a 
problem for you since you probably won't set a user agent string that matches 
one of the known robots, but it is worth remembering in case Moin rejects 


More information about the moin-user mailing list