[ckan-dev] Recommended practice for supporting both CKAN 1.8 and 2.0 in extensions

Sean Hammond sean.hammond at okfn.org
Wed Jan 16 16:59:39 UTC 2013


Hey all,

This is something we should probably get down in the extensions docs or
on a wiki page before we release 2.0.

If an extension wants to support both 1.x and 2.0, how should it do it?

ckanext-googleanalytics supports both:

https://github.com/okfn/ckanext-googleanalytics

I gave it public, templates and legacy_public and legacy_templates dirs,
and I made it look for the ckan.legacy_templates option in the config
file and tell CKAN which dirs to use accordingly.

But it's not just templates, there can also be Python differences, e.g.
you import and use something that is new in 2.0 then your extension
crashes in 1.8. You could again make the behaviour conditional on the
CKAN version.

But maybe it should be done with the master branch being 2.0 and a
legacy branch for 1.x, and then just put install instructions for both
2.0 and 1.8 (saying to checkout the legacy branch) into the README on
the master branch. The code would be simpler. If you added new features
to the extension you'd have to manually port them to the legacy branch
if you want them to work in 1.x. But I imagine a lot of extensions would
not bother with 1.x support for new features,




More information about the ckan-dev mailing list