changeset 13:ab0c2bb4d23d

* get the templates in the correct way
author k0s <k0scist@gmail.com>
date Fri, 25 Dec 2009 04:20:21 -0500
parents 9f91acf9874c
children 4ca2530f8be1
files decoupage/templates/index.html decoupage/web.py setup.py
diffstat 3 files changed, 16 insertions(+), 7 deletions(-) [+]
line wrap: on
line diff
--- a/decoupage/templates/index.html	Fri Dec 25 02:59:47 2009 -0500
+++ b/decoupage/templates/index.html	Fri Dec 25 04:20:21 2009 -0500
@@ -5,7 +5,7 @@
       xmlns:py="http://genshi.edgewall.org/"
       xmlns:xi="http://www.w3.org/2001/XInclude">
   <head>
-    <title>${path}</title>
+    <title>${title or path}</title>
   </head>
   <body>
     <ul>
--- a/decoupage/web.py	Fri Dec 25 02:59:47 2009 -0500
+++ b/decoupage/web.py	Fri Dec 25 04:20:21 2009 -0500
@@ -97,7 +97,8 @@
 
         # build data dictionary
         files = self.filedata(path, directory, conf)
-        data = {'path': path, 'files': files, 'request': request}
+        data = {'path': path, 'files': files, 'request': request }
+        data['title'] = conf.get('/title')
 
         # apply formatters
         # XXX this should be cached if not self.auto_reload
@@ -123,10 +124,18 @@
                 template = os.path.join(directory, 'index.html')
             else:
                 template = self.template
-        if not os.path.isabs(template):
-            template = os.path.join(directory, template)
-        if not os.path.exists(template):
-            template = self.template
+        else:
+            if not os.path.isabs(template):
+                _template = os.path.join(directory, template)
+                if os.path.exists(_template):
+                    template = _template
+                else:
+                    for directory in self.template_directories:
+                        if template in os.listdir(directory):
+                            break
+                    else:
+                        raise IOError("template %s not found" % template)
+                
         template = self.loader.load(template)
         res = template.generate(**data).render('html', doctype='html')
         return self.get_response(res)
--- a/setup.py	Fri Dec 25 02:59:47 2009 -0500
+++ b/setup.py	Fri Dec 25 04:20:21 2009 -0500
@@ -6,7 +6,7 @@
 except IOError:
     description = ''
 
-version = '0.3.3'
+version = '0.3.4'
 
 setup(name='decoupage',
       version=version,