[moin-user] ListPages macro doesn't work

Lars Kruse lists at sumpfralle.de
Sun Sep 3 19:59:47 EDT 2017


Hello Volker,


Am Mon, 04 Sep 2017 01:32:22 +0200
schrieb Volker Wysk <post at volker-wysk.de>:

> > I could imagine that the following pieces are missing for this approach:
> > 1) add "import locale" somewhere (probably at the top of the macro)
> > 2) use "locale.strcoll" instead of "str.lower" or "unicode.lower" as
> >    the "key" argument to "sort"  
> 
> I've tried it, and now I get this error:
> 
> <<ListPages: Ausführung fehlgeschlagen [strcoll expected 2 arguments, got 1] 

continuing to guess based on python's documentation (here: the "locale"
module[1]):
  .sort(key=locale.strxfrm)

Taking a closer look at locale: probably you need to call "locale.resetlocale()"
before, in order to switch to the locale defined via the environment variables.


> > I gues, this is not the "proper" way, since it uses the locale of the
> > server and not the one of the client. But it probably helps in a
> > single-locale environment.  
> 
> This makes me wonder, how modified characters like "ä" or "á", which do not 
> necessarily belong to the same locale, are treated by locale.strcoll... 

Personally I would either trust python's locale implementation or conduct some
experiments :)

Cheers,
Lars

[1] https://docs.python.org/2/library/locale.html


More information about the moin-user mailing list