Make Djblets Extension Template Loader Usable immediately after enabling an extension
Review Request #3907 — Created Feb. 23, 2013 and discarded
Note: This partially reverts Mike Conley's patch (Rev: 4fc4092) that was done couple years ago. Immediately after enabling an extension (Before restart), the djblets extension template loader uses pkg_resources.ResourceLoader.resource_string, which for some reason throws a "NoneType is not callable" exception. Upon restart, everything is fine as Django will add it to the app_directories loader but it doesnt seem to load immediately. This patch reverts parts of mikeconley's patch (rev: 4fc4092) that uses the ResourceLoader to load the resource_string. Instead directly calling pkg_resources.resource_string seems to work just fine. Tested this with Python 2.7 and a few extensions and was able to load the templates immediately after enabling them. With manager.resource_string, I was getting a "NoneType is not callable".
Tested with couple of extensions that use Templates. Enabled the extension and Loading the templates works fine. Tested after restart as well.
Should be up by the pkg_resources. Can we not just hasattr(pkg_resources, 'resource_string') below? Under what conditions do we not have …
You said this is tested with Python 2.7, but we'll need to see testing for 2.5/2.6 as well, since we need to claim compatibility with these versions. The possible non-existence of resource_string concerns me.
djblets/extensions/loaders.py (Diff revision 1)
Should be up by the pkg_resources. Can we not just hasattr(pkg_resources, 'resource_string') below? Under what conditions do we not have this? We should document this in a comment.