Re: [Cheetahtemplate-discuss] problem with include directive on cheetah 2.4.0
Brought to you by:
rtyler,
tavis_rudd
From: Uhanov, K. <kir...@in...> - 2009-11-16 13:01:02
|
Probably I found workaround for me. I made some changes for className from compile procedure. I replaced starts underscores in generated class name. Index: Template.py =================================================================== --- Template.py (revision 77774) +++ Template.py (working copy) @@ -640,7 +640,7 @@ if not isinstance(className, (types.NoneType, basestring)): raise TypeError(errmsg % ('className', 'string or None')) - className = className or moduleName + className = re.sub(r'^_+','', className or moduleName) if mainMethodName is Unspecified: mainMethodName = klass._CHEETAH_defaultMainMethodNameForTemplates Thanks, Kirill -----Original Message----- From: Uhanov, Kirill [mailto:kir...@in...] Sent: Monday, November 16, 2009 11:20 AM To: ty...@mo...; James Abbatiello Cc: che...@li... Subject: Re: [Cheetahtemplate-discuss] problem with include directive on cheetah 2.4.0 Thanks, James, for your information. Tyler, this is not windows specific problem. I've reproduced that on Linux too. Could I get some workaround for cheetah name generation? Kirill -----Original Message----- From: James Abbatiello [mailto:ab...@gm...] Sent: Saturday, November 14, 2009 8:00 AM To: Uhanov, Kirill; che...@li... Subject: Re: [Cheetahtemplate-discuss] problem with include directive on cheetah 2.4.0 On Fri, Nov 13, 2009 at 5:15 PM, <ty...@mo...> wrote: > At first glance, nothing here looks wrong (at least in your usage of #include), > that said I won't have a chance to take a look at this until tomorrow morning. > > Do you have access to a Mac or Windows machine to try this there? I'd just like > to rule out that this is not a Cheetah/Windows issue. The generated class name starts with 3 underscores. You can't refer to such a name from within a method due to private name mangling (http://docs.python.org/reference/expressions.html#atom-identifiers). Here's a small bit of Python that shows the problem: __B = 0 class A(): def f(self): return __B print A().f() This looks like it should print "0" but instead you get: NameError: global name '_A__B' is not defined There's probably some way around this but it may be better just to ensure that generated identifiers never start with 2 or more underscores. -- James Abbatiello -------------------------------------------------------------------- Closed Joint Stock Company Intel A/O Registered legal address: Krylatsky Hills Business Park, 17 Krylatskaya Str., Bldg 4, Moscow 121614, Russian Federation This e-mail and any attachments may contain confidential material for the sole use of the intended recipient(s). Any review or distribution by others is strictly prohibited. If you are not the intended recipient, please contact the sender and delete all copies. ------------------------------------------------------------------------------ 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 Che...@li... https://lists.sourceforge.net/lists/listinfo/cheetahtemplate-discuss -------------------------------------------------------------------- Closed Joint Stock Company Intel A/O Registered legal address: Krylatsky Hills Business Park, 17 Krylatskaya Str., Bldg 4, Moscow 121614, Russian Federation This e-mail and any attachments may contain confidential material for the sole use of the intended recipient(s). Any review or distribution by others is strictly prohibited. If you are not the intended recipient, please contact the sender and delete all copies. |