[stringtemplate-interest] problem with simple group inheritance
cpizzi at nis-retail.com
Fri Jun 20 05:31:56 PDT 2008
Zenaan Harkness wrote:
> On Wed, Jun 18, 2008 at 12:55:13PM -0400, Chris Pizzi wrote:
>> I am having a problem with simple group inheritance in Python
>> stringtemplate 3.1. It seems that if a template is not found under
>> the sub-group's root directory, it never tries to find it in the
>> Given this directory layout:
>> ./super/sup.st ./sub/sub.st
>> with super.st containing:
>> and sub.st containing:
>> SUB $sup()$
>> I would expect the following to yield "SUB SUPER", however I get an
>> error instead:
>>>>> from stringtemplate3 import StringTemplateGroup sup =
>>>>> StringTemplateGroup("super","./super") sub =
>>>>> StringTemplateGroup("sub","./sub") sub.superGroup = sup print
>> Got IOError writing to writerAutoIndentWriter SUB
>> Am I misunderstanding inheritance, or is this actually a problem?
>> For now I have patched groups.py to make it behave the way I'm
> Are you using group files, or separate template-per-st-file template
I'm using groups of separate template-per-st files.
> My understanding of groups is that they work with group files (bunch
> of templates in a single file), and not with single template files.
Inheritance of directory-based groups seems to be supported. In the
(both Java and Python) documentation under Template and Attribute Lookup
Rules it says:
> If a template t is associated with a group, but was not defined via a
> group file format, lookup a referenced template in the group's
> template table. If not there, look for it on the disk under the
> group's root dir or via the CLASSPATH (it might have appeared
> dynamically on disk). If not found, recursively look at any
> supergroup of the group. If not found at all, record this fact and
> don't look again on the disk until refresh interval.
It's the "recursively look at any supergroup of the group" behavior that
I'm looking for.
2 N Tamiami Trail, 9th Fl
Sarasota, FL 34236
Notice: This communication may contain privileged or other confidential
information. If you have received it in error, please advise the sender
by reply email and immediately delete the message and any attachments
without copying or disclosing the contents. Thank you.
More information about the stringtemplate-interest