summaryrefslogtreecommitdiff
path: root/repoze/bfg/paster_template/+package+
diff options
context:
space:
mode:
authorTres Seaver <tseaver@palladion.com>2009-01-06 21:19:28 +0000
committerTres Seaver <tseaver@palladion.com>2009-01-06 21:19:28 +0000
commitd14697efd4fb13a929c16dc9a03648c3f8b0de11 (patch)
tree6ca56e5cee1acbeb16b5cf36993b9cd6cebbe90e /repoze/bfg/paster_template/+package+
parentc002a35d31647edb337f4e7498447707d9ef2737 (diff)
downloadpyramid-d14697efd4fb13a929c16dc9a03648c3f8b0de11.tar.gz
pyramid-d14697efd4fb13a929c16dc9a03648c3f8b0de11.tar.bz2
pyramid-d14697efd4fb13a929c16dc9a03648c3f8b0de11.zip
Prepare for additional paster templates.
Diffstat (limited to 'repoze/bfg/paster_template/+package+')
-rw-r--r--repoze/bfg/paster_template/+package+/__init__.py2
-rw-r--r--repoze/bfg/paster_template/+package+/configure.zcml11
-rw-r--r--repoze/bfg/paster_template/+package+/models.py7
-rw-r--r--repoze/bfg/paster_template/+package+/run.py_tmpl13
-rw-r--r--repoze/bfg/paster_template/+package+/templates/mytemplate.pt7
-rw-r--r--repoze/bfg/paster_template/+package+/tests.py_tmpl74
-rw-r--r--repoze/bfg/paster_template/+package+/views.py_tmpl5
7 files changed, 0 insertions, 119 deletions
diff --git a/repoze/bfg/paster_template/+package+/__init__.py b/repoze/bfg/paster_template/+package+/__init__.py
deleted file mode 100644
index cbdfd3ac6..000000000
--- a/repoze/bfg/paster_template/+package+/__init__.py
+++ /dev/null
@@ -1,2 +0,0 @@
-# A package
-
diff --git a/repoze/bfg/paster_template/+package+/configure.zcml b/repoze/bfg/paster_template/+package+/configure.zcml
deleted file mode 100644
index 584dee906..000000000
--- a/repoze/bfg/paster_template/+package+/configure.zcml
+++ /dev/null
@@ -1,11 +0,0 @@
-<configure xmlns="http://namespaces.repoze.org/bfg">
-
- <!-- this must be included for the view declarations to work -->
- <include package="repoze.bfg.includes" />
-
- <view
- for=".models.MyModel"
- view=".views.my_view"
- />
-
-</configure>
diff --git a/repoze/bfg/paster_template/+package+/models.py b/repoze/bfg/paster_template/+package+/models.py
deleted file mode 100644
index a37762ff4..000000000
--- a/repoze/bfg/paster_template/+package+/models.py
+++ /dev/null
@@ -1,7 +0,0 @@
-class MyModel(object):
- pass
-
-root = MyModel()
-
-def get_root(environ):
- return root
diff --git a/repoze/bfg/paster_template/+package+/run.py_tmpl b/repoze/bfg/paster_template/+package+/run.py_tmpl
deleted file mode 100644
index 0f714f7c7..000000000
--- a/repoze/bfg/paster_template/+package+/run.py_tmpl
+++ /dev/null
@@ -1,13 +0,0 @@
-from repoze.bfg.router import make_app
-from repoze.bfg.registry import get_options
-
-def app(global_config, **kw):
- """ This function returns a repoze.bfg.router.Router object. It
- is usually called by the PasteDeploy framework during ``paster
- serve``"""
- # paster app config callback
- from {{package}}.models import get_root
- import {{package}}
- options = get_options(kw)
- return make_app(get_root, {{package}}, options=options)
-
diff --git a/repoze/bfg/paster_template/+package+/templates/mytemplate.pt b/repoze/bfg/paster_template/+package+/templates/mytemplate.pt
deleted file mode 100644
index a7affedf9..000000000
--- a/repoze/bfg/paster_template/+package+/templates/mytemplate.pt
+++ /dev/null
@@ -1,7 +0,0 @@
-<html xmlns="http://www.w3.org/1999/xhtml"
- xmlns:tal="http://xml.zope.org/namespaces/tal">
-<head></head>
-<body>
- <h1>Welcome to ${project}</h1>
-</body>
-</html>
diff --git a/repoze/bfg/paster_template/+package+/tests.py_tmpl b/repoze/bfg/paster_template/+package+/tests.py_tmpl
deleted file mode 100644
index ee4050b95..000000000
--- a/repoze/bfg/paster_template/+package+/tests.py_tmpl
+++ /dev/null
@@ -1,74 +0,0 @@
-import unittest
-
-from zope.testing.cleanup import cleanUp
-from repoze.bfg import testing
-
-class ViewTests(unittest.TestCase):
-
- """ These tests are unit tests for the view. They test the
- functionality of *only* the view. They register and use dummy
- implementations of repoze.bfg functionality to allow you to avoid
- testing 'too much'"""
-
- def setUp(self):
- """ cleanUp() is required to clear out the application registry
- between tests (done in setUp for good measure too)
- """
- cleanUp()
-
- def tearDown(self):
- """ cleanUp() is required to clear out the application registry
- between tests
- """
- cleanUp()
-
- def test_my_view(self):
- from {{package}}.views import my_view
- context = testing.DummyModel()
- request = testing.DummyRequest()
- renderer = testing.registerDummyRenderer('templates/mytemplate.pt')
- response = my_view(context, request)
- self.assertEqual(renderer.project, '{{project}}')
-
-class ViewIntegrationTests(unittest.TestCase):
- """ These tests are integration tests for the view. These test
- the functionality the view *and* its integration with the rest of
- the repoze.bfg framework. They cause the entire environment to be
- set up and torn down as if your application was running 'for
- real'. This is a heavy-hammer way of making sure that your tests
- have enough context to run properly, and it tests your view's
- integration with the rest of BFG. You should not use this style
- of test to perform 'true' unit testing as tests will run faster
- and will be easier to write if you use the testing facilities
- provided by bfg and only the registrations you need, as in the
- above ViewTests.
- """
- def setUp(self):
- """ This sets up the application registry with the
- registrations your application declares in its configure.zcml
- (including dependent registrations for repoze.bfg itself).
- """
- cleanUp()
- import {{package}}
- import zope.configuration.xmlconfig
- zope.configuration.xmlconfig.file('configure.zcml',
- package={{package}})
-
- def tearDown(self):
- """ Clear out the application registry """
- cleanUp()
-
- def test_my_view(self):
- from {{package}}.views import my_view
- context = testing.DummyModel()
- request = testing.DummyRequest()
- result = my_view(context, request)
- self.assertEqual(result.status, '200 OK')
- body = result.app_iter[0]
- self.failUnless('Welcome to {{project}}' in body)
- self.assertEqual(len(result.headerlist), 2)
- self.assertEqual(result.headerlist[0],
- ('content-type', 'text/html; charset=UTF-8'))
- self.assertEqual(result.headerlist[1], ('Content-Length',
- str(len(body))))
-
diff --git a/repoze/bfg/paster_template/+package+/views.py_tmpl b/repoze/bfg/paster_template/+package+/views.py_tmpl
deleted file mode 100644
index 8a2836171..000000000
--- a/repoze/bfg/paster_template/+package+/views.py_tmpl
+++ /dev/null
@@ -1,5 +0,0 @@
-from repoze.bfg.chameleon_zpt import render_template_to_response
-
-def my_view(context, request):
- return render_template_to_response('templates/mytemplate.pt',
- project = '{{project}}')