Skip to content

Commit

Permalink
Merge branch 'master' of github.com:Pylons/pyramid
Browse files Browse the repository at this point in the history
  • Loading branch information
bbangert committed Oct 29, 2010
2 parents 17e70c8 + 71ff103 commit 8b0d7ce
Show file tree
Hide file tree
Showing 25 changed files with 159 additions and 105 deletions.
9 changes: 9 additions & 0 deletions CHANGES.txt
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,9 @@ Features (delta from BFG 1.3.X)
paster templates. An import of ``pyramid.view.bfg_view``, however,
will continue to work "forever".

- New API methods in ``pyramid.session``: ``signed_serialize`` and
``signed_deserialize``.

Documentation (delta from BFG 1.3)
-----------------------------------

Expand Down Expand Up @@ -81,3 +84,9 @@ Backwards Incompatibilities (with BFG 1.3.X)
- The literal pattern ``{<anything>}`` is no longer permitted in route
patterns (due to the addition of squiggly route pattern syntax
support).

- The ``bfgshell`` paster command is now named ``pshell``.

- The Venusian "category" for all built-in Venusian decorators
(e.g. ``subscriber`` and ``view_config``/``bfg_view``) is now
``pyramid`` instead of ``bfg``.
18 changes: 12 additions & 6 deletions TODO.txt
Original file line number Diff line number Diff line change
Expand Up @@ -66,16 +66,12 @@

- .flash API on session.

- Signed_signature method of the request and response from pylons2.

- Provide a webob.Response class facade for forward compat.

- CRSF token machinery

- Mako docs (in templating chapter).

- Paster template that has Mako.

- ``add_handler`` documentation.

- ``handler`` ZCML directive.
Expand All @@ -86,6 +82,16 @@

- Maybe make renderer globals lookup send an event?

- bfgshell

- ``docs`` directory for each paster template.

- bfg.routes.matchdict and bfg.routes.route

- repoze.bfg.auth_tkt

- bfg_locale_name

- bfg_localizer

- __bfg_abspath__

- "BFG" in environ variables.
5 changes: 5 additions & 0 deletions docs/api/session.rst
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,8 @@

.. autofunction:: InsecureCookieSessionFactoryConfig

.. autofunction:: signed_serialize

.. autofunction:: signed_deserialize


4 changes: 2 additions & 2 deletions docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,7 @@ def raw(*arg):
#html_file_suffix = ''

# Output file base name for HTML help builder.
htmlhelp_basename = 'repozebfg'
htmlhelp_basename = 'pyramid'

