Skip to content

Commit

Permalink
2375 fanstatic autocreate and register libraries
Browse files Browse the repository at this point in the history
  • Loading branch information
tobes committed May 30, 2012
1 parent ee06dad commit b0b3792
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 8 deletions.
14 changes: 10 additions & 4 deletions ckan/html_resources/__init__.py
Expand Up @@ -30,7 +30,7 @@
import sys
import ConfigParser

from fanstatic import Library, Resource, Group
from fanstatic import Library, Resource, Group, get_library_registry
from ckan.include.rjsmin import jsmin
from ckan.include.rcssmin import cssmin

Expand Down Expand Up @@ -136,8 +136,14 @@ def create_resource(filename):
setattr(module, group_name, group)
# finally add the library to this module
setattr(module, name, library)
# add to fanstatic
registry = get_library_registry()
registry.add(library)


# create our library here
create_library('javascript', 'javascript')
create_library('css', 'css')
# create our libraries here from any subdirectories
for dirname, dirnames, filenames in os.walk(os.path.dirname(__file__)):
if dirname == os.path.dirname(__file__):
continue
lib_name = os.path.basename(dirname)
create_library(lib_name, lib_name)
4 changes: 0 additions & 4 deletions setup.py
Expand Up @@ -110,10 +110,6 @@
[ckan.system_plugins]
domain_object_mods = ckan.model.modification:DomainObjectModificationExtension
[fanstatic.libraries]
css = html_resources:css
javascript = html_resources:javascript
[babel.extractors]
ckan = ckan.lib.extract:extract_ckan
""",
Expand Down

0 comments on commit b0b3792

Please sign in to comment.