[ckan-dev] Introducing ckan.common

Toby Dacre toby.okfn at gmail.com
Wed Mar 13 10:39:10 UTC 2013


Hi,

Following https://github.com/okfn/ckan/pull/262 being merged into
master which cleans up imports from lib.helpers

A new file has been added to CKAN
https://github.com/okfn/ckan/blob/master/ckan/common.py
the idea of this file is to help co-ordinate some imported libs
currently this includes:

some parts of pylons (g, c, request, session, response, _, ungettext),
json and OrderedDict

The idea is to avoid all the circular import issues where code is
importing lib.base or lib.helpers just to access json.  This file is
intended to only include external libs and be clean enought that we
can use  `from ckan.common import _, json`.  This is the __only__ file
in ckan that should ever use this syntax (excluding some crap in model
that we are stuck with)

The idea is to reduce our import issues and help create cleaner
simpler code eg OrderedDict is defined in a few different places.  It
will also allow us to change for example the json lib we use easily
across the entire codebase.  This is part of ongoing code base
clean-ups.

Cheers

Toby




More information about the ckan-dev mailing list