summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--CHANGES.txt5
-rw-r--r--docs/api/push.rst9
-rw-r--r--docs/index.rst1
-rw-r--r--repoze/bfg/push.py40
-rw-r--r--repoze/bfg/tests/test_integration.py41
-rw-r--r--repoze/bfg/tests/test_push.py40
-rw-r--r--setup.py2
7 files changed, 6 insertions, 132 deletions
diff --git a/CHANGES.txt b/CHANGES.txt
index 30e11ee96..b49d0f204 100644
--- a/CHANGES.txt
+++ b/CHANGES.txt
@@ -124,6 +124,11 @@ Removals
Backwards Incompatibilities
---------------------------
+- Moved the ``repoze.bfg.push`` module, which implemented the ``pushpage``
+ decorator, into a separate distribution, ``repoze.bfg.pushpage``.
+ Applications which used this decorator should continue to work after
+ adding that distribution to their installation requirements.
+
- Changing the default request factory via an IRequestFactory utility
registration (as used to be documented in the "Hooks" chapter's
"Changing the request factory" section) is no longer supported. The
diff --git a/docs/api/push.rst b/docs/api/push.rst
deleted file mode 100644
index 38c0971a0..000000000
--- a/docs/api/push.rst
+++ /dev/null
@@ -1,9 +0,0 @@
-.. _push_module:
-
-:mod:`repoze.bfg.push`
---------------------------
-
-.. automodule:: repoze.bfg.push
-
- .. autoclass:: pushpage
-
diff --git a/docs/index.rst b/docs/index.rst
index 0e42a6b75..a20f51d9f 100644
--- a/docs/index.rst
+++ b/docs/index.rst
@@ -58,7 +58,6 @@ Per-module :mod:`repoze.bfg` API documentation.
api/interfaces
api/location
api/paster
- api/push
api/router
api/scripting
api/security
diff --git a/repoze/bfg/push.py b/repoze/bfg/push.py
deleted file mode 100644
index 1e60b7e94..000000000
--- a/repoze/bfg/push.py
+++ /dev/null
@@ -1,40 +0,0 @@
-import os.path
-
-from repoze.bfg.chameleon_zpt import render_template_to_response
-
-try:
- from functools import wraps
-except ImportError: #pragma NO COVERAGE
- # < 2.5
- from repoze.bfg.functional import wraps #pragma NO COVERAGE
-
-class pushpage(object):
- """
- Decorator for a function which returns a response object after
- running the namespace the wrapped function returns through a
- Chameleon ZPT template.
-
- E.g.::
-
- @pushpage('www/my_template.pt')
- def my_view(context, request):
- return {'a': 1, 'b': ()}
-
- Equates to::
-
- from repoze.bfg.chameleon_zpt import render_template_to_response
- def my_view(context, request):
- return render_template_to_response('www/my_template.pt', a=1, b=())
-
- """
- def __init__(self, template):
- self.template = template
-
- def __call__(self, wrapped):
- prefix = os.path.dirname(wrapped.func_globals['__file__'])
- path = os.path.join(prefix, self.template)
-
- def _curried(context, request):
- kw = wrapped(context, request)
- return render_template_to_response(path, **kw)
- return wraps(wrapped)(_curried) # grokkability
diff --git a/repoze/bfg/tests/test_integration.py b/repoze/bfg/tests/test_integration.py
index 107c8ae89..941d47841 100644
--- a/repoze/bfg/tests/test_integration.py
+++ b/repoze/bfg/tests/test_integration.py
@@ -1,7 +1,6 @@
import os
import unittest
-from repoze.bfg.push import pushpage
from repoze.bfg.wsgi import wsgiapp
from repoze.bfg.view import bfg_view
from repoze.bfg.view import static
@@ -53,46 +52,6 @@ class WGSIAppPlusBFGViewTests(unittest.TestCase):
('registerAdapter',
wsgiapptest, (INothing, IRequest), IView, '', None))
-@bfg_view(for_=INothing)
-@pushpage('fake.pt')
-def pushtest(context, request):
- """ """
- return {'a':1}
-
-class PushPagePlusBFGViewTests(unittest.TestCase):
- def setUp(self):
- cleanUp()
-
- def tearDown(self):
- cleanUp()
-
- def test_it(self):
- import types
- import os
- from repoze.bfg.testing import registerDummyRenderer
- path = os.path.join(os.path.dirname(__file__), 'fake.pt')
- renderer = registerDummyRenderer(path)
- self.assertEqual(pushtest.__is_bfg_view__, True)
- self.failUnless(type(pushtest) is types.FunctionType)
- context = DummyContext()
- request = DummyRequest()
- result = pushtest(context, request)
- self.assertEqual(result.status, '200 OK')
-
- def test_scanned(self):
- from repoze.bfg.interfaces import IView
- from repoze.bfg.zcml import scan
- context = DummyContext()
- from repoze.bfg.tests import test_integration
- scan(context, test_integration)
- actions = context.actions
- self.assertEqual(len(actions), 2)
- action = actions[0]
- IRequest = _getRequestInterface()
- self.assertEqual(action['args'],
- ('registerAdapter',
- pushtest, (INothing, IRequest), IView, '', None))
-
here = os.path.dirname(__file__)
staticapp = static(os.path.join(here, 'fixtures'))
diff --git a/repoze/bfg/tests/test_push.py b/repoze/bfg/tests/test_push.py
deleted file mode 100644
index d5d2801aa..000000000
--- a/repoze/bfg/tests/test_push.py
+++ /dev/null
@@ -1,40 +0,0 @@
-import unittest
-
-from repoze.bfg.testing import cleanUp
-
-class Test_pushpage(unittest.TestCase):
- def setUp(self):
- cleanUp()
-
- def tearDown(self):
- cleanUp()
-
- def _zcmlConfigure(self):
- import repoze.bfg.includes
- import zope.configuration.xmlconfig
- zope.configuration.xmlconfig.file('configure.zcml',
- package=repoze.bfg.includes)
-
- def _getTargetClass(self):
- from repoze.bfg.push import pushpage
- return pushpage
-
- def _makeOne(self, template):
- return self._getTargetClass()(template)
-
- def test_decorated_has_same_name_as_wrapped(self):
- pp = self._makeOne('fixtures/pp.pt')
- wrapped = pp(to_wrap)
- self.assertEqual(wrapped.__name__, 'to_wrap')
- self.assertEqual(wrapped.__module__, to_wrap.__module__)
-
- def test___call___passes_names_from_wrapped(self):
- self._zcmlConfigure()
- pp = self._makeOne('fixtures/pp.pt')
- wrapped = pp(to_wrap)
- response = wrapped(object(), object())
- self.assertEqual(response.body,
- '<p xmlns="http://www.w3.org/1999/xhtml">WRAPPED</p>')
-
-def to_wrap(context, request):
- return {'wrapped': 'WRAPPED'}
diff --git a/setup.py b/setup.py
index aee13805c..766015d42 100644
--- a/setup.py
+++ b/setup.py
@@ -12,7 +12,7 @@
#
##############################################################################
-__version__ = '0.9.1'
+__version__ = '1.0dev'
import os