Turbogears2 migration: API calls
Thomas De Schampheleire
patrickdepinguin at gmail.com
Mon Aug 22 18:06:07 UTC 2016
Hi Alessandro,
On Sat, Jul 30, 2016 at 10:01 PM, Thomas De Schampheleire
<patrickdepinguin at gmail.com> wrote:
> Hi,
>
> API calls currently do not work under Turbogears2.
>
> The simplest call is:
>
> ../venv/kallithea-tg-clean/bin/kallithea-api
> --apikey=811a4ad6f382e75c20392b668cad9408bde9f42e
> --apihost=http://localhost:5000 test
>
> (where apikey can be obtained from the web UI, after logging in, going
> to 'My account' via you user name top right, then API keys.)
>
> This call is supposed to finally end up in the 'test' method in
> kallithea/controllers/api/api.py.
> However, the command fails with 500 Server Error, and on server side:
>
> Traceback (most recent call last):
> File "/home/tdescham/repo/contrib/kallithea/venv/kallithea-tg-clean/lib/python2.7/site-packages/tg/wsgiapp.py",
> line 120, in __call__
> response = self.wrapped_dispatch(controller, environ, context)
> File "/home/tdescham/repo/contrib/kallithea/venv/kallithea-tg-clean/lib/python2.7/site-packages/tg/appwrappers/errorpage.py",
> line 56, in __call__
> resp = self.next_handler(controller, environ, context)
> File "/home/tdescham/repo/contrib/kallithea/venv/kallithea-tg-clean/lib/python2.7/site-packages/tg/appwrappers/caching.py",
> line 54, in __call__
> return self.next_handler(controller, environ, context)
> File "/home/tdescham/repo/contrib/kallithea/venv/kallithea-tg-clean/lib/python2.7/site-packages/tg/appwrappers/session.py",
> line 71, in __call__
> response = self.next_handler(controller, environ, context)
> File "/home/tdescham/repo/contrib/kallithea/venv/kallithea-tg-clean/lib/python2.7/site-packages/tg/appwrappers/i18n.py",
> line 71, in __call__
> return self.next_handler(controller, environ, context)
> File "/home/tdescham/repo/contrib/kallithea/venv/kallithea-tg-clean/lib/python2.7/site-packages/tg/wsgiapp.py",
> line 285, in _dispatch
> return controller(environ, context)
> File "/home/tdescham/repo/contrib/kallithea/kallithea-tg-clean/kallithea/lib/base.py",
> line 461, in __call__
> return super(BaseController, self).__call__(environ, context)
> File "/home/tdescham/repo/contrib/kallithea/venv/kallithea-tg-clean/lib/python2.7/site-packages/tg/controllers/dispatcher.py",
> line 119, in __call__
> response = self._perform_call(context)
> File "/home/tdescham/repo/contrib/kallithea/venv/kallithea-tg-clean/lib/python2.7/site-packages/tg/controllers/dispatcher.py",
> line 99, in _perform_call
> state = self._get_dispatchable(context, py_request.quoted_path_info)
> File "/home/tdescham/repo/contrib/kallithea/venv/kallithea-tg-clean/lib/python2.7/site-packages/tg/controllers/dispatcher.py",
> line 73, in _get_dispatchable
> state = state.resolve()
> File "/home/tdescham/repo/contrib/kallithea/venv/kallithea-tg-clean/lib/python2.7/site-packages/crank/dispatchstate.py",
> line 178, in resolve
> return self._root_dispatcher._dispatch(self, self._path)
> File "/home/tdescham/repo/contrib/kallithea/venv/kallithea-tg-clean/lib/python2.7/site-packages/tgext/routes/dispatch.py",
> line 146, in _dispatch
> action = getattr(controller, action_name)
> AttributeError: 'ApiController' object has no attribute 'index'
>
>
> So the routing tries to access an index method.
>
> In the API code, the JSONRPCController parent class of ApiController
> is supposed to direct the calls to the correct method, but it seems we
> do not enter that class.
>
> Alessandro, would you have some time to have a look?
>
> I have seen in the TG2 documentation that typical, recommended, usage
> is different than what Kallithea is doing, and I think we should
> investigate if we can adapt our code base to such best practices
> eventually, but in the short term I think we should try to make the
> existing code base work.
This is a gentle reminder in case you missed this mail,
Thanks,
Thomas
More information about the kallithea-general
mailing list