Re: [Cheetahtemplate-discuss] Placeholder problem
Brought to you by:
rtyler,
tavis_rudd
From: Shannon -jj B. <jj...@gm...> - 2004-10-01 23:02:01
|
If all else fails, you can always fall back to avoiding the name mapper syntax in cases like these: $str(volume.selection_id.value) It also helps to look at what's going on in the compiled template when you decide to do this. Please forgive me if I have misunderstood the problem. Best Regards, -jj On Fri, 1 Oct 2004 17:08:48 -0500 (CDT), jk...@de... <jk...@de...> wrote: > I've got a bit of template code that looks like this: > > #for $volume in $output.volumes.value > > ... > randomly inserted references to > > $volume.selection_name.value > $volume.selection_id.value > > #end for > > The problem I'm seeing is that none of the templates can ever seem to find > the 'selection_name' or 'selection_id' things to apply the '.value' to... > > is the placeholder syntax incapable of supporting this type of reference? > > none of the objects are dictionaries (they use them, but they are class > objects). I've written a series of classes that represent a tree of data, > and at any node there are a few known attributes that will carry some > data. These are value, key, error and has_error. I store them in a > private dictionary by overriding __getattribute__ and __setattr__. These > classes work perfectly in non template code, and the error message I get > looks like this: > > File > "/usr/lib/python2.2/site-packages/stuff/ui/web/Templates/file_classes.py", > line 125, in respond > write(filter(VFN(fc,"fileclass_id.value",1), > rawExpr='$fc.fileclass_id.value')) # from line 31, col 67. > NotFound: fileclass_id > > anyone have any idea what I'm doing wrong? I'm going to be deeply sad if > cheetah simply can't support my classes in the template... > > thanks > jeremy -- I am trying out gmail right now. I am forwarding all of my Yahoo mail to gmail, so please do not update your address book just yet. |