# Options for LaTeX output
# ------------------------
Expand All @@ -174,7 +174,7 @@ def raw(*arg):
# Grouping the document tree into LaTeX files. List of tuples
# (source start file, target name, title, author, document class [howto/manual]).
latex_documents = [
('latexindex', 'repozebfg.tex',
('latexindex', 'pyramid.tex',
'The Pyramid Web Application Development Framework',
'Chris McDonough', 'manual'),
]
Expand Down
1 change: 0 additions & 1 deletion docs/glossary.rst
Original file line number Diff line number Diff line change
Expand Up @@ -572,7 +572,6 @@ Glossary
of code in a package.

configuration decoration

Metadata implying one or more :term:`configuration declaration`
invocations. Often set by configuration Python :term:`decorator`
attributes, such as :class:`pyramid.view.view_config`, aka
Expand Down
40 changes: 20 additions & 20 deletions docs/narr/project.rst
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ project we name ``MyProject``:
$ bin/paster create -t pyramid_starter
Selected and implied templates:
pyramid#bfg pyramid starter project
pyramid#pyramid_starter pyramid starter project
Enter project name: MyProject
Variables:
Expand Down Expand Up @@ -223,18 +223,18 @@ the ``pyramid_starter`` template, a single sample test exists.
.. index::
single: interactive shell
single: IPython
single: paster bfgshell
single: paster pshell

The Interactive Shell
---------------------

Once you've installed your program for development using ``setup.py
develop``, you can use an interactive Python shell to examine your
:mod:`pyramid` application :term:`model` and :term:`view` objects
from a Python prompt. To do so, use the ``paster`` shell command with
the ``bfgshell`` argument:
:mod:`pyramid` application :term:`model` and :term:`view` objects from
a Python prompt. To do so, use the ``paster`` shell command with the
``pshell`` argument:

The first argument to ``bfgshell`` is the path to your application's
The first argument to ``pshell`` is the path to your application's
``.ini`` file. The second is the section name inside the ``.ini``
file which points to your *application* as opposed to any other
section within the ``.ini`` file. For example, if your application
Expand All @@ -256,37 +256,37 @@ the name ``main`` as a section name:

.. code-block:: text
[chrism@vitaminf bfgshellenv]$ ../bin/paster --plugin=pyramid bfgshell \
MyProject.ini main
[chrism@vitaminf shellenv]$ ../bin/paster --plugin=pyramid \
pshell MyProject.ini main
Python 2.4.5 (#1, Aug 29 2008, 12:27:37)
[GCC 4.0.1 (Apple Inc. build 5465)] on darwin
Type "help" for more information. "root" is the BFG app root object.
Type "help" for more information. "root" is the Pyramid app root object.
>>> root
<foo.models.MyModel object at 0x445270>
.. note:: You *might* get away without passing
``--plugin=pyramid`` to the bfgshell command.
``--plugin=pyramid`` to the ``pshell`` command.

If you have `IPython <http://en.wikipedia.org/wiki/IPython>`_
installed in the interpreter you use to invoke the ``paster`` command,
the ``bfgshell`` command will use an IPython interactive shell instead
the ``pshell`` command will use an IPython interactive shell instead
of a standard Python interpreter shell. If you don't want this to
happen, even if you have IPython installed, you can pass the
``--disable-ipython`` flag to the ``bfgshell`` command to use a
standard Python interpreter shell unconditionally.
``--disable-ipython`` flag to the ``pshell`` command to use a standard
Python interpreter shell unconditionally.

.. code-block:: text
[chrism@vitaminf bfgshellenv]$ ../bin/paster --plugin=pyramid bfgshell \
[chrism@vitaminf shellenv]$ ../bin/paster --plugin=pyramid pshell \
--disable-ipython MyProject.ini main
You should always use a section name argument that refers to the
actual ``app`` section within the Paste configuration file that points
at your :mod:`pyramid` application *without any middleware
wrapping*. In particular, a section name is inappropriate as the
second argument to "bfgshell" if the configuration section it names is
a ``pipeline`` rather than an ``app``. For example, if you have the
following ``.ini`` file content:
at your :mod:`pyramid` application *without any middleware wrapping*.
In particular, a section name is inappropriate as the second argument
to ``pshell`` if the configuration section it names is a ``pipeline``
rather than an ``app``. For example, if you have the following
``.ini`` file content:

.. code-block:: ini
:linenos:
Expand All @@ -307,7 +307,7 @@ The command you use to invoke the interactive shell should be:

.. code-block:: text
[chrism@vitaminf bfgshellenv]$ ../bin/paster --plugin=pyramid bfgshell \
[chrism@vitaminf shellenv]$ ../bin/paster --plugin=pyramid pshell \
MyProject.ini myapp
If you use ``main`` as the section name argument instead of ``myapp``
Expand Down
2 changes: 1 addition & 1 deletion docs/narr/views.rst
Original file line number Diff line number Diff line change
Expand Up @@ -1502,7 +1502,7 @@ See :ref:`view_directive` for complete ZCML directive documentation.
.. _mapping_views_using_a_decorator_section:

View Configuration Using the ``@view_config`` Decorator
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

For better locality of reference, you may use the
:class:`pyramid.view.view_config` decorator to associate your view
Expand Down
6 changes: 3 additions & 3 deletions docs/tutorials/catalog/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -78,12 +78,12 @@ want the application to be based on :term:`traversal`.
return root['site']
#. We'll demonstrate how you might interact with a catalog from code
by manipulating the database directly using the ``bfgshell``
by manipulating the database directly using the ``pshell``
command in a terminal window:

.. code-block:: text
[chrism@snowpro sess]$ ../bin/paster --plugin=pyramid bfgshell \
[chrism@snowpro sess]$ ../bin/paster --plugin=pyramid pshell \
myapp.ini myapp
Python 2.5.4 (r254:67916, Sep 4 2009, 02:12:16)
[GCC 4.2.1 (Apple Inc. build 5646)] on darwin
Expand All @@ -103,7 +103,7 @@ As you need them, add other indexes required by your application to
the catalog by modifying the ``update_indexes`` method of the ``Site``
object. Whenever an index is added or removed, invoke the
``update_indexes`` method of the site (the root object) from a script
or from within a ``bfgshell`` session to update the set of indexes
or from within a ``pshell`` session to update the set of indexes
used by your application.

In :term:`view` code, you should be able to get a hold of the root
Expand Down
4 changes: 2 additions & 2 deletions docs/tutorials/zeo/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -218,13 +218,13 @@ Running
about the application has changed.

#. You can manipulate the database directly (even when the
application's HTTP server is running) by using the ``bfgshell``
application's HTTP server is running) by using the ``pshell``
command in a third terminal window:

.. code-block:: text
:linenos:
[chrism@snowpro sess]$ ../bin/paster --plugin=pyramid bfgshell \
[chrism@snowpro sess]$ ../bin/paster --plugin=pyramid pshell \
myapp.ini myapp
Python 2.5.4 (r254:67916, Sep 4 2009, 02:12:16)
[GCC 4.2.1 (Apple Inc. build 5646)] on darwin
Expand Down
24 changes: 12 additions & 12 deletions pyramid/configuration.py
Original file line number Diff line number Diff line change
Expand Up @@ -1576,10 +1576,10 @@ def scan(self, package=None, categories=None, _info=u''):
:class:`pyramid.view.view_config``. If this is not desirable
because the codebase has other Venusian-using decorators that
aren't meant to be invoked during a particular scan, use
``('bfg',)`` as a ``categories`` value to limit the execution
``('pyramid',)`` as a ``categories`` value to limit the execution
of decorator callbacks to only those registered by
:mod:`pyramid` itself. Or pass a sequence of Venusian scan
categories as necessary (e.g. ``('bfg', 'myframework')``) to
categories as necessary (e.g. ``('pyramid', 'myframework')``) to
limit the decorators called to the set of categories required.
"""
package = self.maybe_dotted(package)
Expand Down Expand Up @@ -1917,7 +1917,7 @@ def add_static_view(self, name, path, **kw):
The ``name`` argument to ``add_static_view`` is usually a
:term:`view name`. When this is the case, the
:func:`pyramid.url.static_url` API will generate a URL
which points to a BFG view, which will serve up a set of
which points to a Pyramid view, which will serve up a set of
resources that live in the package itself. For example:
.. code-block:: python
Expand All @@ -1935,7 +1935,7 @@ def add_static_view(self, name, path, **kw):
that represents a simple view name, as it is above, subsequent
calls to :func:`pyramid.url.static_url` with paths that
start with the ``path`` argument passed to ``add_static_view``
will generate a URL something like ``http://<BFG app
will generate a URL something like ``http://<Pyramid app
URL>/images/logo.png``, which will cause the ``logo.png`` file
in the ``images`` subdirectory of the ``mypackage`` package to
be served.
Expand Down Expand Up @@ -2446,7 +2446,7 @@ def _map_view(view, attr=None, renderer_name=None, registry=None,
if requestonly(view, attr):
# its __init__ accepts only a single request argument,
# instead of both context and request
def _bfg_class_requestonly_view(context, request):
def _class_requestonly_view(context, request):
inst = view(request)
if attr is None:
response = inst()
Expand All @@ -2459,10 +2459,10 @@ def _bfg_class_requestonly_view(context, request):
response = helper.render_to_response(response, system,
request=request)
return response
wrapped_view = _bfg_class_requestonly_view
wrapped_view = _class_requestonly_view
else:
# its __init__ accepts both context and request
def _bfg_class_view(context, request):
def _class_view(context, request):
inst = view(context, request)
if attr is None:
response = inst()
Expand All @@ -2475,12 +2475,12 @@ def _bfg_class_view(context, request):
response = helper.render_to_response(response, system,
request=request)
return response
wrapped_view = _bfg_class_view
wrapped_view = _class_view

elif requestonly(view, attr):
# its __call__ accepts only a single request argument,
# instead of both context and request
def _bfg_requestonly_view(context, request):
def _requestonly_view(context, request):
if attr is None:
response = view(request)
else:
Expand All @@ -2493,10 +2493,10 @@ def _bfg_requestonly_view(context, request):
response = helper.render_to_response(response, system,
request=request)
return response
wrapped_view = _bfg_requestonly_view
wrapped_view = _requestonly_view

elif attr:
def _bfg_attr_view(context, request):
def _attr_view(context, request):
response = getattr(view, attr)(context, request)
if helper is not None:
if not is_response(response):
Expand All @@ -2505,7 +2505,7 @@ def _bfg_attr_view(context, request):
response = helper.render_to_response(response, system,
request=request)
return response
wrapped_view = _bfg_attr_view
wrapped_view = _attr_view

elif helper is not None:
def _rendered_view(context, request):
Expand Down
2 changes: 1 addition & 1 deletion pyramid/events.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ def register(self, scanner, name, wrapped):
config.add_subscriber(wrapped, self.ifaces)

def __call__(self, wrapped):
self.venusian.attach(wrapped, self.register, category='bfg')
self.venusian.attach(wrapped, self.register, category='pyramid')
return wrapped

class NewRequest(object):
Expand Down
2 changes: 1 addition & 1 deletion pyramid/interfaces.py
Original file line number Diff line number Diff line change
Expand Up @@ -244,7 +244,7 @@ class ISettings(Interface):
interface."""

# this interface, even if it becomes unused within Pyramid, is
# imported by other packages (such as repoze.bfg.traversalwrapper)
# imported by other packages (such as traversalwrapper)
class ILocation(Interface):
"""Objects that have a structural location"""
__parent__ = Attribute("The parent in the location hierarchy")
Expand Down
12 changes: 7 additions & 5 deletions pyramid/paster.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ def get_app(config_file, name, loadapp=loadapp):
return app

_marker = object()
class BFGShellCommand(Command):
class PShellCommand(Command):
"""Open an interactive shell with a :mod:`pyramid` app loaded.
This command accepts two positional arguments:
Expand All @@ -66,19 +66,19 @@ class BFGShellCommand(Command):
Example::
$ paster bfgshell myapp.ini main
$ paster pshell myapp.ini main
.. note:: You should use a ``section_name`` that refers to the
actual ``app`` section in the config file that points at
your BFG app without any middleware wrapping, or this
your Pyramid app without any middleware wrapping, or this
command will almost certainly fail.
"""
summary = "Open an interactive shell with a pyramid app loaded"

min_args = 2
max_args = 2
group_name = 'bfg'
group_name = 'pyramid'

parser = Command.standard_parser(simulate=True)
parser.add_option('-d', '--disable-ipython',
Expand All @@ -104,7 +104,7 @@ def command(self, IPShell=_marker):
from IPython.Shell import IPShell
except ImportError: #pragma no cover
IPShell = None
cprt =('Type "help" for more information. "root" is the BFG app '
cprt =('Type "help" for more information. "root" is the Pyramid app '
'root object.')
banner = "Python %s on %s\n%s" % (sys.version, sys.platform, cprt)
config_file, section_name = self.args
Expand All @@ -123,3 +123,5 @@ def command(self, IPShell=_marker):
self.interact[0](banner, local={'root':root})
finally:
closer()

BFGShellCommand = PShellCommand # b/w compat forever
Loading

0 comments on commit 8b0d7ce

Please sign in to comment.