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

Reply via email to