# HG changeset patch # User Jeff Hammel # Date 1319689307 25200 # Node ID ac1dc088e37e52206ba5fc505163275172e26721 # Parent 613ffeec2be58b9103b0320a06828d9dc91c6ece add inclusion template diff -r 613ffeec2be5 -r ac1dc088e37e decoupage.ini --- a/decoupage.ini Wed Dec 15 09:30:32 2010 -0800 +++ b/decoupage.ini Wed Oct 26 21:21:47 2011 -0700 @@ -21,3 +21,4 @@ paste.app_factory = decoupage.factory:factory decoupage.directory = %(here)s/example decoupage.configuration = %(here)s/example.ini +decoupage.auto_reload = True \ No newline at end of file diff -r 613ffeec2be5 -r ac1dc088e37e decoupage/formatters.py --- a/decoupage/formatters.py Wed Dec 15 09:30:32 2010 -0800 +++ b/decoupage/formatters.py Wed Oct 26 21:21:47 2011 -0700 @@ -204,6 +204,7 @@ path = request.path_info if (path != '/') and self.up: data['files'].insert(0, {'path': '..', + 'type': 'directory', 'name': path.rsplit('/', 1)[0] + '/', 'description': self.up}) diff -r 613ffeec2be5 -r ac1dc088e37e decoupage/templates/inclusion.html --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/decoupage/templates/inclusion.html Wed Oct 26 21:21:47 2011 -0700 @@ -0,0 +1,24 @@ + + + + + + + + +

${title}

+ + + +
+ + ${file(filepath(f['name'])).read()} + # +
+ + + diff -r 613ffeec2be5 -r ac1dc088e37e decoupage/templates/index.html --- a/decoupage/templates/index.html Wed Dec 15 09:30:32 2010 -0800 +++ b/decoupage/templates/index.html Wed Oct 26 21:21:47 2011 -0700 @@ -4,6 +4,7 @@ + diff -r 613ffeec2be5 -r ac1dc088e37e decoupage/web.py --- a/decoupage/web.py Wed Dec 15 09:30:32 2010 -0800 +++ b/decoupage/web.py Wed Oct 26 21:21:47 2011 -0700 @@ -156,6 +156,9 @@ files = self.filedata(path, directory, conf) data = {'path': path, 'files': files, 'request': request } + # add a function to get the path to files + data['filepath'] = lambda *segments: os.path.join(*([directory] + list(segments))) + # defaults; TODO: make this better # there shouldn't need to be defaults; # iirc, genshi has a mode where these will default to None @@ -208,8 +211,8 @@ if os.path.exists(_template): template = _template else: - for directory in self.template_directories: - if template in os.listdir(directory): + for _directory in self.template_directories: + if template in os.listdir(_directory): break else: raise IOError("template %s not found" % template) diff -r 613ffeec2be5 -r ac1dc088e37e example/inclusion/cat.txt --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/example/inclusion/cat.txt Wed Oct 26 21:21:47 2011 -0700 @@ -0,0 +1,1 @@ +cat diff -r 613ffeec2be5 -r ac1dc088e37e example/inclusion/dog.txt --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/example/inclusion/dog.txt Wed Oct 26 21:21:47 2011 -0700 @@ -0,0 +1,1 @@ +dog diff -r 613ffeec2be5 -r ac1dc088e37e example/inclusion/index.ini --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/example/inclusion/index.ini Wed Oct 26 21:21:47 2011 -0700 @@ -0,0 +1,2 @@ +/template = inclusion.html +/ignore = index.ini \ No newline at end of file diff -r 613ffeec2be5 -r ac1dc088e37e example/inclusion/monster.txt --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/example/inclusion/monster.txt Wed Oct 26 21:21:47 2011 -0700 @@ -0,0 +1,1 @@ +monster diff -r 613ffeec2be5 -r ac1dc088e37e setup.py --- a/setup.py Wed Dec 15 09:30:32 2010 -0800 +++ b/setup.py Wed Oct 26 21:21:47 2011 -0700 @@ -6,7 +6,7 @@ except IOError: description = '' -version = '0.10.1' +version = '0.10.2' setup(name='decoupage', version=version,