On 3/5/2010 12:48 PM, Richard HARDWICK wrote:

> For example, the item $hash{'Project'}->{'Start'} does exist. So a
> simple template like this
>      Project.Start ... [%- Project.Start %]
> writes this
>      Project.Start ... 01/01/2007
>
> But my template using hash.exists() says that the same item does
> _not_ exist. That template is (all on one line, in the original)
>      [%   hash.exists('Project.Start')
>         ? ''
>         : '$hash{Project}->{Start} = ;'  %]
> and it writes this
>      $hash{Project}->{Start} = ;
> i.e. it takes the not-exist option (for everything that I throw at
> it)

[% hash.exists('Project.Start') %] looks up the key 'Project.Start' in 
the hash stored in the template variable named hash.  I think you want 
to look up the key 'Start' in the hash stored in the template variable 
named Project.  That would be [% Project.exists('Start') %].

Ronald

_______________________________________________
templates mailing list
[email protected]
http://mail.template-toolkit.org/mailman/listinfo/templates

Reply via email to