[stringtemplate-interest] problem with simple group inheritance

Zenaan Harkness zen at freedbms.net
Thu Jun 19 20:41:18 PDT 2008


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 super-group's.
> 
> Given this directory layout:
> 
> ./super/sup.st
> ./sub/sub.st
> 
> with super.st containing:
> 
> SUPER
> 
> 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 sub.getInstanceOf("sub")
>  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 expecting:

Are you using group files, or separate template-per-st-file template
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.

I use Java though, and not python...

HTH

-- 
Homepage: www.SoulSound.net -- Free Australia: www.UPMART.org
Please respect the confidentiality of this email as sensibly warranted.


More information about the stringtemplate-interest mailing list