Re: problem with include directive on cheetah 2.4.0

James Abbatiello <[email protected]> Sat, 14 Nov 2009 00:00:02 -0500
Newsgroups gmane.comp.python.cheetah
Message-ID <[email protected]>
On Fri, Nov 13, 2009 at 5:15 PM,  <[email protected]> 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

------------------------------------------------------------------------------
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