-
Notifications
You must be signed in to change notification settings - Fork 92
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
HamlPy cannot run from library.zip #149
Comments
This patch effectively disables wrapping for all Django template loaders at HamlPy module load time when Django modules do not reside on file system: === modified file 'hamlpy/template/utils.py'
--- hamlpy/template/utils.py 2013-05-09 01:59:39 +0000
+++ hamlpy/template/utils.py 2013-10-02 08:18:29 +0000
@@ -1,6 +1,6 @@
import imp
from os import listdir
-from os.path import dirname, splitext
+from os.path import dirname, isdir, splitext
try:
from django.template import loaders
@@ -25,7 +25,10 @@
def package_contents(package):
package_path = dirname(loaders.__file__)
- contents = set([splitext(module)[0]
- for module in listdir(package_path)
- if module.endswith(MODULE_EXTENSIONS)])
+ if isdir(package_path):
+ contents = set([splitext(module)[0]
+ for module in listdir(package_path)
+ if module.endswith(MODULE_EXTENSIONS)])
+ else:
+ contents = set()
return contents With this change, one cannot import an arbitrary Django loader from Loaders |
By the way, I think more Pythonic approach would be to provide a way for explicit wrapping of needed loaders (in a way similar to what Django cached loader does) and not automatically create wrappers for everything we can find on a file system. |
HamlPy fails to load when an application is run from a packed Python library, such as one produced by py2exe:
The text was updated successfully, but these errors were encountered: