Skip to content

Commit

Permalink
- The bfgshell paster command is now named pshell.
Browse files Browse the repository at this point in the history
  • Loading branch information
mcdonc committed Oct 29, 2010
1 parent bba6d8b commit 6a3184b
Show file tree
Hide file tree
Showing 7 changed files with 43 additions and 35 deletions.
6 changes: 6 additions & 0 deletions CHANGES.txt
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,6 @@ 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``.

40 changes: 20 additions & 20 deletions docs/narr/project.rst
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
6 changes: 3 additions & 3 deletions docs/tutorials/catalog/index.rst
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
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
12 changes: 7 additions & 5 deletions pyramid/paster.py
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
8 changes: 4 additions & 4 deletions pyramid/tests/test_paster.py
@@ -1,12 +1,12 @@
import unittest

class TestBFGShellCommand(unittest.TestCase):
class TestPShellCommand(unittest.TestCase):
def _getTargetClass(self):
from pyramid.paster import BFGShellCommand
return BFGShellCommand
from pyramid.paster import PShellCommand
return PShellCommand

def _makeOne(self):
return self._getTargetClass()('bfgshell')
return self._getTargetClass()('pshell')

def test_command_ipython_disabled(self):
command = self._makeOne()
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Expand Up @@ -86,7 +86,7 @@
pylons_minimal=pyramid.paster:PylonsMinimalProjectTemplate
pylons_sqla=pyramid.paster:PylonsSQLAlchemyProjectTemplate
[paste.paster_command]
pyramid_shell=pyramid.paster:BFGShellCommand
pshell=pyramid.paster:PShellCommand
[console_scripts]
bfg2pyramid = pyramid.fixers.fix_bfg_imports:main
"""
Expand Down

0 comments on commit 6a3184b

Please sign in to comment.