I am create controller in OpenERP Framework. Following is my code and i set http.route type="http"
,
import openerp.http as http
from openerp.http import request
class MyController(http.Controller):
@http.route('demo_html', type="http")
def some_html(self):
return "<h1>This is a test</h1>"
Above code work perfect once i login into openerp after i modify URL http://localhost:8069/demo_html
show me return result This is a test
in h1 heading tag.
But same way i try to type="json"
and add following json code and again try to call URL http://localhost:8069/demo_json
Its not work properly and show me error "Internal Server Error"
.
import openerp.http as http
from openerp.http import request
class MyController(http.Controller):
@http.route('demo_html', type="http") // Work Pefrect when I call this URL
def some_html(self):
return "<h1>This is a test</h1>"
@http.route('demo_json', type="json") // Not working when I call this URL
def some_json(self):
return {"sample_dictionary": "This is a sample JSON dictionary"}
So my question is how to route json. Any help would be appreciate Thank you.