-ww
On Feb 27, 2005, at 8:17 AM, Scott Russell wrote:
This may or may not be useful - it allows you to set a KidKitWrapper_________________________________________
variable inside a .kid file to use a custom wrapper.
I basically moved the load_template outside of the wrapper and check it
for a custom KidKitWrapper, and load that if it's found. This is how
I'm integrating KidKit into a SecurePage setup. If anyone needs further
details, I can work up an example. If anyone can show me a better way
to do this with as minimal impact, I'm all ears.
### patch begins ###
--- /new/Webware/KidServletFactory.py 2005-01-26 13:36:25.000000000 -0500
+++ /old/Webware/KidKit/KidServletFactory.py 2005-02-27 08:06:31.024649785 -0500
@@ -17,14 +17,14 @@
_log = logging.getLogger(__name__)
-class ServletWrapper( Page ):
+class BaseKidServletWrapper( Page ):
'''
I am a WebKit.Servlet, and when I am asked to respond, I will run the KID template
to produce the html page.
'''
- def __init__( self, kidFileName ):
- self._kidModule = kid.load_template( kidFileName, cache=True )
+ def __init__( self, kidModule ):
+ self._kidModule = kidModule
self._factory = None # Somebody still uses this, although it seems to be deprecated.
def respond( self, trans ):
@@ -60,6 +60,11 @@
_log.debug('fullname=%s',fullname)
- theServlet = ServletWrapper( fullname )
+ kidModule = kid.load_template( fullname, cache=True )
+ try:
+ kidWrapper = kidModule.KidKitWrapper
+ except AttributeError:
+ kidWrapper = BaseKidServletWrapper
+ theServlet = kidWrapper( kidModule )
return theServlet
-------------------------------------------------------
SF email is sponsored by - The IT Product Guide
Read honest & candid reviews on hundreds of IT Products from real users.
Discover which products truly live up to the hype. Start reading now.
http://ads.osdn.com/?ad_id=6595&alloc_id=14396&op=click
_______________________________________________
Webware-discuss mailing list
Webware-discuss@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/webware-discuss
winston wolff - (646) 827-2242 - http://www.stratolab.com - learning by creating