From: Frank B. <fb...@fo...> - 2005-12-10 19:32:59
|
Hi, somehow I cannot get the setting for KidOutputMethod to work with Webware 0.9. Even when it is set to "xhtml" or "xhtml-strict" pages are still rendered as HTML with ugly uppercase <TAGS> - well, at least I see immediatly that something is still wrong. ;) So I digged into KidServletFactory.py where I can get xhtml to work by changing the global variable: defaultOutput = 'xhtml' # the default Kid output method at the start of the file, however that's of course not the Right Thing to do. I also managed to get nice, lowercase xhtml by changing class KidServletFactory's __init__ to explicitely use the global defaultOutput: class KidServletFactory(ServletFactory): """Servlet factory for Kid templates.""" def __init__(self,application): ServletFactory.__init__(self, application) setting = application.setting # change here: added "global" global defaultOutput = setting('KidOutputMethod') ... However if I now open a *.kid page through the Appserver (the builtin, standalone server actually), the browser asks me to save the file which it recognizes as a "BIN" file. The saved file however is a proper xhtml-file now. Any ideas on how to correctly fix this? Ciao -- Frank Barknecht _ ______footils.org_ __goto10.org__ |
From: Christoph Z. <ci...@on...> - 2005-12-10 21:53:13
|
Hi Frank, > somehow I cannot get the setting for KidOutputMethod to work with > Webware 0.9. I've just had a look at it and you're right - this is a bug. > I also managed to get nice, lowercase xhtml by changing class > KidServletFactory's __init__ to explicitely use the global defaultOutput: > > class KidServletFactory(ServletFactory): > """Servlet factory for Kid templates.""" > > def __init__(self,application): > ServletFactory.__init__(self, application) > setting = application.setting > # change here: added "global" > global defaultOutput = setting('KidOutputMethod') > ... Excactly that's the bug. The global statement was missing in the __init__ method. But are you sure that the above ever worked? The global statement cannot be combined with an assignment. I think you have to: global defaultOutput; defaultOutput = setting('KidOutputMethod') > However if I now open a *.kid page through the Appserver (the builtin, > standalone server actually), the browser asks me to save the file > which it recognizes as a "BIN" file. Can you try again with the correct syntax and give me feedback whether this solves the problem for you? I will check in the fix to the repository. -- Christoph |
From: Frank B. <fb...@fo...> - 2005-12-10 23:50:34
|
Hallo Christoph, Christoph Zwerschke hat gesagt: // Christoph Zwerschke wrote: > Excactly that's the bug. The global statement was missing in the > __init__ method. But are you sure that the above ever worked? The global > statement cannot be combined with an assignment. I think you have to: > > global defaultOutput; defaultOutput = setting('KidOutputMethod') Ah, of course this is the correct fix. It now works fine here. > > However if I now open a *.kid page through the Appserver (the builtin, > > standalone server actually), the browser asks me to save the file > > which it recognizes as a "BIN" file. > > Can you try again with the correct syntax and give me feedback whether > this solves the problem for you? I will check in the fix to the repository. I think, I have a bug in my kid-template somewhere. The included examples now all function correctly and render in the format that was set in Application.config. ciao -- Frank Barknecht _ ______footils.org_ __goto10.org__ |
From: Christoph Z. <ci...@on...> - 2005-12-11 09:48:47
|
Frank Barknecht schrieb: > I think, I have a bug in my kid-template somewhere. The included > examples now all function correctly and render in the format that was > set in Application.config. I have checked in the fix; it will be included in the next version. By the way, you can also set the output method individually per template by setting output = '...' on the global level of the template. -- Christoph |