[Moin-user] Macro Interface update from Moin 1.5 to 1.9

Thomas Waldmann tw-public at gmx.de
Tue Jun 15 07:32:22 EDT 2010


Moin,

> I used the old Gallery macro with Moin 1.5.3. Now i updated to Moin
> 1.9.2. 
> 
> The Gallery.py macro does not work anymore.

Maybe check if there is an updated version on MacroMarket (or an
alternative). Gallery2 or Arnica comes to my mind (but I personally
don't use that stuff).

> I tried to find the error, and the thumbnails are shown when i
> uncomment the following section. In this section the values from
> macro.forms.item() are are written to a helper structure formvals.

request is available as macro.request.

For accessing the URL args (query string), use request.args.

For accessing POST form data, use request.form.

If you want both mixed because you don't care, use request.values.

All these are werkzeug MultiDicts and if you just want to get the first
value for some key, you can use e.g. request.values.get("somekey",
"defaultvalue"). No need for [0] or ["defaultvalue"].

These changes were due to wsgi/werkzeug refactoring, you can also just
have a look into the macros we have in 1.9.x to see how they work now.

Cheers,

Thomas









More information about the Moin-user mailing list