You legend!
I had tried __getattr__ but was missing the second bracket... Thanks
On Apr 5, 7:13 pm, "Yoan Blanc" <[EMAIL PROTECTED]> wrote:
> It's not very nice, but it works ;-)
>
> >>> import web
> >>> render = web.template.render("templates/")
> >>> render.index(title="Hello World!")
>
> '<p>Hello World!</p>'>>> render.__getattr__("index")(body="Hello World!")
>
> '<p>Hello World!</p>'
>
> Cheers,
>
> -- Yoan
>
> 2008/4/5 foobarmus <[EMAIL PROTECTED]>:
>
>
>
> > Yeah, that works fine, but I'm trying to pass the template into my
> > superclass... What I really want to do is this:
>
> > render = web.template.render()
>
> > class Page:
>
> > def _my_render:
> > return render.<...foo>()
>
> > def my_render:
> > if self.debug:
> > return self._my_render()
> > else:
> > try:
> > return self._my_render()
> > except:
> > # do something else
> > pass
>
> > class foo(Page):
> > def GET(self):
> > self.params{"template":"foo",
> > "debug":True}
> > return self.my_render()
>
> > On Apr 5, 6:41 pm, Ken <[EMAIL PROTECTED]> wrote:
> > > try like this:
>
> > > render = web.template.render('templates/', cache=False)
>
> > > class index:
> > > def GET(self):
> > > todos = web.select('todo')
> > > # print render.error(list(todos))
> > > # return False
> > > print render.index(todos)
>
> > > On Sat, Apr 5, 2008 at 6:20 PM, foobarmus <[EMAIL PROTECTED]> wrote:
>
> > > > I'm sure this is a no brainer, but it's driving me crazy...
>
> > > > render = web.template.render()
>
> > > > class Page:
> > > > def my_render:
> > > > return render.<here I need to get the value of
> > > > self.template>()
>
> > > > class foo(Page):
> > > > def GET(self):
> > > > self.template = "foo"
> > > > return self.my_render()
>
> > > --http://twitter.com/qichangxinghttp://blog.hi0791.com(buildwith
> > web.py)http://www.baicai.com百才招聘
>
> > > Gtalk: iexper(at)gmail.com
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---