Creating a fully stand-alone Zope Page Templates
I am trying to make a stand-alone Page Templates packages that doesn't have any Zope dependencies. I was able to short circuit security and acquisition. I re-implemented MultiMapping in plain Python and made the Base class just an empty class. This is passing most of the regression tests, but there is one big issue left. When a page template invokes something that is a function, it prints the equivalent of 'repr(function)' instead of 'function()'. What magic that goes on within Zope am I missing in my wrapper? Kevin Smith Kevin.Smith@theMorgue.org
Kevin Smith wrote:
I am trying to make a stand-alone Page Templates packages that doesn't have any Zope dependencies. I was able to short circuit security and acquisition. I re-implemented MultiMapping in plain Python and made the Base class just an empty class.
This is passing most of the regression tests, but there is one big issue left. When a page template invokes something that is a function, it prints the equivalent of 'repr(function)' instead of 'function()'. What magic that goes on within Zope am I missing in my wrapper?
This doesn't answer the above question, and may not be suitable for Kevin's needs, but I thought I'd mention there's a pretty nice Zope-independent page template implementation at: http://www.owlfish.com/software/simpleTAL/ in case others have an interest in that sort of thing, and pretty amazingly - it does it with just two module files, so it's a piece of cake to use. Barry
I have been using that, and it is very nice, but it doesn't include METAL. I'm hoping that the author of that package implements METAL, so I can use his package. But if that doesn't work out, I need something to fall back on. On Monday, February 24, 2003, at 11:25 PM, Barry Pederson wrote:
Kevin Smith wrote:
I am trying to make a stand-alone Page Templates packages that doesn't have any Zope dependencies. I was able to short circuit security and acquisition. I re-implemented MultiMapping in plain Python and made the Base class just an empty class. This is passing most of the regression tests, but there is one big issue left. When a page template invokes something that is a function, it prints the equivalent of 'repr(function)' instead of 'function()'. What magic that goes on within Zope am I missing in my wrapper?
This doesn't answer the above question, and may not be suitable for Kevin's needs, but I thought I'd mention there's a pretty nice Zope-independent page template implementation at:
http://www.owlfish.com/software/simpleTAL/
in case others have an interest in that sort of thing, and pretty amazingly - it does it with just two module files, so it's a piece of cake to use.
Barry
Kevin Smith Kevin.Smith@sas.com
On Tue, 25 Feb 2003 11:07 am, Kevin Smith wrote:
I am trying to make a stand-alone Page Templates packages that doesn't have any Zope dependencies. I was able to short circuit security and acquisition. I re-implemented MultiMapping in plain Python and made the Base class just an empty class.
This is passing most of the regression tests, but there is one big issue left. When a page template invokes something that is a function, it prints the equivalent of 'repr(function)' instead of 'function()'. What magic that goes on within Zope am I missing in my wrapper?
Hurm. I can't answer this directly, but I have done the same as you and divorced ZPT completely from Zope for Roundup. See http://roundup.sf.net/ in the roundup.cgi.[PageTemplates|TAL|ZTUtils] packages. Richard
This works!! Thank you! Do you keep your Page Templates up-to-date with Zope's, or is this version going to stay the way it is from now on? It looks like you did what I was trying to do (i.e. put a wrapper around the existing code) so that updates only required you to get the newest version of Page Templates from Zope and plug them in. On Tuesday, February 25, 2003, at 01:52 AM, Richard Jones wrote:
On Tue, 25 Feb 2003 11:07 am, Kevin Smith wrote:
I am trying to make a stand-alone Page Templates packages that doesn't have any Zope dependencies. I was able to short circuit security and acquisition. I re-implemented MultiMapping in plain Python and made the Base class just an empty class.
This is passing most of the regression tests, but there is one big issue left. When a page template invokes something that is a function, it prints the equivalent of 'repr(function)' instead of 'function()'. What magic that goes on within Zope am I missing in my wrapper?
Hurm. I can't answer this directly, but I have done the same as you and divorced ZPT completely from Zope for Roundup. See http://roundup.sf.net/ in the roundup.cgi.[PageTemplates|TAL|ZTUtils] packages.
Richard
Kevin Smith Kevin.Smith@sas.com
On Wed, 26 Feb 2003 1:26 am, Kevin Smith wrote:
This works!! Thank you! Do you keep your Page Templates up-to-date with Zope's, or is this version going to stay the way it is from now on? It looks like you did what I was trying to do (i.e. put a wrapper around the existing code) so that updates only required you to get the newest version of Page Templates from Zope and plug them in.
I keep track of bug fixes, but nothing else. ZPT is a stable product, so bug reports are rare. The multilingual implementation (which I'm not completely up to speed with) was happening while I was doing my port, so I don't have any of that. I also can't just update from the ZPT CVS any more. Richard
Hurm. I can't answer this directly, but I have done the same as you and divorced ZPT completely from Zope for Roundup. See http://roundup.sf.net/ in the roundup.cgi.[PageTemplates|TAL|ZTUtils] packages.
I wonder if it would be worth our while to make sure that ZPT is separately usable, just like we do for ZODB? Just how much did you have to change to divorce ZPT from Zope? --Guido van Rossum (home page: http://www.python.org/~guido/)
On Wed, 26 Feb 2003 1:53 am, Guido van Rossum wrote:
Hurm. I can't answer this directly, but I have done the same as you and divorced ZPT completely from Zope for Roundup. See http://roundup.sf.net/ in the roundup.cgi.[PageTemplates|TAL|ZTUtils] packages.
I wonder if it would be worth our while to make sure that ZPT is separately usable, just like we do for ZODB?
I've made that suggestion numerous times on the ZPT mailing list, with zero response.
Just how much did you have to change to divorce ZPT from Zope?
I've fully documented it (as required by the ZPT license). In a nutshell: - implemented MultiMapping as simple python modules - changed the way macros are handled to remove the computed attribute stuff (since it's an acquisition trick) - removed all references to acquisition (for cleanliness, no other reason) including some ZTUtils that won't work without it (ie. tree stuff) - altered the import statements so that I wouldn't clash with another version of ZPT if it were installed (or if Roundup was installed as a Zope Product) - significantly improved error reporting :) The critical change is the way that the macros are handled. The ComputedAttribute stuff just doesn't make sense (and is horribly complicated) when you're not using acquisition. The good news is that TAL requires no changes if you implement a dummy zLOG. I ended up removing the dependency. Richard
participants (4)
-
Barry Pederson -
Guido van Rossum -
Kevin Smith -
Richard Jones