diff options
| author | Michael Merickel <michael@merickel.org> | 2011-07-12 00:38:59 -0500 |
|---|---|---|
| committer | Michael Merickel <michael@merickel.org> | 2011-07-14 19:56:44 -0500 |
| commit | 2e3a01d35413debcaf0081d17b48cfc5c74a6d59 (patch) | |
| tree | 01895d4b788339aec3a3d58863c4d3dca58df940 | |
| parent | 54376af6ae324606a96bbc92629cfb2b0b375e12 (diff) | |
| download | pyramid-2e3a01d35413debcaf0081d17b48cfc5c74a6d59.tar.gz pyramid-2e3a01d35413debcaf0081d17b48cfc5c74a6d59.tar.bz2 pyramid-2e3a01d35413debcaf0081d17b48cfc5c74a6d59.zip | |
Just changed some of the docstrings to reference config_uri.
| -rw-r--r-- | pyramid/paster.py | 47 |
1 files changed, 24 insertions, 23 deletions
diff --git a/pyramid/paster.py b/pyramid/paster.py index a5cd63dfb..08a54001c 100644 --- a/pyramid/paster.py +++ b/pyramid/paster.py @@ -17,17 +17,17 @@ zope.deprecation.deprecated( 'pyramid.scaffolds.PyramidTemplate in Pyramid 1.1'), ) -def get_app(config_file, name=None, loadapp=loadapp): +def get_app(config_uri, name=None, loadapp=loadapp): """ Return the WSGI application named ``name`` in the PasteDeploy - config file ``config_file``. + config file specified by ``config_uri``. If the ``name`` is None, this will attempt to parse the name from - the ``config_file`` string expecting the format ``ini_file#name``. + the ``config_uri`` string expecting the format ``inifile#name``. If no name is found, the name will default to "main".""" - if '#' in config_file: - path, section = config_file.split('#', 1) + if '#' in config_uri: + path, section = config_uri.split('#', 1) else: - path, section = config_file, 'main' + path, section = config_uri, 'main' if name: section = name config_name = 'config:%s' % path @@ -56,18 +56,19 @@ class PShellCommand(PCommand): This command accepts one positional argument: - ``config_file#section_name`` -- specifies the PasteDeploy config file - to use for the interactive shell. If the section_name is left off, + ``config_uri`` -- specifies the PasteDeploy config file to use for the + interactive shell. The format is ``inifile#name``. If the name is left off, ``main`` will be assumed. Example:: $ 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 Pyramid app without any middleware wrapping, or this - command will almost certainly fail. + .. note:: If you do not point the loader directly at the section of the + ini file containing your :app:`Pyramid` application, the + command will attempt to find the app for you. If you are + loading a pipeline that contains more than one :app:`Pyramid` + application within it, the loader will use the last one. """ summary = "Open an interactive shell with a Pyramid application loaded" @@ -106,10 +107,10 @@ class PShellCommand(PCommand): IPShell = None cprt = 'Type "help" for more information.' banner = "Python %s on %s\n%s" % (sys.version, sys.platform, cprt) - app_spec = self.args[0] - config_file = app_spec.split('#', 1)[0] + config_uri = self.args[0] + config_file = config_uri.split('#', 1)[0] self.logging_file_config(config_file) - app = self.get_app(app_spec, loadapp=self.loadapp[0]) + app = self.get_app(config_uri, loadapp=self.loadapp[0]) # load default globals shell_globals = { @@ -184,8 +185,8 @@ class PRoutesCommand(PCommand): This command accepts one positional argument: - ``config_file#section_name`` -- specifies the PasteDeploy config file - to use for the interactive shell. If the section_name is left off, + ``config_uri`` -- specifies the PasteDeploy config file to use for the + interactive shell. The format is ``inifile#name``. If the name is left off, ``main`` will be assumed. Example:: @@ -218,8 +219,8 @@ class PRoutesCommand(PCommand): from pyramid.interfaces import IViewClassifier from pyramid.interfaces import IView from zope.interface import Interface - app_spec = self.args[0] - app = self.get_app(app_spec, loadapp=self.loadapp[0]) + config_uri = self.args[0] + app = self.get_app(config_uri, loadapp=self.loadapp[0]) registry = app.registry mapper = self._get_mapper(app) if mapper is not None: @@ -253,8 +254,8 @@ class PViewsCommand(PCommand): This command accepts two positional arguments: - ``config_file#section_name`` -- specifies the PasteDeploy config file - to use for the interactive shell. If the section_name is left off, + ``config_uri`` -- specifies the PasteDeploy config file to use for the + interactive shell. The format is ``inifile#name``. If the name is left off, ``main`` will be assumed. ``url`` -- specifies the URL that will be used to find matching views. @@ -465,10 +466,10 @@ class PViewsCommand(PCommand): self.out("%sview predicates (%s)" % (indent, predicate_text)) def command(self): - app_spec, url = self.args + config_uri, url = self.args if not url.startswith('/'): url = '/%s' % url - app = self.get_app(app_spec, loadapp=self.loadapp[0]) + app = self.get_app(config_uri, loadapp=self.loadapp[0]) registry = app.registry view = self._find_view(url, registry) self.out('') |
