Should be something like:
from tg.decorators import override_template
@expose('erp.templates.search.customer_search')
def customer_search(self,customer_query):
results = do_search_stuff(customer_query)
if some_condition:
override_template(self, 'erp.templates.search.newtemplate')
return dict(results = results)
-Chris
On Fri, Jan 20, 2012 at 1:10 PM, pkraus <[email protected]> wrote:
> I have a search controller that has a customer_search method that uses a
> specific template.
>
> The content is loaded via ajax load calls in may different parts of my
> application. The controller method is the same as all it does is perform a
> search and return the results however depending on what part of my
> application is doing the search I need to change the view of those results.
> I could do this with a huge single genshi template but for maintenance and
> code sanity it makes sense to me to just have multiple views running of the
> single controller method.
>
> @expose('erp.templates.search.customer_search') <--- I would like to be
> able to change this
> def customer_search(self,customer_query):
> results = do_search_stuff(customer_query)
> return dict(results = results)
>
> For instance depending on where the app is called I might need the results
> returned via json, or a different genshi template that displays the results
> in a more meaningful way depending on where the results were called from.
>
> Reading the forum I found a solution but it was for tg1 and based in kid
> it said to just return tg_template in the dictionary. This doesn't work and
> it doesn't solve the problem for when would need to return json.
>
> Thoughts?
>
> --Just a suggestion, but there might be some value in having a tg2 and tg1
> group so that searching can yield more specific results.
>
> --
> You received this message because you are subscribed to the Google Groups
> "TurboGears" group.
> To view this discussion on the web visit
> https://groups.google.com/d/msg/turbogears/-/_a_TnwwszaYJ.
> 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/turbogears?hl=en.
>
--
Christopher Lambacher
[email protected]
--
You received this message because you are subscribed to the Google Groups
"TurboGears" 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/turbogears?hl=en.