ckan / ckanext-dcat

CKAN ♥ DCAT
163 stars 142 forks source link

Why is ckanext.dcat defined as namespace package? #107

Closed metaodi closed 6 years ago

metaodi commented 6 years ago

Currently the setup.py defines ckanext.dcat as a namespace package, but I would propose to remove it.

We extend the DCATPlugin in our own extension, and because the DCATPlugin extends the DefaultTranslation it tries to find the i18n folder of dcat in our extensions. Therefore we wanted to simply override this by implementing the i18n_directory with the following to load the "original" i18n directory of this extension:

 def i18n_directory(self):
        extension_module_name = 'ckanext.dcat'
        module = sys.modules[extension_module_name]
        return os.path.join(os.path.dirname(module.__file__), 'i18n')

check the original implementation for reference.

But because "ckanext.dcat" is declared as a namesapce package, it loses certain properties like __file__, as it is possible to contribute to this namespace from different places (just like ckanext). So the above code does not work.

I don't think this is a desired behavior and makes extending this extension actually harder.