you can return template='some_project.templates.add_item' in your dict
and that will be using instead of the one specified in expose

On 1/5/06, Soni Bergraj <[EMAIL PROTECTED]> wrote:
>
> Hello,
> is it possible to use different templates for one and the same url,
> according to some condition?
>
> With the url /item/some_item i either want to use the template
> 'some_project.templates.add_item' or if the item already exists
> 'some_project.templates.show'.
>
> my controllers.py looks similar to:
>
>
> class Item(object):
>
>     @turbogears.expose(html="some_project.templates.show")
>     def default(self, *args):
>
>         name="default_item"
>
>         if args:
>             name = args[0]
>
>         try:
>             my_item     = model.Item.byName(name)
>             # prepare template variables and return them
>
>         except SQLObjectNotFound:
>             # show template some_project.templates.add_item
>
> class Root(controllers.Root):
>     item  = Item()
>
>     #...
>
>
> Thanks,
>
> Soni Bergraj
>
>


--
cheers
    elvelind grandin

Reply via email to