From christoph.klassen at intevation.de Tue Aug 2 07:50:54 2022 From: christoph.klassen at intevation.de (Christoph Klassen) Date: Tue, 2 Aug 2022 13:50:54 +0200 Subject: [moin-user] Theme for subpages Message-ID: Hello everyone, with the help of the wiki I found out how to create a custom theme. But I would like to set another theme for specific subpages. Let's say - as an example - every page should be displayed with the theme "default" but pages whose path begins with "/sub-topic" should be displayed with the theme "extraordinary". Is that possible with MoinMoin 1.9? If yes, how could I do that or where should I start? Many regards, Christoph -- Christoph Klassen | https://www.intevation.de/ Intevation GmbH, Neuer Graben 17, 49074 Osnabr?ck | AG Osnabr?ck, HR B 18998 Gesch?ftsf?hrer: Frank Koormann, Bernhard Reiter -------------- next part -------------- A non-text attachment was scrubbed... Name: OpenPGP_signature Type: application/pgp-signature Size: 665 bytes Desc: OpenPGP digital signature URL: From christoph.klassen at intevation.de Fri Aug 5 06:29:40 2022 From: christoph.klassen at intevation.de (Christoph Klassen) Date: Fri, 5 Aug 2022 12:29:40 +0200 Subject: [moin-user] Theme for subpages In-Reply-To: References: Message-ID: Hello again, Am 02.08.22 um 13:50 schrieb Christoph Klassen: > with the help of the wiki I found out how to create a custom theme. But > I would like to set another theme for specific subpages. Let's say - as > an example - every page should be displayed with the theme "default" but > pages whose path begins with "/sub-topic" should be displayed with the > theme "extraordinary". > > Is that possible with MoinMoin 1.9? If yes, how could I do that or where > should I start? I don't know how to change the theme depending on the url yet but at least I know how to change the logo depending on the url. Here is how I did it (in the function logo() in the python file of the theme): request = self.request page = request.themedict['page'] page_name = page.page_name logo = 'default.png' category=page_name.split('/')[0] if category == 'sub_topic': logo = 'subtopic.png' And then insert the logo in the header. Before I didn't know that the function logo() was called every time I open a new page (if it's not already in the cache). Greetings, Christoph -- Christoph Klassen | https://www.intevation.de/ Intevation GmbH, Neuer Graben 17, 49074 Osnabr?ck | AG Osnabr?ck, HR B 18998 Gesch?ftsf?hrer: Frank Koormann, Bernhard Reiter -------------- next part -------------- A non-text attachment was scrubbed... Name: OpenPGP_signature Type: application/pgp-signature Size: 665 bytes Desc: OpenPGP digital signature URL: From post at volker-wysk.de Mon Aug 8 10:13:53 2022 From: post at volker-wysk.de (Volker Wysk) Date: Mon, 08 Aug 2022 16:13:53 +0200 Subject: [moin-user] Coding of attachment file names Message-ID: Hi Sometimes I have an attachment file name with a quote in it. This quote gets replaced by an underscore when the attachment is uploaded. I can still refer the attachment with the quote(s), but the attachment is saved to disk with underscores instead of quotes. (Why?) I guess this doesn't affect just quotes, but some more characters. I need to know which characters are replaced, and how the attachment file name on disk occurs. TIA Cheers, Volker -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 833 bytes Desc: This is a digitally signed message part URL: From post at volker-wysk.de Mon Aug 8 10:53:14 2022 From: post at volker-wysk.de (Volker Wysk) Date: Mon, 08 Aug 2022 16:53:14 +0200 Subject: [moin-user] Coding of attachment file names In-Reply-To: References: Message-ID: <18b6f5d28fed71decd7150c4f4868f7681d84338.camel@volker-wysk.de> Am Montag, dem 08.08.2022 um 16:13 +0200 schrieb Volker Wysk: > Hi > > Sometimes I have an attachment file name with a quote in it. This quote gets > replaced by an underscore when the attachment is uploaded. I can still refer > the attachment with the quote(s), but the attachment is saved to disk with > underscores instead of quotes. (Why?) > > I guess this doesn't affect just quotes, but some more characters. I need to > know which characters are replaced, and how the attachment file name on disk > occurs. Now I've created a sample file with this name: !"?$%&()=?":;??? It gets saved as an attachment with this name: !_22?$_&()=__22_;??? So there is some recoding of the file name taking place. Which? What get's done to the file name? I guess I will have to read the source code. Where should I start? And I don't know any python... Bye, Volker -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 833 bytes Desc: This is a digitally signed message part URL: From paul at boddie.org.uk Mon Aug 8 10:58:13 2022 From: paul at boddie.org.uk (Paul Boddie) Date: Mon, 08 Aug 2022 16:58:13 +0200 Subject: [moin-user] Coding of attachment file names In-Reply-To: References: Message-ID: <2041295.jqTGCjZfR6@jason> On Monday, 8 August 2022 16:13:53 CEST Volker Wysk wrote: > > Sometimes I have an attachment file name with a quote in it. This quote gets > replaced by an underscore when the attachment is uploaded. I can still > refer the attachment with the quote(s), but the attachment is saved to disk > with underscores instead of quotes. (Why?) > > I guess this doesn't affect just quotes, but some more characters. I need to > know which characters are replaced, and how the attachment file name on > disk occurs. When storing the attachment in a file, Moin has to encode the filename according to the limitations of the underlying filesystem and to prevent potential filename processing exploits. So, you will see various characters get replaced in the supplied filename. Looking at the code, you'll find the add_attachment function in MoinMoin/ action/AttachFile.py where the wikiutil.taintfilename function is called. This function resides in MoinMoin/wikiutil.py and performs a substitution as follows: re.sub('[\x00-\x1f:/\\\\<>"*?%|]', '_', basename) This effectively replaces all character codes up to 31, colon, slash, backslash, less than, greater than, double quote, asterisk, question mark, percent, and pipe with an underscore, as you can see. I was somewhat surprised that the substitution was less sophisticated than the one used by page names which you can find in the same module in the quoteWikinameFS function. That performs some kind of encoding where you will see things like "(20)" in filenames, with that particular example being used for spaces. I don't know what the history is behind this functionality, but I imagine that the basic functionality was done a couple of decades ago and it has been refined since then, although I do think that the above differences in filename processing are a bit odd. Then again, once things become established, they tend to stay that way forever. Paul From post at volker-wysk.de Mon Aug 8 11:14:01 2022 From: post at volker-wysk.de (Volker Wysk) Date: Mon, 08 Aug 2022 17:14:01 +0200 Subject: [moin-user] Coding of attachment file names In-Reply-To: <2041295.jqTGCjZfR6@jason> References: <2041295.jqTGCjZfR6@jason> Message-ID: Thanks a lot for the elaborate explanation! Volker Am Montag, dem 08.08.2022 um 16:58 +0200 schrieb Paul Boddie: > On Monday, 8 August 2022 16:13:53 CEST Volker Wysk wrote: > > Sometimes I have an attachment file name with a quote in it. This quote gets > > replaced by an underscore when the attachment is uploaded. I can still > > refer the attachment with the quote(s), but the attachment is saved to disk > > with underscores instead of quotes. (Why?) > > > > I guess this doesn't affect just quotes, but some more characters. I need to > > know which characters are replaced, and how the attachment file name on > > disk occurs. > > When storing the attachment in a file, Moin has to encode the filename > according to the limitations of the underlying filesystem and to prevent > potential filename processing exploits. So, you will see various characters > get replaced in the supplied filename. > > Looking at the code, you'll find the add_attachment function in MoinMoin/ > action/AttachFile.py where the wikiutil.taintfilename function is called. This > function resides in MoinMoin/wikiutil.py and performs a substitution as > follows: > > re.sub('[\x00-\x1f:/\\\\<>"*?%|]', '_', basename) > > This effectively replaces all character codes up to 31, colon, slash, > backslash, less than, greater than, double quote, asterisk, question mark, > percent, and pipe with an underscore, as you can see. > > I was somewhat surprised that the substitution was less sophisticated than the > one used by page names which you can find in the same module in the > quoteWikinameFS function. That performs some kind of encoding where you will > see things like "(20)" in filenames, with that particular example being used > for spaces. > > I don't know what the history is behind this functionality, but I imagine that > the basic functionality was done a couple of decades ago and it has been > refined since then, although I do think that the above differences in filename > processing are a bit odd. Then again, once things become established, they > tend to stay that way forever. > > Paul > > > _______________________________________________ > moin-user mailing list > moin-user at python.org > https://mail.python.org/mailman/listinfo/moin-user -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 833 bytes Desc: This is a digitally signed message part URL: From post at volker-wysk.de Mon Aug 8 11:35:31 2022 From: post at volker-wysk.de (Volker Wysk) Date: Mon, 08 Aug 2022 17:35:31 +0200 Subject: [moin-user] Coding of attachment file names In-Reply-To: <2041295.jqTGCjZfR6@jason> References: <2041295.jqTGCjZfR6@jason> Message-ID: <0c0bbb258ba660793f29f3adec5368a4d8e8b311.camel@volker-wysk.de> Am Montag, dem 08.08.2022 um 16:58 +0200 schrieb Paul Boddie: > On Monday, 8 August 2022 16:13:53 CEST Volker Wysk wrote: > > Sometimes I have an attachment file name with a quote in it. This quote gets > > replaced by an underscore when the attachment is uploaded. I can still > > refer the attachment with the quote(s), but the attachment is saved to disk > > with underscores instead of quotes. (Why?) > > > > I guess this doesn't affect just quotes, but some more characters. I need to > > know which characters are replaced, and how the attachment file name on > > disk occurs. > > When storing the attachment in a file, Moin has to encode the filename > according to the limitations of the underlying filesystem and to prevent > potential filename processing exploits. So, you will see various characters > get replaced in the supplied filename. I just assumed it was Linux. :-) > Looking at the code, you'll find the add_attachment function in MoinMoin/ > action/AttachFile.py where the wikiutil.taintfilename function is called. This > function resides in MoinMoin/wikiutil.py and performs a substitution as > follows: > > re.sub('[\x00-\x1f:/\\\\<>"*?%|]', '_', basename) > > This effectively replaces all character codes up to 31, colon, slash, > backslash, less than, greater than, double quote, asterisk, question mark, > percent, and pipe with an underscore, as you can see. > > I was somewhat surprised that the substitution was less sophisticated than the > one used by page names which you can find in the same module in the > quoteWikinameFS function. That performs some kind of encoding where you will > see things like "(20)" in filenames, with that particular example being used > for spaces. Yes, I had to deal with this too. You get a LOT of bracketed numbers, even for things like spaces, which wouldn't need to be encoded. > I don't know what the history is behind this functionality, but I imagine that > the basic functionality was done a couple of decades ago and it has been > refined since then, although I do think that the above differences in filename > processing are a bit odd. Then again, once things become established, they > tend to stay that way forever. Yes, they do! :-) Volker -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 833 bytes Desc: This is a digitally signed message part URL: