Hi All, Ive had a chance to look at this system and added some debug code to Compiler.py at about line 1274 - some context below..
if self._templateObj: mod = self._templateObj._importAsDummyModule('\n'.join(self._importStatements)) class newClass: pass newClass.__name__ = self._mainClassName __bases__ = (getattr(mod, self._baseClass), ) print "DEBUG: ", __bases__ print "DEBUG: ", type(__bases__[0]) newClass.__bases__ = __bases__ self._templateObj.__class__ = newClass # must initialize it so instance attributes are accessible newClass.__init__(self._templateObj, _globalSetVars=self._templateObj._globalSetVars, _preBuiltSearchList=self._templateObj._searchList) When run from the command line, __bases__ is a tuple and the first element is of type classobj eg. Python 2.4.1 (#2, Aug 17 2005, 22:07:29) [GCC 3.3.3 [FreeBSD] 20031106] on freebsd5 Type "help", "copyright", "credits" or "license" for more information. >>> from Cheetah.Template import Template >>> T = Template(file='../Templates/view.tmpl') DEBUG: (<class BaseTemplate.BaseTemplate at 0x830644c>,) DEBUG: <type 'classobj'> When run from within webware virtually the exact same code results in debug output of DEBUG: (<class 'BaseTemplate.BaseTemplate'>,) DEBUG: <type 'type'> Im not sure why this is happening? Prehaps someone with a better understanding of python classes underworkings and webware can shed some light? Regards, Leith > > On 8/25/05, Tavis Rudd <[EMAIL PROTECTED]> wrote: > > what version of Cheetah were the templates compiled with? Have you tried > > recompiling them? > > > > On Tuesday 23 August 2005 17:12, Leith Parkin wrote: > > > Hi, > > > > > > I recently upgraded to python2.4 and no longer seem to be able to use > > > derived templates. > > > > > > The system im working on uses Webware and each servlet loads its view > > > template which extends and implements functions from a compiled base > > > template. > > > > > > Eg. > > > from Cheetah.Template import Template > > > T = Template(file='view.tmpl') > > > ... do stuff ... > > > return T > > > > > > then the webware base class (derived from Page) fills in its stuff and > > > calls T.respond(transaction) > > > > > > The stange thing is they work fine when loaded from the interepter. > > > > > > When run from within the webware it raises an exception > > > > > > File "/usr/local/lib/python2.4/site-packages/Cheetah/Compiler.py", > > > line 1274, in setBaseClass [edit] > > > newClass.__bases__ = __bases__ > > > TypeError: __bases__ items must be classes > > > > > > Could someone please provide some insight into why this is happening > > > and how to fix it! more details can be provided if required, using the > > > latest Cheetah > > > > > > CHEETAH 0.9.18 (output of Command-Line Tool) > > > Python 2.4.1 (#2, Aug 17 2005, 22:07:29) > > > > > > This system used to work fine under 2.3! > > > > > > Regards, > > > > > > Leith > > > > > > > > > ------------------------------------------------------- > > > SF.Net email is Sponsored by the Better Software Conference & EXPO > > > September 19-22, 2005 * San Francisco, CA * Development Lifecycle > > > Practices > > > Agile & Plan-Driven Development * Managing Projects & Teams * Testing & QA > > > Security * Process Improvement & Measurement * http://www.sqe.com/bsce5sf > > > _______________________________________________ > > > Cheetahtemplate-discuss mailing list > > > [EMAIL PROTECTED] > > > https://lists.sourceforge.net/lists/listinfo/cheetahtemplate-discuss > > > ------------------------------------------------------- SF.Net email is Sponsored by the Better Software Conference & EXPO September 19-22, 2005 * San Francisco, CA * Development Lifecycle Practices Agile & Plan-Driven Development * Managing Projects & Teams * Testing & QA Security * Process Improvement & Measurement * http://www.sqe.com/bsce5sf _______________________________________________ Webware-discuss mailing list Webware-discuss@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/webware-discuss