pkraus
unread,Feb 13, 2012, 12:03:52 PM2/13/12Sign in to reply to author
Sign in to forward
You do not have permission to delete messages in this group
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to turbo...@googlegroups.com
I have a controller method that needs to return json if its an ajax request (from jquery get,post,ajax) or return a template.
@expose('json')
@expose('erp.templates.search.customer')
def customer(self,query,came_from,search_type):
log.debug("(%s) %s"%(search_type,query))
if search_type == 'query':
pass
elif search_type == 'by_id':
customer = m_ar.Customer.by_code(query)
override_template(Search.customer,'json:')
return {'customer_id':customer.customer_id}
return dict(customers = customers)
This doesn't work. I am not sure i need the override but without it the actual genshi template is returned. Without i get errors about identity not being able to translate into json.
How should I best go about this? I could split this into two methods search at call time i know if its json i want or the template however i am still curious about how this could work.
PK