|
View:
New views
2 Messages
—
Rating Filter:
Alert me
|
|
|
@staticmethod verses multiple #extends inheritanceHi, I've been using Cheetah for a few years, but I've haven't been following the list or the developments closely. And I remember that multiple inheritance wasn't possible with previous versions of Cheetah. Now I'm reading that since v2.2.2 multiple inheritance is possible. Great! :-) I read about the #@staticmethod decorator, and this recipe http://packages.python.org/Cheetah/recipes/staticmethod.html What would be better to use if I would like to mix #def's of different template clases? What's the difference between #from foo import foo and #extends myclass, foo ? Currently I'm using an Cheetah / pure python inheritance hierarchy to use different framework functionality and libraries throughout my different pages. Something like: BaseSkeleton.tmpl -> ExtraComponents.tmpl -> PythonFramework.py -> page.tmpl -> typeA.tmpl -> typeB.tmpl -> typeC.tmpl -> subtypeC2.tmpl Now I would like to use #def methods from typeA.tmpl in subtypeC2.tmpl. And maybe also the other way around: use #def methods from subtypeC2.tmpl in typeA.tmpl Would I be using the now possible multiple inheritance? Or the #@staticmethod decorator? best regards And thanks for keeping Cheetah alive and kicking! dirk -- ----------------------------- Dirk van Oosterbosch de Wittenstraat 225 1052 AT Amsterdam the Netherlands http://labs.ixopusada.com ----------------------------- -- ------------------------------------------------------------------------------ Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day trial. Simplify your report design, integration and deployment - and focus on what you do best, core application coding. Discover what's new with Crystal Reports now. http://p.sf.net/sfu/bobj-july _______________________________________________ Cheetahtemplate-discuss mailing list Cheetahtemplate-discuss@... https://lists.sourceforge.net/lists/listinfo/cheetahtemplate-discuss |
|
|
Re: @staticmethod verses multiple #extends inheritanceOn Tue, 10 Nov 2009, Dirk van Oosterbosch, IR labs wrote: > > Hi, > > I've been using Cheetah for a few years, but I've haven't been > following the list or the developments closely. > And I remember that multiple inheritance wasn't possible with previous > versions of Cheetah. > > Now I'm reading that since v2.2.2 multiple inheritance is possible. > Great! :-) > I read about the #@staticmethod decorator, and this recipe http://packages.python.org/Cheetah/recipes/staticmethod.html > > What would be better to use if I would like to mix #def's of different > template clases? > What's the difference between > #from foo import foo > and > #extends myclass, foo > ? > > > Currently I'm using an Cheetah / pure python inheritance hierarchy to > use different framework functionality and libraries throughout my > different pages. Something like: > BaseSkeleton.tmpl > -> ExtraComponents.tmpl > -> PythonFramework.py > -> page.tmpl > -> typeA.tmpl > -> typeB.tmpl > -> typeC.tmpl > -> subtypeC2.tmpl > > Now I would like to use #def methods from typeA.tmpl in subtypeC2.tmpl. > And maybe also the other way around: use #def methods from > subtypeC2.tmpl in typeA.tmpl > > Would I be using the now possible multiple inheritance? Or the > #@staticmethod decorator? way IMO. If you're just using a small number of methods from typaA in subtypeC2 then I'd just annotate them with a #@staticmethod decorator, otherwise I'd try multiple inheritance. The same rules apply for Cheetah multiple inheritance as in Python, so you want to make sure that typaA isn't squashing a method in typeC and vice versa > And thanks for keeping Cheetah alive and kicking! No prob ;) Cheers, -R. Tyler Ballance -------------------------------------- GitHub: http://github.com/rtyler Twitter: http://twitter.com/agentdero Blog: http://unethicalblogger.com ------------------------------------------------------------------------------ Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day trial. Simplify your report design, integration and deployment - and focus on what you do best, core application coding. Discover what's new with Crystal Reports now. http://p.sf.net/sfu/bobj-july _______________________________________________ Cheetahtemplate-discuss mailing list Cheetahtemplate-discuss@... https://lists.sourceforge.net/lists/listinfo/cheetahtemplate-discuss |
| Free embeddable forum powered by Nabble | Forum Help |