Alessandro, Chris, have a nice day.

Tried today to override template. Strange things happened. Code looks like:

----
class AjaxController(BaseController):
    @expose('myproject.templates.ajax.passport') #for some html requests
    @expose('json') #for json requests
    def mymethod(self, id, category='menu'):
        keys = ['passport', 'volumes']
        if category == 'menu':
            return dict(length=len(keys), elements=keys) #returned when 
/ajax/mymethod/1/menu.json requested, works fine.
        elif category in keys:
            if category == 'pasport':
                ...
                # some stuff with ORM
                ...
                return dict(params=params) #returned when 
/ajax/mymethod/1/passport requested, works fine.
            elif category == 'volumes':
                override_template(self, 'myproject.templates.ajax.volumes') 
# 'myproject.templates.ajax.passport' is still exposed
                ...
                # some stuff with ORM
                ...
                return dict(params=params) #returned when 
/ajax/mymethod/1/volumes requested
----

Looks like I'm doing something wrong. Any idea?
AjaxController linked to RootController using "ajax = AjaxController()". I 
didn't find any examples of using 'override_template' except Yours. So I am 
stuck...

Max.

PS: Christopher, I'm sorry. Looks like 1-st time I sent question to Your 
email.

-- 
You received this message because you are subscribed to the Google Groups 
"TurboGears" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/turbogears.
For more options, visit https://groups.google.com/d/optout.

Reply via email to