Anand Can you try #include with render_cheetah it does nt work but newrender_cheetah works
On Tue, Mar 24, 2009 at 9:28 PM, Anand Chitipothu <[email protected]>wrote: > > > from web.utils import re_compile, memoize, dictadd > > import re > > r_include = re_compile(r'(?!\\)#include \"(.*?)\"', re.M) > > class newrender_cheetah: > > """Rendering interface to Cheetah Templates. > > > > Example: > > > > render = render_cheetah('templates') > > render.hello(name="cheetah") > > """ > > def __init__(self, path): > > # give error if Chetah is not installed > > from Cheetah.Template import Template > > self.path = path > > > > def __getattr__(self, name): > > from Cheetah.Template import Template > > try:path = os.path.join(self.path, name + ".html") > > except:path = os.path.join(self.path, name + ".tmpl") > > text = open(path).read() > > # implement #include at compile-time > > def do_include(match): > > text = open('templates/'+match.groups()[0]).read() > > return text > > while r_include.findall(text): > > text = r_include.sub(do_include, text) > > def template(**kw): > > t = Template(text, searchList=[kw]) > > data = t.respond() > > t.shutdown() > > return data > > > > return template > > > why should web.py implement include functionality for cheetah? Isn't > that provided by Cheetah already? > > > > -- BidEgg - Worlds best low price Auction site http://bidegg.com BidEgg - Worlds best low price Auction site --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "web.py" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/webpy?hl=en -~----------~----~----~----~------~----~------~--~---
