From post at volker-wysk.de Sat Sep 2 14:18:14 2017 From: post at volker-wysk.de (Volker Wysk) Date: Sat, 02 Sep 2017 20:18:14 +0200 Subject: [moin-user] ListPages macro doesn't work Message-ID: <2038210.3E9ZtmT8BX@desktop> Hi! I'm playing with moinmoin, and have tried the ListPages macro, which I have downloaded from the macro market. It's quite old (2011), but it is in the list of macros for moinmoin 1.9. I've copied the example to a wiki page: <> This results in an error: <> English translation: "execution failed [unnamed arguments can't follow named arguments] (also see the log file)" In the apache log file (error.log) there is no additional information. To me, this looks like ListPages is broken. I know hardly any python, but the message (about named and unnamed arguments) doesn't seem true to me. I've also played with the macro invocation a little, but this didn't reveal anything. Should I contact Reimar Bauer, the author of ListPages? How? (His wiki page on moinmo.in doesn't look functional) Happy hacking, Volker From lists at sumpfralle.de Sun Sep 3 05:44:59 2017 From: lists at sumpfralle.de (Lars Kruse) Date: Sun, 3 Sep 2017 11:44:59 +0200 Subject: [moin-user] ListPages macro doesn't work In-Reply-To: <2038210.3E9ZtmT8BX@desktop> References: <2038210.3E9ZtmT8BX@desktop> Message-ID: <20170903114459.56859e75@erker.lan> Hello Volker, Am Sat, 02 Sep 2017 20:18:14 +0200 schrieb Volker Wysk : > I've copied the example to a wiki page: > < "content"), link=("pagename", "subpage"), reverse=False)>> indeed this looks like an example, but it is only a syntax description. The real example follows just below on the plugin documentation page: https://moinmo.in/MacroMarket/ListPages Your error message was misleading, since the macro parser does not seem to handle brackets in an intuitive way. Cheers, Lars From post at volker-wysk.de Sun Sep 3 07:26:37 2017 From: post at volker-wysk.de (Volker Wysk) Date: Sun, 03 Sep 2017 13:26:37 +0200 Subject: [moin-user] ListPages macro doesn't work In-Reply-To: <20170903114459.56859e75@erker.lan> References: <2038210.3E9ZtmT8BX@desktop> <20170903114459.56859e75@erker.lan> Message-ID: <300892253.xMsc8Uqea7@desktop> Am Sonntag, 3. September 2017, 11:44:59 CEST schrieb Lars Kruse: > Hello Volker, > > > Am Sat, 02 Sep 2017 20:18:14 +0200 > > schrieb Volker Wysk : > > I've copied the example to a wiki page: > > < > "content"), link=("pagename", "subpage"), reverse=False)>> > > indeed this looks like an example, but it is only a syntax description. > The real example follows just below on the plugin documentation page: > https://moinmo.in/MacroMarket/ListPages > > Your error message was misleading, since the macro parser does not seem > to handle brackets in an intuitive way. Thanks. I've figured it out. BUT: It's broken nonetheless. The search order doesn't treat German umlauts adequately. They all go to the top. And it treats upper/lower case specially. First all the page titles beginning with upper case letters appear, then at the bottom the lower case ones appear. I'm wondering how this could pass unnoticed, before publishing ListPages in the macro market. Cheers Volker From kauer at biplane.com.au Sun Sep 3 08:14:50 2017 From: kauer at biplane.com.au (Karl Auer) Date: Sun, 03 Sep 2017 22:14:50 +1000 Subject: [moin-user] ListPages macro doesn't work In-Reply-To: <300892253.xMsc8Uqea7@desktop> References: <2038210.3E9ZtmT8BX@desktop> <20170903114459.56859e75@erker.lan> <300892253.xMsc8Uqea7@desktop> Message-ID: <1504440890.2463.30.camel@biplane.com.au> On Sun, 2017-09-03 at 13:26 +0200, Volker Wysk wrote: > BUT: It's broken nonetheless. The search order doesn't treat German > umlauts?adequately. They all go to the top. And it treats upper/lower > case specially.?First all the page titles beginning with upper case > letters appear, then at?the bottom the lower case ones appear. I know nothing about this macro, but is it possible that the macro is locale-aware, and the locale is not properly set on your system? See: https://www.thomas-krenn.com/de/wiki/Locales_unter_Ubuntu_konfigurieren ... for ideas. But as I said, I know nothing about this. Regards, K. -- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Karl Auer (kauer at biplane.com.au) http://www.biplane.com.au/kauer http://twitter.com/kauer389 GPG fingerprint: A52E F6B9 708B 51C4 85E6?1634 0571 ADF9 3C1C 6A3A Old fingerprint: E00D 64ED 9C6A 8605 21E0 0ED0 EE64 2BEE CBCB C38B From lists at sumpfralle.de Sun Sep 3 08:33:45 2017 From: lists at sumpfralle.de (Lars Kruse) Date: Sun, 3 Sep 2017 14:33:45 +0200 Subject: [moin-user] ListPages macro doesn't work In-Reply-To: <300892253.xMsc8Uqea7@desktop> References: <2038210.3E9ZtmT8BX@desktop> <20170903114459.56859e75@erker.lan> <300892253.xMsc8Uqea7@desktop> Message-ID: <20170903143345.337ac131@erker.lan> Hello Volker, Am Sun, 03 Sep 2017 13:26:37 +0200 schrieb Volker Wysk : > Thanks. I've figured it out. good! (It is always a nice habit to answer your own question, in order to save the time of other people willing to help you solving your issue.) > BUT: It's broken nonetheless. The search order doesn't treat German > umlauts adequately. They all go to the top. And it treats upper/lower case > specially. > First all the page titles beginning with upper case letters appear, > then at the bottom the lower case ones appear. "broken" is quite a heavy word. Maybe you meant "not suitable for my purpose"? Regarding the locale-aware sorting: this should probably depend on the configured locale of the user requesting the page. I am not sure, if this information is available in the context of a macro exection. Anyone knows better? upper/lower case: you seem to expect a case-insensitive sort order. This can be accomplished by changing both "sort" calls from ".sort()" to ".sort(key=str.lower)". Please upload this changed version of the macro, if you think that this is a reasonable expectation for most users of this macro. > I'm wondering how this could pass unnoticed, before publishing ListPages in > the macro market. The macro market is organized like a wiki: contributors are free to improve and upload useful code without a formal review procedure. Cheers, Lars From post at volker-wysk.de Sun Sep 3 14:24:57 2017 From: post at volker-wysk.de (Volker Wysk) Date: Sun, 03 Sep 2017 20:24:57 +0200 Subject: [moin-user] ListPages macro doesn't work In-Reply-To: <1504440890.2463.30.camel@biplane.com.au> References: <2038210.3E9ZtmT8BX@desktop> <300892253.xMsc8Uqea7@desktop> <1504440890.2463.30.camel@biplane.com.au> Message-ID: <2164128.Zjfa6g8oeR@desktop> Am Sonntag, 3. September 2017, 22:14:50 CEST schrieb Karl Auer: > I know nothing about this macro, but is it possible that the macro is > locale-aware, and the locale is not properly set on your system? See: > > https://www.thomas-krenn.com/de/wiki/Locales_unter_Ubuntu_konfigurieren > > ... for ideas. That's a good thought. I've checked, and found this in /etc/apache2/envvars: ## The locale used by some modules like mod_dav export LANG=C ## Uncomment the following line to use the system default locale instead: #. /etc/default/locale I've done as suggested, and uncommented the fourth line, but with no effect on the ListPages macro. Bye Volker From post at volker-wysk.de Sun Sep 3 14:50:27 2017 From: post at volker-wysk.de (Volker Wysk) Date: Sun, 03 Sep 2017 20:50:27 +0200 Subject: [moin-user] ListPages macro doesn't work In-Reply-To: <20170903143345.337ac131@erker.lan> References: <2038210.3E9ZtmT8BX@desktop> <300892253.xMsc8Uqea7@desktop> <20170903143345.337ac131@erker.lan> Message-ID: <9232388.zdyXFC35Zo@desktop> Am Sonntag, 3. September 2017, 14:33:45 CEST schrieb Lars Kruse: > > BUT: It's broken nonetheless. The search order doesn't treat German > > umlauts adequately. They all go to the top. And it treats upper/lower case > > specially. > > First all the page titles beginning with upper case letters appear, > > then at the bottom the lower case ones appear. > > "broken" is quite a heavy word. > Maybe you meant "not suitable for my purpose"? I've investigated a little about sorting order, and found the following. There are quite a few possibilities: https://de.wikipedia.org/wiki/Alphabetische_Sortierung#Deutsche_Sprache I was expecting something like the ordering described in RFC5051, which I know from a Haskell-library. (here: http://hackage.haskell.org/package/rfc5051) > Regarding the locale-aware sorting: this should probably depend on the > configured locale of the user requesting the page. True... > I am not sure, if > this information is available in the context of a macro exection. > Anyone knows better? > upper/lower case: you seem to expect a case-insensitive sort order. Yes. > This can be accomplished by changing both "sort" calls from ".sort()" to > ".sort(key=str.lower)". I've tried this, but it doesn't quite work. I get: <> ("Ausf?hrung fehlgeschlagen" means "execution failed") > Please upload this changed version of the macro, if you think that this is a > reasonable expectation for most users of this macro. Yes, I think it is. > > > I'm wondering how this could pass unnoticed, before publishing ListPages > > in > > the macro market. > > The macro market is organized like a wiki: contributors are free to improve > and upload useful code without a formal review procedure. To me, it looked like there is no alphabetical sorting at all, but just sorting by the unicode codes as numbers. Bye Volker From lists at sumpfralle.de Sun Sep 3 16:05:27 2017 From: lists at sumpfralle.de (Lars Kruse) Date: Sun, 3 Sep 2017 22:05:27 +0200 Subject: [moin-user] ListPages macro doesn't work In-Reply-To: <9232388.zdyXFC35Zo@desktop> References: <2038210.3E9ZtmT8BX@desktop> <300892253.xMsc8Uqea7@desktop> <20170903143345.337ac131@erker.lan> <9232388.zdyXFC35Zo@desktop> Message-ID: <20170903220527.688f0fe6@erker.lan> Hallo Volker, Am Sun, 03 Sep 2017 20:50:27 +0200 schrieb Volker Wysk : > Am Sonntag, 3. September 2017, 14:33:45 CEST schrieb Lars Kruse: > [...] > > > > "broken" is quite a heavy word. > > Maybe you meant "not suitable for my purpose"? > > I've investigated a little about sorting order, [..] yes, I understand. I just wanted to point out, that the description of the ListPages plugin does not refer to any sort order at all. Thus it felt a bit unfair to me to call it "broken". > > This can be accomplished by changing both "sort" calls from ".sort()" to > > ".sort(key=str.lower)". > > I've tried this, but it doesn't quite work. I get: > > < object but received a 'unicode'] (siehe auch die Log-Datei)>> > > ("Ausf?hrung fehlgeschlagen" means "execution failed") Python2! :) Yes, it should be "unicode.lower" instead of "str.lower". Cheers, Lars From lists at sumpfralle.de Sun Sep 3 16:09:11 2017 From: lists at sumpfralle.de (Lars Kruse) Date: Sun, 3 Sep 2017 22:09:11 +0200 Subject: [moin-user] ListPages macro doesn't work In-Reply-To: <2164128.Zjfa6g8oeR@desktop> References: <2038210.3E9ZtmT8BX@desktop> <300892253.xMsc8Uqea7@desktop> <1504440890.2463.30.camel@biplane.com.au> <2164128.Zjfa6g8oeR@desktop> Message-ID: <20170903220911.78d209bc@erker.lan> Hello, Am Sun, 03 Sep 2017 20:24:57 +0200 schrieb Volker Wysk : > ## The locale used by some modules like mod_dav > export LANG=C > ## Uncomment the following line to use the system default locale instead: > #. /etc/default/locale > > I've done as suggested, and uncommented the fourth line, but with no effect > on the ListPages macro. 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 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. Cheers, Lars From post at volker-wysk.de Sun Sep 3 19:32:22 2017 From: post at volker-wysk.de (Volker Wysk) Date: Mon, 04 Sep 2017 01:32:22 +0200 Subject: [moin-user] ListPages macro doesn't work In-Reply-To: <20170903220911.78d209bc@erker.lan> References: <2038210.3E9ZtmT8BX@desktop> <2164128.Zjfa6g8oeR@desktop> <20170903220911.78d209bc@erker.lan> Message-ID: <1618528.4jBGmGGMna@desktop> Am Sonntag, 3. September 2017, 22:09:11 CEST schrieb Lars Kruse: > Hello, > > > Am Sun, 03 Sep 2017 20:24:57 +0200 > > schrieb Volker Wysk : > > ## The locale used by some modules like mod_dav > > export LANG=C > > ## Uncomment the following line to use the system default locale instead: > > #. /etc/default/locale > > > > I've done as suggested, and uncommented the fourth line, but with no > > effect > > on the ListPages macro. > > 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: <> (again, "execution failed...") > 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... Bye Volker From post at volker-wysk.de Sun Sep 3 19:38:16 2017 From: post at volker-wysk.de (Volker Wysk) Date: Mon, 04 Sep 2017 01:38:16 +0200 Subject: [moin-user] ListPages macro doesn't work In-Reply-To: <20170903220527.688f0fe6@erker.lan> References: <2038210.3E9ZtmT8BX@desktop> <9232388.zdyXFC35Zo@desktop> <20170903220527.688f0fe6@erker.lan> Message-ID: <6093563.k5QHSzdeti@desktop> Am Sonntag, 3. September 2017, 22:05:27 CEST schrieb Lars Kruse: > Hallo Volker, > > > Am Sun, 03 Sep 2017 20:50:27 +0200 > > schrieb Volker Wysk : > > Am Sonntag, 3. September 2017, 14:33:45 CEST schrieb Lars Kruse: > > [...] > > > > > "broken" is quite a heavy word. > > > Maybe you meant "not suitable for my purpose"? > > > > I've investigated a little about sorting order, [..] > > yes, I understand. > I just wanted to point out, that the description of the ListPages plugin > does not refer to any sort order at all. Thus it felt a bit unfair to me to > call it "broken". Well, okay. But it must be _some_ order... Bye V.W. From lists at sumpfralle.de Sun Sep 3 19:59:47 2017 From: lists at sumpfralle.de (Lars Kruse) Date: Mon, 4 Sep 2017 01:59:47 +0200 Subject: [moin-user] ListPages macro doesn't work In-Reply-To: <1618528.4jBGmGGMna@desktop> References: <2038210.3E9ZtmT8BX@desktop> <2164128.Zjfa6g8oeR@desktop> <20170903220911.78d209bc@erker.lan> <1618528.4jBGmGGMna@desktop> Message-ID: <20170904015947.60890e09@erker.lan> Hello Volker, Am Mon, 04 Sep 2017 01:32:22 +0200 schrieb Volker Wysk : > > 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: > > < > 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 From pete.bleackley at btinternet.com Mon Sep 4 02:51:35 2017 From: pete.bleackley at btinternet.com (PETER BLEACKLEY) Date: Mon, 4 Sep 2017 07:51:35 +0100 (BST) Subject: [moin-user] Uploading pages programmatically fails Message-ID: <3132121.2386.1504507895385.JavaMail.defaultUser@defaultHost> I'm trying to transcribe a podcast to my MoinMoin instance. The code I use to upload the transcribed text is a follows. def upload(item,transcript): """Gets transcrpt from sphinx, and uploads to MoinMoin""" link_url=None for link in item.links: if link['rel']=='alternate': link_url=link['href'] print 'Reading',item['title'],'transcript from Sphinx' try: username='TranscriBot' password=os.environ['CSW_PASSWORD'] wikiurl=u'http://sources.conlang.org' wiki=xmlrpclib.ServerProxy(wikiurl+'?action=xmlrpc2',allow_none=True) auth_token=wiki.getAuthToken(username,password) mc=xmlrpclib.MultiCall(wiki) mc.applyAuthToken(auth_token) page=u"""#format creole = {{title}} ==[[{url}|{title}]]\n Published: {date} \\ \n ===Transcript\n {transcript}\n ===Tags\n {taglist}""".format(title=item['title'], url=link_url, date=item['published'], transcript=transcript.read(), taglist=u'\n'.join([u' # [[Conlangery Podcast]]']+[u' # [[{}]]'.format(tag['term']) for tag in item['tags']])) title=item['title'].replace('#','').replace(':','') mc.putPage(u'Conlangery Podcast/{}'.format(title),page) infile=codecs.open('Conlangery_Podcast.txt','r','utf-8') index=infile.read()+' # [[Conlangery Podcast/{}]]\n'.format(title) mc.putPage('Conlangery Podcast',index) with codecs.open('Conlangery_Podcast.txt','w','utf-8') as ofile: ofile.write(index) for result in mc(): print result except Exception as error: with open('TranscriBot_Error.log','a') as logfile: logfile.write(error.message+'\n') TranscriBot has all the neccessary permissions, and is in a TrustedGroup that is exempt from my TextCha. However, no pages have been written to my wiki. Nothing is printed out when mc() is called, and nothing is written to TranscriBot_Error.log either (unless it's a lot of blank lines). Any idea what's wrong and how I can fix it? Pete -------------- next part -------------- An HTML attachment was scrubbed... URL: From post at volker-wysk.de Mon Sep 4 03:22:01 2017 From: post at volker-wysk.de (Volker Wysk) Date: Mon, 04 Sep 2017 09:22:01 +0200 Subject: [moin-user] ListPages macro doesn't work In-Reply-To: <20170904015947.60890e09@erker.lan> References: <2038210.3E9ZtmT8BX@desktop> <1618528.4jBGmGGMna@desktop> <20170904015947.60890e09@erker.lan> Message-ID: <1536193.mbRVp6pIFu@desktop> Am Montag, 4. September 2017, 01:59:47 CEST schrieb Lars Kruse: > 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. Okay, tried it. Now I get: <> ("your search query "Artikel/.*" is invalid. See HelpOnSearch for more information.") This doesn't seem to make much sense. :-( My macro invocation is this: <> > > > 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 :) I mean, could one locale be fitting for a different one too, as far as sorting is concerned? Tsch?? Volker From lists at sumpfralle.de Mon Sep 4 05:27:42 2017 From: lists at sumpfralle.de (Lars Kruse) Date: Mon, 4 Sep 2017 11:27:42 +0200 Subject: [moin-user] ListPages macro doesn't work In-Reply-To: <1536193.mbRVp6pIFu@desktop> References: <2038210.3E9ZtmT8BX@desktop> <1618528.4jBGmGGMna@desktop> <20170904015947.60890e09@erker.lan> <1536193.mbRVp6pIFu@desktop> Message-ID: <20170904112742.71b254c1@erker.lan> Hello Volker, Am Mon, 04 Sep 2017 09:22:01 +0200 schrieb Volker Wysk : > > 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. > > Okay, tried it. Now I get: > > < f?r weitere Informationen.)>> is this new error message related to the "resetlocale" change above? Did you try to minimize and vary the ListPage call? (fewer paramters, shorter query, ...) > > Personally I would either trust python's locale implementation or conduct > > some experiments :) > > I mean, could one locale be fitting for a different one too, as far as > sorting is concerned? As far as I understand locales: no. (if someone knows better: please correct me) Cheers, Lars From lists at sumpfralle.de Mon Sep 4 05:32:56 2017 From: lists at sumpfralle.de (Lars Kruse) Date: Mon, 4 Sep 2017 11:32:56 +0200 Subject: [moin-user] Uploading pages programmatically fails In-Reply-To: <3132121.2386.1504507895385.JavaMail.defaultUser@defaultHost> References: <3132121.2386.1504507895385.JavaMail.defaultUser@defaultHost> Message-ID: <20170904113256.55d5cafc@erker.lan> Hello Peter, Am Mon, 4 Sep 2017 07:51:35 +0100 (BST) schrieb PETER BLEACKLEY : > [..] > TranscriBot has all the neccessary permissions, and is in a TrustedGroup that > is exempt from my TextCha. However, no pages have been written to my wiki. > Nothing is printed out when mc() is called, and nothing is written to > TranscriBot_Error.log either (unless it's a lot of blank lines). Any idea > what's wrong and how I can fix it? Are you sure, that the file locations match your expectations? (or maybe use absolute paths) You surely checked the error log of your webserver? If you use a single-process web (or application) server: did you try to attach "strace" to the running process? (you could share its log with us) Cheers, Lars From paul at boddie.org.uk Mon Sep 4 06:47:44 2017 From: paul at boddie.org.uk (Paul Boddie) Date: Mon, 4 Sep 2017 12:47:44 +0200 Subject: [moin-user] ListPages macro doesn't work In-Reply-To: <20170904112742.71b254c1@erker.lan> References: <2038210.3E9ZtmT8BX@desktop> <1536193.mbRVp6pIFu@desktop> <20170904112742.71b254c1@erker.lan> Message-ID: <201709041247.45195.paul@boddie.org.uk> On Monday 4. September 2017 11.27.42 Lars Kruse wrote: > > Am Mon, 04 Sep 2017 09:22:01 +0200 schrieb Volker Wysk : > > > > I mean, could one locale be fitting for a different one too, as far as > > sorting is concerned? > > As far as I understand locales: no. > (if someone knows better: please correct me) I'm not sure whether I really understand locales better, but here are a few things that might help. Firstly, you can get the default locale as follows: import locale locale.setlocale(locale.LC_ALL, "") # returns the locale string This has to be done to make the process's locale information available. It is possible that something does this already in Moin, but as mentioned before, it is questionable that the process's locale is relevant for a user of a Web application. Now you can get the locale details more conveniently. For example, to ask for the collation: language, charset = locale.getlocale(locale.LC_COLLATE) I would think that the collation is the most pertinent locale setting when it comes to sorting things. So, it might be more interesting to set this based on any details about the user provided by Moin. The MoinMoin.user.User object has a language attribute that could work in principle, but I'm not convinced that this is enough by itself. More on that in a moment. Anyway, you can set the collation as follows: locale.setlocale(locale.LC_COLLATE, "no_NO") # something I just tested And you can apply the locale sorting as follows: names.sort(cmp=locale.strcoll) This will correctly sort a sequence of names where Norwegian letters are used. It seems that Unicode will work, too. Why I don't think the Moin language code is enough is that the locale system is rather particular about what you ask it for. However, it seems that you can get a proper locale from the Moin language as follows: language = request.user.language # will probably work given a request localename = locale.normalize(language) For me, this yielded "no_NO.ISO8859-1" from "no". A few problems emerge when using locale support for sorting. Firstly, you need to have the necessary locales installed for the functions to work. Secondly, switching locales affects the entire program, so you have to be careful not to cause side-effects, although this is less of a problem in a plain CGI environment. Another thing noted earlier is that locales are language specific, so if your list of page names contains both German names and names using non-German characters, the sorting of those other characters may not be as desired. Libraries like ICU might try and reconcile different collations, but it is probably an open-ended problem. Bindings for Python are available here: https://pypi.python.org/pypi/PyICU/ The documentation for the locale functionality is found here: https://docs.python.org/2.7/library/locale.html Paul From post at volker-wysk.de Mon Sep 4 09:51:32 2017 From: post at volker-wysk.de (Volker Wysk) Date: Mon, 04 Sep 2017 15:51:32 +0200 Subject: [moin-user] ListPages macro doesn't work In-Reply-To: <20170904112742.71b254c1@erker.lan> References: <2038210.3E9ZtmT8BX@desktop> <1536193.mbRVp6pIFu@desktop> <20170904112742.71b254c1@erker.lan> Message-ID: <7133032.qGaHQ3dk2B@desktop> Am Montag, 4. September 2017, 11:27:42 CEST schrieb Lars Kruse: > Hello Volker, > > > Am Mon, 04 Sep 2017 09:22:01 +0200 > > schrieb Volker Wysk : > > > 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. > > > > Okay, tried it. Now I get: > > > > < > HilfeZumSuchen > > f?r weitere Informationen.)>> > > is this new error message related to the "resetlocale" change above? No, it doesn't matter if locale.resetlocale() is called. > Did you try to minimize and vary the ListPage call? (fewer paramters, > shorter query, ...) I've tried around a bit. The new error seems to be brought by the "key=locale.strxfrm" argument of the .sort(...) invocations. Bye V. From post at volker-wysk.de Tue Sep 5 02:03:36 2017 From: post at volker-wysk.de (Volker Wysk) Date: Tue, 05 Sep 2017 08:03:36 +0200 Subject: [moin-user] ListPages macro doesn't work In-Reply-To: <201709041247.45195.paul@boddie.org.uk> References: <2038210.3E9ZtmT8BX@desktop> <20170904112742.71b254c1@erker.lan> <201709041247.45195.paul@boddie.org.uk> Message-ID: <17100173.UIVYVg0vNU@desktop> Thanks for your detailed message! I've made a little test data. When I do "locale.setlocale(locale.LC_ALL, "")" and ".sort(cmp=locale.strcoll)" at the beginning of the macro, I get this: ?bb Aaaa Bbbb Ciao Vbbb c't The umlaut is at the beginning, and capital letters come first. With "locale.setlocale(locale.LC_COLLATE, "de_DE.UTF-8")" and ".sort(cmp=locale.strcoll)", I get: Aaaa Bbbb c't ?bb Ciao Vbbb The "?" gets sorted betwenn the two "c"/"C"! It's weird. Am Montag, 4. September 2017, 12:47:44 CEST schrieb Paul Boddie: > I'm not sure whether I really understand locales better, but here are a few > things that might help. Firstly, you can get the default locale as follows: > > import locale > locale.setlocale(locale.LC_ALL, "") # returns the locale string > > This has to be done to make the process's locale information available. It > is possible that something does this already in Moin, but as mentioned > before, it is questionable that the process's locale is relevant for a user > of a Web application. Now you can get the locale details more conveniently. > > For example, to ask for the collation: > > language, charset = locale.getlocale(locale.LC_COLLATE) > > I would think that the collation is the most pertinent locale setting when > it comes to sorting things. So, it might be more interesting to set this > based on any details about the user provided by Moin. The > MoinMoin.user.User object has a language attribute that could work in > principle, but I'm not convinced that this is enough by itself. More on > that in a moment. > > Anyway, you can set the collation as follows: > > locale.setlocale(locale.LC_COLLATE, "no_NO") # something I just tested > > And you can apply the locale sorting as follows: > > names.sort(cmp=locale.strcoll) That's what I've done: locale.setlocale(locale.LC_COLLATE, "de_DE.UTF-8") The "de_DE.UTF-8" part seems to be necessary. > > This will correctly sort a sequence of names where Norwegian letters are > used. It seems that Unicode will work, too. > > Why I don't think the Moin language code is enough is that the locale system > is rather particular about what you ask it for. However, it seems that you > can get a proper locale from the Moin language as follows: > > language = request.user.language # will probably work given a request > localename = locale.normalize(language) > > For me, this yielded "no_NO.ISO8859-1" from "no". How would I try this? I don't know (hardly) any python. > A few problems emerge when using locale support for sorting. Firstly, you > need to have the necessary locales installed for the functions to work. System-wide (Not just python)? I have that. (My LANG variable is "de_DE.UTF-8".) > Secondly, switching locales affects the entire program, so you have to be > careful not to cause side-effects, although this is less of a problem in a > plain CGI environment. > > Another thing noted earlier is that locales are language specific, so if > your list of page names contains both German names and names using > non-German characters, the sorting of those other characters may not be as > desired. Libraries like ICU might try and reconcile different collations, > but it is probably an open-ended problem. Bindings for Python are available > here: > > https://pypi.python.org/pypi/PyICU/ > > The documentation for the locale functionality is found here: > > https://docs.python.org/2.7/library/locale.html All this seems to be very complicated. I think I'll only do the ordering which ignores case. It's not that important to me. However, thany you very much for your time. Bye Volker From post at volker-wysk.de Sun Sep 10 13:09:54 2017 From: post at volker-wysk.de (Volker Wysk) Date: Sun, 10 Sep 2017 19:09:54 +0200 Subject: [moin-user] Can't create an account on moinmo.in Message-ID: <2105858.6dFclOoqqW@desktop> Hi! When I try to create a new account on moinmo.in, then there is a mandatory field named "TextCha (notwendig)" ("notwendig" means "necessary"). To the right, there appears "Das Edit-Password eingeben" ("Enter the edit password"), and a text field. I have no clue, what "Enter the edit password" means. When I click on "Profil anlegen" ("create profile"), I get "TextCha: Falsche Antwort! Gehen Sie zur?ck und probieren Sie es nochmal..." ("TextChar: wrong answer, please to back and try again"). Volker From paul at boddie.org.uk Sun Sep 10 16:25:47 2017 From: paul at boddie.org.uk (Paul Boddie) Date: Sun, 10 Sep 2017 22:25:47 +0200 Subject: [moin-user] Can't create an account on moinmo.in In-Reply-To: <2105858.6dFclOoqqW@desktop> References: <2105858.6dFclOoqqW@desktop> Message-ID: <201709102225.47681.paul@boddie.org.uk> On Sunday 10. September 2017 19.09.54 Volker Wysk wrote: > > When I try to create a new account on moinmo.in, then there is a mandatory > field named "TextCha (notwendig)" ("notwendig" means "necessary"). To the > right, there appears "Das Edit-Password eingeben" ("Enter the edit > password"), and a text field. > > I have no clue, what "Enter the edit password" means. When I click on > "Profil anlegen" ("create profile"), I get "TextCha: Falsche Antwort! > Gehen Sie zur?ck und probieren Sie es nochmal..." ("TextChar: wrong > answer, please to back and try again"). I imagine that one of the administrators must have introduced a more restrictive regime whereby a specific "password" must be given to pass the test. Unfortunately, I don't know who it would be that might be giving out this password, and I'm not an administrator, either. Paul P.S. Such a regime has become the accepted way of providing access to Moin wikis in recent years. Although it is fairly primitive, it does seem to achieve what might be done in a more sophisticated way by establishing trust relationships between existing account holders and people who appear to be trustworthy members of the community. From post at volker-wysk.de Mon Sep 11 03:26:22 2017 From: post at volker-wysk.de (Volker Wysk) Date: Mon, 11 Sep 2017 09:26:22 +0200 Subject: [moin-user] Can't create an account on moinmo.in In-Reply-To: <201709102225.47681.paul@boddie.org.uk> References: <2105858.6dFclOoqqW@desktop> <201709102225.47681.paul@boddie.org.uk> Message-ID: <2237873.EZE8utMcRv@desktop> Am Sonntag, 10. September 2017, 22:25:47 CEST schrieb Paul Boddie: > On Sunday 10. September 2017 19.09.54 Volker Wysk wrote: > > When I try to create a new account on moinmo.in, then there is a mandatory > > field named "TextCha (notwendig)" ("notwendig" means "necessary"). To the > > right, there appears "Das Edit-Password eingeben" ("Enter the edit > > password"), and a text field. > > > > I have no clue, what "Enter the edit password" means. When I click on > > "Profil anlegen" ("create profile"), I get "TextCha: Falsche Antwort! > > Gehen Sie zur?ck und probieren Sie es nochmal..." ("TextChar: wrong > > answer, please to back and try again"). > > I imagine that one of the administrators must have introduced a more > restrictive regime whereby a specific "password" must be given to pass the > test. Unfortunately, I don't know who it would be that might be giving out > this password, and I'm not an administrator, either. > > Paul > > P.S. Such a regime has become the accepted way of providing access to Moin > wikis in recent years. Although it is fairly primitive, it does seem to > achieve what might be done in a more sophisticated way by establishing trust > relationships between existing account holders and people who appear to be > trustworthy members of the community. I've sent the improved version of the ListPages macro to Reimar Bauer directly, by mail. His mail address is very obfuscated on his Moinmo.in- Homepage, but I think I got it. (See the thread "ListPages macro doesn't work"). Bye V.W. From pete.bleackley at btinternet.com Mon Sep 11 04:03:01 2017 From: pete.bleackley at btinternet.com (PETER BLEACKLEY) Date: Mon, 11 Sep 2017 09:03:01 +0100 (BST) Subject: [moin-user] Problem uploading pages with xmlrpclib Message-ID: <30196607.5962.1505116981851.JavaMail.defaultUser@defaultHost> I'm trying to upload some pages to my Wiki using the attached script. I'm getting the following error. Traceback (most recent call last): File "./Transcribot.py", line 101, in upload() File "./Transcribot.py", line 97, in upload for item in mc(): File "/usr/lib/python2.7/xmlrpclib.py", line 1006, in __call__ return MultiCallIterator(self.__server.system.multicall(marshalled_list)) File "/usr/lib/python2.7/xmlrpclib.py", line 1243, in __call__ return self.__send(self.__name, args) File "/usr/lib/python2.7/xmlrpclib.py", line 1602, in __request verbose=self.__verbose File "/usr/lib/python2.7/xmlrpclib.py", line 1283, in request return self.single_request(host, handler, request_body, verbose) File "/usr/lib/python2.7/xmlrpclib.py", line 1316, in single_request return self.parse_response(response) File "/usr/lib/python2.7/xmlrpclib.py", line 1493, in parse_response return u.close() File "/usr/lib/python2.7/xmlrpclib.py", line 800, in close raise Fault(**self._stack[0]) xmlrpclib.Fault: : not well-formed (invalid token): line 1361, column 539\n File "/home/petebleackley/lib/python2.7/site-packages/MoinMoin/xmlrpc/__init__.py", line 141, in process\n params, method = xmlrpclib.loads(data)\n\n File "/usr/lib/python2.7/xmlrpclib.py", line 1136, in loads\n p.feed(data)\n\n File "/usr/lib/python2.7/xmlrpclib.py", line 558, in feed\n self._parser.Parse(data, 0)\n'> This seems to imply that there is some sort of problem with the XML-RPC payload. How can I find out what this is? Peter Bleackley -------------- next part -------------- An HTML attachment was scrubbed... URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: Transcribot.py Type: text/x-python Size: 3486 bytes Desc: not available URL: From Mark.Martinec+moin at ijs.si Fri Sep 22 09:03:35 2017 From: Mark.Martinec+moin at ijs.si (Mark Martinec) Date: Fri, 22 Sep 2017 15:03:35 +0200 Subject: [moin-user] Punctuation in titles In-Reply-To: <201708111408.56078.paul@boddie.org.uk> References: <12397663.8611.1502441312379.JavaMail.defaultUser@defaultHost> <201708111408.56078.paul@boddie.org.uk> Message-ID: <400eebabe3cadcacdfa7b5346ff17e84@ijs.si> 2017-08-11 14:08, Paul Boddie wrote: > On Friday 11. August 2017 10.48.32 you wrote: >> That is what it should be doing, but I seem to have a bug in my >> MoinMoin >> installation. If I try to create [[This is a test page]], this gets >> converted to This%20is%20a%20test%20page >> and then to >> This(25)20is(25)20a(25)20test(25)20page >> >> Any idea what's doing that? If I can fix that, I think everything will >> be >> OK. > > Looks like a double-encoding problem to me. Somehow, the page name, > which is > passed in via the URL, is not getting decoded to produce the name with > spaces > in it. Then, the quoteWikinameFS function is doing its work on the > %-encoded > string rather than the actual page name. > I've copied the list in my reply because someone else might have an > immediate > solution to this, whereas I would need to look at the code. > Paul The double-encoding experienced here sounds like another manifestation of the double-encoding problem in 1.9.9, as reported in June 2017: https://mail.python.org/pipermail/moin-user/2017-June/009765.html Mark From pete.bleackley at btinternet.com Fri Sep 22 09:17:47 2017 From: pete.bleackley at btinternet.com (PETER BLEACKLEY) Date: Fri, 22 Sep 2017 14:17:47 +0100 (BST) Subject: [moin-user] Punctuation in titles In-Reply-To: <400eebabe3cadcacdfa7b5346ff17e84@ijs.si> References: <12397663.8611.1502441312379.JavaMail.defaultUser@defaultHost> <201708111408.56078.paul@boddie.org.uk> <400eebabe3cadcacdfa7b5346ff17e84@ijs.si> Message-ID: <2728030.33954.1506086267838.JavaMail.defaultUser@defaultHost> The issue turned out to be with Dreamhost Passenger not decoding urls before sending them to the WSGI application. Wrapping the wsgi application in a callable that decodes the URLs in the passenger.wsgi file fixed it. ----Original message---- >From : Mark.Martinec+moin at ijs.si Date : 22/09/2017 - 14:03 (BST) To : moin-user at python.org Cc : pete.bleackley at btinternet.com, paul at boddie.org.uk Subject : Re: [moin-user] Punctuation in titles 2017-08-11 14:08, Paul Boddie wrote: > On Friday 11. August 2017 10.48.32 you wrote: >> That is what it should be doing, but I seem to have a bug in my >> MoinMoin >> installation. If I try to create [[This is a test page]], this gets >> converted to This%20is%20a%20test%20page >> and then to >> This(25)20is(25)20a(25)20test(25)20page >> >> Any idea what's doing that? If I can fix that, I think everything will >> be >> OK. > > Looks like a double-encoding problem to me. Somehow, the page name, > which is > passed in via the URL, is not getting decoded to produce the name with > spaces > in it. Then, the quoteWikinameFS function is doing its work on the > %-encoded > string rather than the actual page name. > I've copied the list in my reply because someone else might have an > immediate > solution to this, whereas I would need to look at the code. > Paul The double-encoding experienced here sounds like another manifestation of the double-encoding problem in 1.9.9, as reported in June 2017: https://mail.python.org/pipermail/moin-user/2017-June/009765.html Mark From post at volker-wysk.de Wed Sep 27 10:46:08 2017 From: post at volker-wysk.de (Volker Wysk) Date: Wed, 27 Sep 2017 16:46:08 +0200 Subject: [moin-user] "... BrokenFilesystemWarning: Detected a misconfigured UNIX filesystem: Will use UTF-8..." Message-ID: <9101581.TTFRPrd0DQ@desktop> Hi! I get this error message in /var/log/apache2/error.log: "... BrokenFilesystemWarning: Detected a misconfigured UNIX filesystem: Will use UTF-8 as filesystem encoding instead of 'ANSI_X3.4-1968': /usr/local/share/ moin/server/moin.cgi" I think I have properly configured the filesystem encoding: /etc % echo "$LANG" de_DE.UTF-8 I've also checked the files in /etc (and subdirectories), but there does not occur the string "ANSI_X3.4-1968". That makes me puzzled about that error message. Bye Volker From post at volker-wysk.de Wed Sep 27 11:13:23 2017 From: post at volker-wysk.de (Volker Wysk) Date: Wed, 27 Sep 2017 17:13:23 +0200 Subject: [moin-user] =?utf-8?q?=22ListPages=3A_Ausf=C3=BChrung_fehlgeschl?= =?utf-8?q?agen_=5Btoo_many_values_to_unpack=5D_=28siehe_auch_die_Log-Date?= =?utf-8?b?aSki?= Message-ID: <3570903.Wy0xoMh9pI@desktop> Hi I have this in my "Test" page, which has some (empty) subpages: <> This should list the subpages, and it has worked before. Now, however, I get this error message: <> The English translation: "ListPages: execution failed [too many values to unpack] (also see the log file)." This error doesn't occur with my "Artikel" page and its subpages, but it does with my "B?cher" page. The two pages differ only slightly: <> <> In the log file there is this: 2017-09-27 17:05:39,556 ERROR MoinMoin.macro:139 Macro ListPages (page: 'Test') raised an exception:: /usr/local/share/moin/server/moin.cgi, referer: https://vwysk.now-dns.net/wiki/TitelIndex Traceback (most recent call last):: /usr/local/share/moin/server/moin.cgi, referer: https://vwysk.now-dns.net/wiki/TitelIndex File "/usr/local/lib/python2.7/dist-packages/MoinMoin/macro/__init__.py", line 129, in execute: /usr/local/share/moin/server/moin.cgi, referer: https:// vwysk.now-dns.net/wiki/TitelIndex return execute(self, args): /usr/local/share/moin/server/moin.cgi, referer: https://vwysk.now-dns.net/wiki/TitelIndex File "/usr/local/lib/python2.7/dist-packages/MoinMoin/macro/__init__.py", line 114, in : /usr/local/share/moin/server/moin.cgi, referer: https://vwysk.now-dns.net/wiki/TitelIndex _self.request, call, _args, [_self]): /usr/local/share/moin/server/ moin.cgi, referer: https://vwysk.now-dns.net/wiki/TitelIndex File "/usr/local/lib/python2.7/dist-packages/MoinMoin/wikiutil.py", line 1866, in invoke_extension_function: /usr/local/share/moin/server/moin.cgi, referer: https://vwysk.now-dns.net/wiki/TitelIndex positional, keyword, trailing = parse_quoted_separated(args): /usr/local/ share/moin/server/moin.cgi, referer: https://vwysk.now-dns.net/wiki/TitelIndex File "/usr/local/lib/python2.7/dist-packages/MoinMoin/wikiutil.py", line 1498, in parse_quoted_separated: /usr/local/share/moin/server/moin.cgi, referer: https://vwysk.now-dns.net/wiki/TitelIndex key, value = item: /usr/local/share/moin/server/moin.cgi, referer: https://vwysk.now-dns.net/wiki/TitelIndex ValueError: too many values to unpack: /usr/local/share/moin/server/moin.cgi, referer: https://vwysk.now-dns.net/wiki/TitelIndex I think that probably something is broken in MoinMoin... Bye Volker From post at volker-wysk.de Sat Sep 30 10:56:59 2017 From: post at volker-wysk.de (Volker Wysk) Date: Sat, 30 Sep 2017 16:56:59 +0200 Subject: [moin-user] =?utf-8?q?=22ListPages=3A_Ausf=C3=BChrung_fehlgeschl?= =?utf-8?q?agen_=5Btoo_many_values_to_unpack=5D_=28siehe_auch_die_Log-Date?= =?utf-8?b?aSki?= In-Reply-To: <3570903.Wy0xoMh9pI@desktop> References: <3570903.Wy0xoMh9pI@desktop> Message-ID: <12473496.WW7TMjYd1I@desktop> Hello Does anyone know, what that "too many values to unpack" message means? It doesn't occur in the MoinMoin source code (all .py files). To me this looks like it is an exception generated by python. Volker From post at volker-wysk.de Sat Sep 30 11:11:22 2017 From: post at volker-wysk.de (Volker Wysk) Date: Sat, 30 Sep 2017 17:11:22 +0200 Subject: [moin-user] =?utf-8?q?=28solved=29_Re=3A__=22ListPages=3A_Ausf?= =?utf-8?q?=C3=BChrung_fehlgeschlagen_=5Btoo_many_values_to_unpack=5D_=28s?= =?utf-8?q?iehe_auch_die_Log-Datei=29=22?= In-Reply-To: <3570903.Wy0xoMh9pI@desktop> References: <3570903.Wy0xoMh9pI@desktop> Message-ID: <1980148.iGxCFLEnxK@desktop> Hi I've found out what's wrong. It's a missing comma, in front of the "list_type" argument: <> Volker