# HG changeset patch # User k0s # Date 1265647257 18000 # Node ID e384d4569ac307b6f06b5047beaa99593c118a45 # Parent 983c13e1b71f00df2ce509af9f63b75891d1b670 include components necessary to make decoupage feel almost like a framework diff -r 983c13e1b71f -r e384d4569ac3 decoupage/formatters.py --- a/decoupage/formatters.py Mon Feb 08 11:10:54 2010 -0500 +++ b/decoupage/formatters.py Mon Feb 08 11:40:57 2010 -0500 @@ -143,6 +143,22 @@ def __call__(self, request, data): data['css'] = self.css +class JavaScript(object): + """specify JS for the page""" + + def __init__(self, arg): + self.scripts = arg.split() + def __call__(self, request, data): + data['scripts'] = self.scripts + +class Favicon(object): + """specify favicons for the page""" + + def __init__(self, icon): + self.icon = icon + def __call__(self, request, data): + data['icon'] = self.icon + class Include(object): """include a file at the top of the body""" diff -r 983c13e1b71f -r e384d4569ac3 decoupage/templates/index.html --- a/decoupage/templates/index.html Mon Feb 08 11:10:54 2010 -0500 +++ b/decoupage/templates/index.html Mon Feb 08 11:40:57 2010 -0500 @@ -6,7 +6,10 @@ xmlns:xi="http://www.w3.org/2001/XInclude"> ${title or path} + + + @@ -17,10 +20,11 @@ ${f.get('title', f['description']) or f['name']}: ${f['description']} - - ${link['text']} + + + ${link['text']} + diff -r 983c13e1b71f -r e384d4569ac3 decoupage/web.py --- a/decoupage/web.py Mon Feb 08 11:10:54 2010 -0500 +++ b/decoupage/web.py Mon Feb 08 11:40:57 2010 -0500 @@ -1,5 +1,5 @@ """ -decoupage: a view with webob +decoupage: a view with webob to index and serve static content """ import os @@ -102,13 +102,17 @@ # get the configuraton conf = self.conf(path) - # build data dictionary + ### build data dictionary files = self.filedata(path, directory, conf) data = {'path': path, 'files': files, 'request': request } + + # defaults; TODO: make this better data['title'] = conf.get('/title') data['directory'] = directory data['include'] = None data['css'] = () + data['scripts'] = () + data['icon'] = None # apply formatters # XXX this should be cached if not self.auto_reload diff -r 983c13e1b71f -r e384d4569ac3 setup.py --- a/setup.py Mon Feb 08 11:10:54 2010 -0500 +++ b/setup.py Mon Feb 08 11:40:57 2010 -0500 @@ -6,7 +6,7 @@ except IOError: description = '' -version = '0.5.2' +version = '0.6' setup(name='decoupage', version=version, @@ -42,11 +42,13 @@ all = decoupage.formatters:All css = decoupage.formatters:CSS describe = decoupage.formatters:FilenameDescription + icon = decoupage.formatters:Favicon ignore = decoupage.formatters:Ignore include = decoupage.formatters:Include links = decoupage.formatters:Links + scripts = decoupage.formatter:JavaScript + sort = decoupage.formatters:Sort title = decoupage.formatters:TitleDescription - sort = decoupage.formatters:Sort """, )