Skip to content

Commit

Permalink
Add nodes dir to templateLookup for slightly less awful local templat…
Browse files Browse the repository at this point in the history
…e inclusion. Fix NoResource import path
  • Loading branch information
brendonh committed Oct 2, 2012
1 parent b80acd4 commit 9e2c1a2
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 13 deletions.
12 changes: 2 additions & 10 deletions warp/crud/render.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand All @@ -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(),
Expand Down Expand Up @@ -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
Expand Down
7 changes: 4 additions & 3 deletions warp/webserver/resource.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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)

Expand Down

0 comments on commit 9e2c1a2

Please sign in to comment.