Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added in fles to get Djaml into the CheeseShop
- Loading branch information
Chris Hartjes
committed
Mar 24, 2011
1 parent
20bdb5a
commit c21906d
Showing
11 changed files
with
91 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
*.pyc |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
from loaders import haml_loaders as _loaders | ||
|
||
locals().update(_loaders) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
from django.template import TemplateDoesNotExist | ||
|
||
from hamlpy import hamlpy | ||
|
||
from utils import get_django_template_loaders | ||
|
||
def get_haml_loader(loader): | ||
if hasattr(loader, 'Loader'): | ||
baseclass = loader.Loader | ||
else: | ||
class baseclass(object): | ||
def load_template_source(self, *args, **kwargs): | ||
return loader.load_template_source(*args, **kwargs) | ||
|
||
class Loader(baseclass): | ||
def load_template_source(self, template_name, *args, **kwargs): | ||
if not template_name.endswith('.haml'): | ||
raise TemplateDoesNotExist(template_name) | ||
|
||
haml_source, template_path = super(Loader, self).load_template_source(template_name, *args, **kwargs) | ||
hamlParser = hamlpy.Compiler() | ||
html = hamlParser.process(haml_source) | ||
|
||
return html, template_path | ||
|
||
load_template_source.is_usable = True | ||
|
||
return Loader | ||
|
||
haml_loaders = dict((name, get_haml_loader(loader)) | ||
for (name, loader) in get_django_template_loaders()) | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
import imp | ||
from os import listdir | ||
from os.path import dirname, splitext | ||
|
||
from django.template import loaders | ||
|
||
MODULE_EXTENSIONS = tuple([suffix[0] for suffix in imp.get_suffixes()]) | ||
|
||
def get_django_template_loaders(): | ||
return [(loader.__name__.rsplit('.',1)[1], loader) | ||
for loader in get_submodules(loaders) | ||
if hasattr(loader, 'load_template_source')] | ||
|
||
def get_submodules(package): | ||
submodules = ("%s.%s" % (package.__name__, module) | ||
for module in package_contents(package)) | ||
return [__import__(module, {}, {}, [module.rsplit(".", 1)[-1]]) | ||
for module in submodules] | ||
|
||
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)]) | ||
return contents |
Binary file not shown.
Binary file not shown.
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
Metadata-Version: 1.0 | ||
Name: djaml | ||
Version: 1.0 | ||
Summary: A Django template loader for loading and converting HamlPy markup to HTML | ||
Home-page: http://github.com/chartjes/djaml/ | ||
Author: Chris Hartjes | ||
Author-email: UNKNOWN | ||
License: MIT | ||
Description: | ||
Djaml is a template loader for Django that allows you to use HamlPy for markup. | ||
|
||
Keywords: django haml hamlpy | ||
Platform: UNKNOWN | ||
Classifier: License :: OSI Approved :: MIT License | ||
Classifier: Programming Language :: Python | ||
Classifier: Environment :: Web Environment | ||
Classifier: Intended Audience :: Developers | ||
Classifier: Operating System :: OS Independent | ||
Classifier: Topic :: Internet :: WWW/HTTP | ||
Classifier: Topic :: Utilities |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
setup.py | ||
djaml/__init__.py | ||
djaml/loaders.py | ||
djaml/utils.py | ||
djaml.egg-info/PKG-INFO | ||
djaml.egg-info/SOURCES.txt | ||
djaml.egg-info/dependency_links.txt | ||
djaml.egg-info/top_level.txt |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
djaml |
c21906d
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What are the /build/lib/djaml files, and why do they differ from the stuff in /djaml?