Odoo 12 getting TypeError on while trying to access models record from record

I am trying to make a simple controller that returns a json object in Odoo 12 using Python. I have been following several tutorials, yet I keep getting the same error every time I try to use env['product.template']. Here is my controller code.

import odoo.http as http
from odoo import SUPERUSER_ID
from odoo import registry as registry_get
from odoo.api import Environment
import json


class Controller(http.Controller):

    @http.route('/test', type='http', auth='public', website=False)
    def handler(self):
        registry = registry_get('ceres')
        with registry.cursor() as cr:
            env = Environment(cr, SUPERUSER_ID, {})
            attendee = env['product.template'].sudo().search([])
        return attendee 

and here is the exception i recieve while calling the controller :

2021-01-25 08:43:08,686 5912 ERROR ceres werkzeug: Error on request:
Traceback (most recent call last):
  File "C:UsersSofianeDesktopOdoo12pythonlibsite-packageswerkzeugserving.py", line 205, in run_wsgi
    execute(self.server.app)
  File "C:UsersSofianeDesktopOdoo12pythonlibsite-packageswerkzeugserving.py", line 193, in execute
    application_iter = app(environ, start_response)
  File "C:UsersSofianeDesktopOdoo12serverodooserviceserver.py", line 342, in app
    return self.app(e, s)
  File "C:UsersSofianeDesktopOdoo12serverodooservicewsgi_server.py", line 128, in application
    return application_unproxied(environ, start_response)
  File "C:UsersSofianeDesktopOdoo12serverodooservicewsgi_server.py", line 117, in application_unproxied
    result = odoo.http.root(environ, start_response)
  File "C:UsersSofianeDesktopOdoo12serverodoohttp.py", line 1317, in __call__
    return self.dispatch(environ, start_response)
  File "C:UsersSofianeDesktopOdoo12serverodoohttp.py", line 1290, in __call__
    return self.app(environ, start_wrapped)
  File "C:UsersSofianeDesktopOdoo12pythonlibsite-packageswerkzeugwsgi.py", line 599, in __call__
    return self.app(environ, start_response)
  File "C:UsersSofianeDesktopOdoo12serverodoohttp.py", line 1490, in dispatch
    return response(environ, start_response)
TypeError: 'product.template' object is not callable - - -

Answer

you need to return html response

from odoo.http import request
import odoo.http as http
from odoo import SUPERUSER_ID
from odoo import registry as registry_get
from odoo.api import Environment
import json


class Controller(http.Controller):

    @http.route('/test', type='http', auth='public', website=False)
    def handler(self):
        registry = registry_get('ceres')
        with registry.cursor() as cr:
            env = Environment(cr, SUPERUSER_ID, {})
            attendee = env['product.template'].sudo().search([])
        response = request.make_response(attendee)
        return response