Edgewall Software

Opened 14 years ago

Last modified 8 years ago

#412 new defect

Genshi template loader problems with non-ascii directories

Reported by: Christoph Zwerschke <cito@…> Owned by: cmlenz
Priority: major Milestone: 0.9
Component: Template processing Version: 0.6
Keywords: template loader Cc:

Description

I ran into problems on Windows 7 with a TurboGears project that contained a non-ascii char in its name (und thus in the project directory).

The template loader raises a UnicodeDecodeError if the base directory contains a non-ascii char and is passed in native encoding (in this case, mbcs) instead of Unicode (which does not make problems), and then tries to include another template from that directory. Since the template name comes in as Unicode, joining the base name and the included template name fails.

Find attached a suggested patch and a test method that can be added to genshi.template.tests.loader. The test uses imp.find_module to get the encoded file path, but the same happens when you use the Buffet template loader for instance, which is used by TurboGears, or otherwise happen to get directory names in encoded form.

Attachments (3)

loader_test.patch (2.7 KB) - added by Christoph Zwerschke <cito@…> 14 years ago.
test method for genshi.template.tests.loader
loader.patch (7.0 KB) - added by Christoph Zwerschke <cito@…> 14 years ago.
suggested patch for genshi.template.loader
loader_test.2.patch (2.7 KB) - added by Christoph Zwerschke <cito@…> 14 years ago.
test method for genshi.template.tests.loader

Download all attachments as: .zip

Change History (4)

Changed 14 years ago by Christoph Zwerschke <cito@…>

test method for genshi.template.tests.loader

Changed 14 years ago by Christoph Zwerschke <cito@…>

suggested patch for genshi.template.loader

Changed 14 years ago by Christoph Zwerschke <cito@…>

test method for genshi.template.tests.loader

comment:1 Changed 8 years ago by hodgestar

  • Milestone changed from 0.7 to 0.9

Moved to milestone 0.9.

Note: See TracTickets for help on using tickets.