From 13846e641d9c6f7be65ac535c0a31fcf1f538267 Mon Sep 17 00:00:00 2001 From: Michael Merickel Date: Sun, 31 Jan 2016 01:41:10 -0600 Subject: minor tweaks --- docs/tutorials/wiki2/installation.rst | 18 +++++++++--------- .../alchemy/+package+/scripts/initializedb.py | 7 +++---- pyramid/scaffolds/alchemy/+package+/tests.py_tmpl | 4 ++-- .../scaffolds/alchemy/+package+/views/default.py_tmpl | 4 ++-- pyramid/scaffolds/alchemy/MANIFEST.in_tmpl | 2 +- pyramid/scaffolds/alchemy/production.ini_tmpl | 2 -- 6 files changed, 17 insertions(+), 20 deletions(-) diff --git a/docs/tutorials/wiki2/installation.rst b/docs/tutorials/wiki2/installation.rst index 1385ab8c7..960eec861 100644 --- a/docs/tutorials/wiki2/installation.rst +++ b/docs/tutorials/wiki2/installation.rst @@ -94,11 +94,11 @@ Install SQLite3 and its development packages If you used a package manager to install your Python or if you compiled your Python from source, then you must install SQLite3 and its development packages. If you downloaded your Python as an installer -from python.org, then you already have it installed and can proceed to -the next section :ref:`sql_making_a_project`.. +from https://www.python.org, then you already have it installed and can +proceed to the next section :ref:`sql_making_a_project`. If you need to install the SQLite3 packages, then, for example, using -the Debian system and apt-get, the command would be the following: +the Debian system and ``apt-get``, the command would be the following: .. code-block:: text @@ -133,8 +133,8 @@ the :term:`scaffold` named ``alchemy`` which generates an application that uses :term:`SQLAlchemy` and :term:`URL dispatch`. :app:`Pyramid` supplies a variety of scaffolds to generate sample -projects. We will use `pcreate`—a script that comes with Pyramid to -quickly and easily generate scaffolds, usually with a single command—to +projects. We will use `pcreate` — a script that comes with Pyramid to +quickly and easily generate scaffolds, usually with a single command — to create the scaffold for our project. By passing `alchemy` into the `pcreate` command, the script creates @@ -225,7 +225,7 @@ For a successful test run, you should see output that ends like this:: . ---------------------------------------------------------------------- Ran 1 test in 0.094s - + OK Expose test coverage information @@ -383,8 +383,8 @@ This means the server is ready to accept requests. Visit the application in a browser ================================== -In a browser, visit `http://localhost:6543/ `_. You -will see the generated application's default page. +In a browser, visit http://localhost:6543/. You will see the generated +application's default page. One thing you'll notice is the "debug toolbar" icon on right hand side of the page. You can read more about the purpose of the icon at @@ -401,7 +401,7 @@ assumptions: - you are willing to use :term:`URL dispatch` to map URLs to code -- you want to use ``ZopeTransactionExtension`` and ``pyramid_tm`` to scope +- you want to use ``zope.sqlalchemy`` and ``pyramid_tm`` to scope sessions to requests .. note:: diff --git a/pyramid/scaffolds/alchemy/+package+/scripts/initializedb.py b/pyramid/scaffolds/alchemy/+package+/scripts/initializedb.py index f0d09729e..4f9711d93 100644 --- a/pyramid/scaffolds/alchemy/+package+/scripts/initializedb.py +++ b/pyramid/scaffolds/alchemy/+package+/scripts/initializedb.py @@ -15,7 +15,7 @@ from ..models.meta import ( get_engine, get_dbmaker, ) -from ..models.mymodel import MyModel +from ..models import MyModel def usage(argv): @@ -34,12 +34,11 @@ def main(argv=sys.argv): settings = get_appsettings(config_uri, options=options) engine = get_engine(settings) - dbmaker = get_dbmaker(engine) + Base.metadata.create_all(engine) + dbmaker = get_dbmaker(engine) dbsession = get_session(transaction.manager, dbmaker) - Base.metadata.create_all(engine) - with transaction.manager: model = MyModel(name='one', value=1) dbsession.add(model) diff --git a/pyramid/scaffolds/alchemy/+package+/tests.py_tmpl b/pyramid/scaffolds/alchemy/+package+/tests.py_tmpl index 074c7a773..963377b78 100644 --- a/pyramid/scaffolds/alchemy/+package+/tests.py_tmpl +++ b/pyramid/scaffolds/alchemy/+package+/tests.py_tmpl @@ -36,7 +36,7 @@ class BaseTest(unittest.TestCase): testing.tearDown() transaction.abort() - Base.metadata.create_all(self.engine) + Base.metadata.drop_all(self.engine) class TestMyViewSuccessCondition(BaseTest): @@ -45,7 +45,7 @@ class TestMyViewSuccessCondition(BaseTest): super(TestMyViewSuccessCondition, self).setUp() self.init_database() - from .models.mymodel import MyModel + from .models import MyModel model = MyModel(name='one', value=55) self.session.add(model) diff --git a/pyramid/scaffolds/alchemy/+package+/views/default.py_tmpl b/pyramid/scaffolds/alchemy/+package+/views/default.py_tmpl index 43fb33e05..7bf0026e5 100644 --- a/pyramid/scaffolds/alchemy/+package+/views/default.py_tmpl +++ b/pyramid/scaffolds/alchemy/+package+/views/default.py_tmpl @@ -3,7 +3,7 @@ from pyramid.view import view_config from sqlalchemy.exc import DBAPIError -from ..models.mymodel import MyModel +from ..models import MyModel @view_config(route_name='home', renderer='../templates/mytemplate.jinja2') @@ -12,7 +12,7 @@ def my_view(request): query = request.dbsession.query(MyModel) one = query.filter(MyModel.name == 'one').first() except DBAPIError: - return Response(db_err_msg, content_type='text/plain', status_int=500) + return Response(db_err_msg, content_type='text/plain', status=500) return {'one': one, 'project': '{{project}}'} diff --git a/pyramid/scaffolds/alchemy/MANIFEST.in_tmpl b/pyramid/scaffolds/alchemy/MANIFEST.in_tmpl index 0ff6eb7a0..f93f45544 100644 --- a/pyramid/scaffolds/alchemy/MANIFEST.in_tmpl +++ b/pyramid/scaffolds/alchemy/MANIFEST.in_tmpl @@ -1,2 +1,2 @@ include *.txt *.ini *.cfg *.rst -recursive-include {{package}} *.ico *.png *.css *.gif *.jpg *.pt *.txt *.mak *.mako *.js *.html *.xml +recursive-include {{package}} *.ico *.png *.css *.gif *.jpg *.jinja2 *.pt *.txt *.mak *.mako *.js *.html *.xml diff --git a/pyramid/scaffolds/alchemy/production.ini_tmpl b/pyramid/scaffolds/alchemy/production.ini_tmpl index 022bc0b7b..4d9f835d4 100644 --- a/pyramid/scaffolds/alchemy/production.ini_tmpl +++ b/pyramid/scaffolds/alchemy/production.ini_tmpl @@ -11,8 +11,6 @@ pyramid.debug_authorization = false pyramid.debug_notfound = false pyramid.debug_routematch = false pyramid.default_locale_name = en -pyramid.includes = - pyramid_tm sqlalchemy.url = sqlite:///%(here)s/{{project}}.sqlite -- cgit v1.2.3