summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--CHANGES.txt9
-rw-r--r--TODO.txt2
-rw-r--r--docs/narr/models.rst26
-rw-r--r--pyramid/config.py2
-rw-r--r--pyramid/tests/selfscanapp/__init__.py11
-rw-r--r--pyramid/tests/selfscanapp/another.py6
-rw-r--r--pyramid/tests/test_integration.py20
7 files changed, 61 insertions, 15 deletions
diff --git a/CHANGES.txt b/CHANGES.txt
index 4e4b4f771..62daf79b1 100644
--- a/CHANGES.txt
+++ b/CHANGES.txt
@@ -1,6 +1,15 @@
Next release
============
+Bug Fixes
+---------
+
+- 1.0a5 introduced a bug when ``pyramid.config.Configurator.scan`` was used
+ without a ``package`` argument (e.g. ``config.scan()`` as opposed to
+ ``config.scan('packagename')``. The symptoms were: lots of deprecation
+ warnings printed to the console about imports of deprecated Pyramid
+ functions and classes and non-detection of view callables decorated with
+ ``view_config`` decorators. This has been fixed.
1.0a5 (2010-12-14)
==================
diff --git a/TODO.txt b/TODO.txt
index 8f06d85c5..b95c7ae11 100644
--- a/TODO.txt
+++ b/TODO.txt
@@ -4,6 +4,8 @@ Pyramid TODOs
Must-Have (before 1.0)
----------------------
+- Fix conflict info case for ``scan``.
+
- Narrative docs for ``Configurator.include`` and ``Configurator.commit``.
- Fix session behavior: when a Forbidden/NotFound hander is invoked, we'd
diff --git a/docs/narr/models.rst b/docs/narr/models.rst
index 79286590a..99a2b756d 100644
--- a/docs/narr/models.rst
+++ b/docs/narr/models.rst
@@ -1,9 +1,9 @@
Models
======
-A :term:`model` class is typically a simple Python class defined in a
-module. References to these classes and instances of such classes are
-omnipresent in :app:`Pyramid`:
+A :term:`model` class is typically a simple Python class defined in a module.
+References to these classes and instances of such classes are omnipresent in
+:app:`Pyramid` when :term:`traversal` is used to build an application:
- Model instances make up the object graph that :app:`Pyramid`
will walk over when :term:`traversal` is used.
@@ -14,15 +14,12 @@ omnipresent in :app:`Pyramid`:
- A :term:`root factory` returns a model instance.
-- A model instance is generated as a result of :term:`url dispatch`
- (see the ``factory`` argument to
- :meth:`pyramid.config.Configurator.add_route`).
+- A model instance is exposed to :term:`view` code as the :term:`context` of
+ a view.
-- A model instance is exposed to :term:`view` code as the
- :term:`context` of a view.
-
-Model objects typically store data and offer methods related to
-mutating that data.
+In many :term:`traversal` based applications (particularly ones that use
+Zope-like patterns), model objects often store data and offer methods related
+to mutating that data.
.. note::
@@ -313,9 +310,9 @@ filesystem root directory.
:app:`Pyramid` API Functions That Act Against Models
-------------------------------------------------------
-A model instance is used as the :term:`context` argument provided to a
-view. See :ref:`traversal_chapter` and :ref:`urldispatch_chapter` for
-more information about how a model instance becomes the context.
+A model instance is used as the :term:`context` provided to a view. See
+:ref:`traversal_chapter` and :ref:`urldispatch_chapter` for more information
+about how a model instance becomes the context.
The APIs provided by :ref:`traversal_module` are used against model
instances. These functions can be used to find the "path" of a model,
@@ -332,3 +329,4 @@ model object) as one of its arguments; the ACL is obtained from this
model or one of its ancestors. Other APIs in the
:mod:`pyramid.security` module also accept :term:`context` as an
argument, and a context is always a model.
+
diff --git a/pyramid/config.py b/pyramid/config.py
index 1c6d1878c..58e2550da 100644
--- a/pyramid/config.py
+++ b/pyramid/config.py
@@ -1790,7 +1790,7 @@ class Configurator(object):
self.registry.registerUtility(mapper, IRoutesMapper)
return mapper
- @action_method
+ # this is *not* an action method (uses caller_package)
def scan(self, package=None, categories=None):
""" Scan a Python package and any of its subpackages for
objects marked with :term:`configuration decoration` such as
diff --git a/pyramid/tests/selfscanapp/__init__.py b/pyramid/tests/selfscanapp/__init__.py
new file mode 100644
index 000000000..779ea3eed
--- /dev/null
+++ b/pyramid/tests/selfscanapp/__init__.py
@@ -0,0 +1,11 @@
+from pyramid.view import view_config
+
+@view_config(renderer='string')
+def abc(request):
+ return 'root'
+
+def main():
+ from pyramid.config import Configurator
+ c = Configurator()
+ c.scan()
+ return c
diff --git a/pyramid/tests/selfscanapp/another.py b/pyramid/tests/selfscanapp/another.py
new file mode 100644
index 000000000..a30ad3297
--- /dev/null
+++ b/pyramid/tests/selfscanapp/another.py
@@ -0,0 +1,6 @@
+from pyramid.view import view_config
+
+@view_config(name='two', renderer='string')
+def two(request):
+ return 'two'
+
diff --git a/pyramid/tests/test_integration.py b/pyramid/tests/test_integration.py
index 2c8892eef..971c4832e 100644
--- a/pyramid/tests/test_integration.py
+++ b/pyramid/tests/test_integration.py
@@ -267,6 +267,26 @@ class ImperativeIncludeConfigurationTest(unittest.TestCase):
res = self.testapp.get('/three', status=200)
self.failUnless('three' in res.body)
+class SelfScanAppTest(unittest.TestCase):
+ def setUp(self):
+ from pyramid.tests.selfscanapp import main
+ config = main()
+ app = config.make_wsgi_app()
+ from webtest import TestApp
+ self.testapp = TestApp(app)
+ self.config = config
+
+ def tearDown(self):
+ self.config.end()
+
+ def test_root(self):
+ res = self.testapp.get('/', status=200)
+ self.failUnless('root' in res.body)
+
+ def test_two(self):
+ res = self.testapp.get('/two', status=200)
+ self.failUnless('two' in res.body)
+
class DummyContext(object):
pass