Turbogears2 migration: API calls
Alessandro Molina
alessandro.molina at gmail.com
Mon Aug 29 08:54:36 UTC 2016
On Mon, Aug 29, 2016 at 10:44 AM, Thomas De Schampheleire <
patrickdepinguin at gmail.com> wrote:
> >
> > - Routing, Kallithea is probably the only TG2 app using routes as the
> core
> > dispatch system. This is probably not going away unless all controllers
> are
> > rewritten using ObjectDispatch. But as using tgext.routes as the main
> > dispatch system should be possible I tend to think that Kallithea should
> not
> > be forced to change this and I can work to fix any problems that arise.
>
> To use ObjectDispatch, we'd need extensive usage of the _lookup method
> inside the controller, is that correct?
> http://turbogears.readthedocs.io/en/latest/turbogears/
> objectdispatch.html#the-lookup-method
Most controllers are just dispatched based on their method name, so it
shouldn't be required.
For REST like uris ( /collection/ID/action ) or that dispatch based on HTTP
method those can be satisfied by subclassing from RestController
But again, I think this shouldn't be required as using tgext.routes as the
main dispatch system must work :D
So I'll try to fix any dispatch related issue we might find.
> > - Assigning to **self**, this is pretty widespread in Kallithea
>
> Can you give examples from the Kallithea source code? In the
> controllers I only find three files that have assignments to self:
> feed.py, api/__init__.py, journal.py.
>
I noticed in BaseController that it's done in a few places:
self.cut_off_limit = safe_int(config.get('cut_off_limit'))
self.sa = meta.Session
self.scm_model = ScmModel(self.sa)
And as you stated also in API is done.
I remember I created some properties to work-around such behaviour and
provide backward compatibility from code that read ip_addr and authuser
@property
def ip_addr(self):
return c.ip_addr
@property
def authuser(self):
return c.authuser
but many more are probable set around the code.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.sfconservancy.org/pipermail/kallithea-general/attachments/20160829/80f37237/attachment.html>
More information about the kallithea-general
mailing list