[ckan-dev] imports

Adrià Mercader amercadero at gmail.com
Mon Mar 26 11:40:30 UTC 2012


This looks really sensible and they are great guidelines.

I don't know if you are aware of this ticket created by Sean a while ago:
http://trac.ckan.org/ticket/1740

One minor comment though:
On 26 March 2012 12:06, Toby Dacre <toby.okfn at gmail.com> wrote:
> It is also nice to import things from the correct places eg why `from base
> import _` when we could use `from pylons.i18n import _`
Perhaps this is useful if it at some point in the future we decide to
move away from pylons, paster or whatever external library we are
"proxying" through lib.base, because that would mean that we only have
to create a new function there, instead of changing all the imports
throughout the code.
Also in cases like json where you need to load different libraries
depending on the python version it is more convenient to have
ckan.lib.base do the checking instead of checking for ImportErrors
every time you want to import it

But as you said, maybe importing the explicit stuff outweighs these
points (Explicit is better than implicit etc...)


Adrià




More information about the ckan-dev mailing list