Merge branch 'master' of github.com:samuelclay/NewsBlur

* 'master' of github.com:samuelclay/NewsBlur:
  Forcing Jammit asset path to be absolute, relative to configured directory.
This commit is contained in:
Samuel Clay 2012-01-14 18:55:07 -08:00
commit 89002d9bc6
2 changed files with 6 additions and 3 deletions

View file

@ -480,4 +480,4 @@ MONGODB = connect(MONGO_DB.pop('name'), **MONGO_DB)
REDIS_POOL = redis.ConnectionPool(host=REDIS['host'], port=6379, db=0)
JAMMIT = jammit.JammitAssets()
JAMMIT = jammit.JammitAssets(NEWSBLUR_DIR)

View file

@ -12,19 +12,22 @@ class JammitAssets:
ASSET_FILENAME = 'assets.yml'
def __init__(self):
def __init__(self, assets_dir):
"""
Initializes the Jammit object by reading the assets.yml file and
stores all javascripts and stylesheets in memory for easy lookup
in templates.
"""
self.assets_dir = assets_dir
self.assets = self.read_assets()
def read_assets(self):
"""
Read the assets from the YAML and store it as a lookup dictionary.
"""
f = open(self.ASSET_FILENAME, 'r')
filepath = os.path.join(self.assets_dir, self.ASSET_FILENAME)
print filepath
f = open(filepath, 'r')
return yaml.load(f.read())
def render_tags(self, asset_type, asset_package):