Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Add nodes dir to templateLookup for slightly less awful local templat…

…e inclusion. Fix NoResource import path
  • Loading branch information...
commit 9e2c1a22def81fb5967e629ad7e070f218328fae 1 parent b80acd4
@brendonh authored
Showing with 6 additions and 13 deletions.
  1. +2 −10 warp/crud/render.py
  2. +4 −3 warp/webserver/resource.py
View
12 warp/crud/render.py
@@ -6,7 +6,7 @@
except ImportError:
import simplejson as json
-from twisted.web.error import NoResource
+from twisted.web.resource import NoResource
from twisted.web import static
from storm.locals import Desc, Reference
@@ -47,6 +47,7 @@ def renderTemplate(self, request, templatePath):
crud=self.crudModel(obj),
subTemplate=templatePath)
+
def renderLocalTemplate(self, request, filename):
# Get a path to the local template relative to
@@ -60,7 +61,6 @@ def renderLocalTemplate(self, request, filename):
return self.renderTemplate(request, templatePath)
-
def render_index(self, request):
return helpers.renderTemplateObj(request,
self._getListTemplate(),
@@ -123,20 +123,12 @@ def render_list_json(self, request):
def _getListTemplate(self):
if 'crudListTemplate' not in internal:
internal['crudListTemplate'] = templateLookup.get_template('/crud/wrapper.mak')
- # internal['crudListTemplate'] = Template(
- # '<%inherit file="/site.mak" /><%include file="/crud/list.mak" />',
- # lookup=templateLookup,
- # output_encoding="utf-8")
return internal['crudListTemplate']
def _getViewTemplate(self):
if 'crudTemplate' not in internal:
internal['crudTemplate'] = templateLookup.get_template('/crud/wrapper.mak')
- # internal['crudTemplate'] = Template(
- # '<%inherit file="/site.mak" /><%include file="/crud/crud.mak" />',
- # lookup=templateLookup,
- # output_encoding="utf-8")
return internal['crudTemplate']
_getEditTemplate = _getViewTemplate
View
7 warp/webserver/resource.py
@@ -6,8 +6,7 @@
from twisted.python import util
from twisted.python.filepath import FilePath, InsecurePath
-from twisted.web.resource import IResource
-from twisted.web.error import NoResource
+from twisted.web.resource import IResource, NoResource
from twisted.web import static
from warp.common import access, translate
@@ -33,7 +32,9 @@ def __init__(self):
siteTemplateDir = config['siteDir'].child("templates").path
warpTemplateDir = self.warpTemplatePath.path
- templateLookup.__init__(directories=[siteTemplateDir, warpTemplateDir], output_encoding="utf-8")
+ nodeDir = config['siteDir'].child("nodes").path
+ templateLookup.__init__(directories=[siteTemplateDir, warpTemplateDir, nodeDir],
+ output_encoding="utf-8")
handle_login = config.get('loginHandler', self.handle_login)
Please sign in to comment.
Something went wrong with that request. Please try again.