Steve Piercy
2016-04-10 f5a9a54e4840be21be9adf365ba15f53267c453c
update basiclayout and its src
9 files modified
85 ■■■■ changed files
docs/tutorials/wiki/basiclayout.rst 31 ●●●● patch | view | raw | blame | history
docs/tutorials/wiki/src/basiclayout/README.txt 3 ●●●●● patch | view | raw | blame | history
docs/tutorials/wiki/src/basiclayout/development.ini 8 ●●●● patch | view | raw | blame | history
docs/tutorials/wiki/src/basiclayout/production.ini 6 ●●●● patch | view | raw | blame | history
docs/tutorials/wiki/src/basiclayout/setup.py 21 ●●●●● patch | view | raw | blame | history
docs/tutorials/wiki/src/basiclayout/tutorial/models.py 2 ●●● patch | view | raw | blame | history
docs/tutorials/wiki/src/basiclayout/tutorial/static/theme.css 8 ●●●●● patch | view | raw | blame | history
docs/tutorials/wiki/src/basiclayout/tutorial/templates/mytemplate.pt 5 ●●●●● patch | view | raw | blame | history
docs/tutorials/wiki/src/basiclayout/tutorial/tests.py 1 ●●●● patch | view | raw | blame | history
docs/tutorials/wiki/basiclayout.rst
@@ -14,21 +14,22 @@
A directory on disk can be turned into a Python :term:`package` by containing
an ``__init__.py`` file.  Even if empty, this marks a directory as a Python
package.  We use ``__init__.py`` both as a marker, indicating the directory
in which it's contained is a package, and to contain application configuration
package.  We use ``__init__.py`` both as a marker, indicating the directory in
which it's contained is a package, and to contain application configuration
code.
When you run the application using the ``pserve`` command using the
``development.ini`` generated configuration file, the application
configuration points at a Setuptools *entry point* described as
configuration points at a setuptools *entry point* described as
``egg:tutorial``.  In our application, because the application's ``setup.py``
file says so, this entry point happens to be the ``main`` function within the
file named ``__init__.py``. Let's take a look at the code and describe what
it does:
file named ``__init__.py``.
   .. literalinclude:: src/basiclayout/tutorial/__init__.py
      :linenos:
      :language: py
Open ``tutorial/__init__.py``.  It should already contain the following:
.. literalinclude:: src/basiclayout/tutorial/__init__.py
  :linenos:
  :language: py
#. *Lines 1-3*.  Perform some dependency imports.
@@ -83,9 +84,9 @@
Here is the source for ``models.py``:
   .. literalinclude:: src/basiclayout/tutorial/models.py
      :linenos:
      :language: py
.. literalinclude:: src/basiclayout/tutorial/models.py
  :linenos:
  :language: python
#. *Lines 4-5*.  The ``MyModel`` :term:`resource` class is implemented here.
   Instances of this class are capable of being persisted in :term:`ZODB`
@@ -115,9 +116,9 @@
Here is the source for ``views.py``:
   .. literalinclude:: src/basiclayout/tutorial/views.py
      :linenos:
      :language: py
.. literalinclude:: src/basiclayout/tutorial/views.py
  :linenos:
  :language: python
Let's try to understand the components in this module:
@@ -171,7 +172,7 @@
opposed to the tutorial :term:`package` directory) looks like this:
.. literalinclude:: src/basiclayout/development.ini
   :language: ini
  :language: ini
Note the existence of a ``[app:main]`` section which specifies our WSGI
application.  Our ZODB database settings are specified as the
docs/tutorials/wiki/src/basiclayout/README.txt
@@ -1,4 +1 @@
tutorial README
docs/tutorials/wiki/src/basiclayout/development.ini
@@ -1,6 +1,6 @@
###
# app configuration
# http://docs.pylonsproject.org/projects/pyramid/en/latest/narr/environment.html
# http://docs.pylonsproject.org/projects/pyramid/en/1.7-branch/narr/environment.html
###
[app:main]
@@ -29,12 +29,12 @@
[server:main]
use = egg:waitress#main
host = 0.0.0.0
host = 127.0.0.1
port = 6543
###
# logging configuration
# http://docs.pylonsproject.org/projects/pyramid/en/latest/narr/logging.html
# http://docs.pylonsproject.org/projects/pyramid/en/1.7-branch/narr/logging.html
###
[loggers]
@@ -62,4 +62,4 @@
formatter = generic
[formatter_generic]
format = %(asctime)s %(levelname)-5.5s [%(name)s][%(threadName)s] %(message)s
format = %(asctime)s %(levelname)-5.5s [%(name)s:%(lineno)s][%(threadName)s] %(message)s
docs/tutorials/wiki/src/basiclayout/production.ini
@@ -1,6 +1,6 @@
###
# app configuration
# http://docs.pylonsproject.org/projects/pyramid/en/latest/narr/environment.html
# http://docs.pylonsproject.org/projects/pyramid/en/1.7-branch/narr/environment.html
###
[app:main]
@@ -29,7 +29,7 @@
###
# logging configuration
# http://docs.pylonsproject.org/projects/pyramid/en/latest/narr/logging.html
# http://docs.pylonsproject.org/projects/pyramid/en/1.7-branch/narr/logging.html
###
[loggers]
@@ -57,4 +57,4 @@
formatter = generic
[formatter_generic]
format = %(asctime)s %(levelname)-5.5s [%(name)s][%(threadName)s] %(message)s
format = %(asctime)s %(levelname)-5.5s [%(name)s:%(lineno)s][%(threadName)s] %(message)s
docs/tutorials/wiki/src/basiclayout/setup.py
@@ -19,16 +19,22 @@
    'waitress',
    ]
testing_extras = [
    'WebTest >= 1.3.1',  # py3 compat
    'pytest',  # includes virtualenv
    'pytest-cov',
    ]
setup(name='tutorial',
      version='0.0',
      description='tutorial',
      long_description=README + '\n\n' + CHANGES,
      classifiers=[
        "Programming Language :: Python",
        "Framework :: Pyramid",
        "Topic :: Internet :: WWW/HTTP",
        "Topic :: Internet :: WWW/HTTP :: WSGI :: Application",
        ],
          "Programming Language :: Python",
          "Framework :: Pyramid",
          "Topic :: Internet :: WWW/HTTP",
          "Topic :: Internet :: WWW/HTTP :: WSGI :: Application",
      ],
      author='',
      author_email='',
      url='',
@@ -36,9 +42,10 @@
      packages=find_packages(),
      include_package_data=True,
      zip_safe=False,
      extras_require={
          'testing': testing_extras,
      },
      install_requires=requires,
      tests_require=requires,
      test_suite="tutorial",
      entry_points="""\
      [paste.app_factory]
      main = tutorial:main
docs/tutorials/wiki/src/basiclayout/tutorial/models.py
@@ -6,7 +6,7 @@
def appmaker(zodb_root):
    if not 'app_root' in zodb_root:
    if 'app_root' not in zodb_root:
        app_root = MyModel()
        zodb_root['app_root'] = app_root
        import transaction
docs/tutorials/wiki/src/basiclayout/tutorial/static/theme.css
@@ -72,12 +72,10 @@
  color: #f2b7bd;
  font-weight: 400;
}
.starter-template .links ul li a, a {
  color: #f2b7bd;
  text-decoration: underline;
}
.starter-template .links ul li a:hover, a:hover {
.starter-template .links ul li a {
  color: #ffffff;
}
.starter-template .links ul li a:hover {
  text-decoration: underline;
}
.starter-template .links ul li .icon-muted {
docs/tutorials/wiki/src/basiclayout/tutorial/templates/mytemplate.pt
@@ -34,14 +34,15 @@
          <div class="col-md-10">
            <div class="content">
              <h1><span class="font-semi-bold">Pyramid</span> <span class="smaller">ZODB scaffold</span></h1>
              <p class="lead">Welcome to <span class="font-normal">${project}</span>, an&nbsp;application generated&nbsp;by<br>the <span class="font-normal">Pyramid Web Framework</span>.</p>
              <p class="lead">Welcome to <span class="font-normal">${project}</span>, an&nbsp;application generated&nbsp;by<br>the <span class="font-normal">Pyramid Web Framework 1.7</span>.</p>
            </div>
          </div>
        </div>
        <div class="row">
          <div class="links">
            <ul>
              <li><i class="glyphicon glyphicon-bookmark icon-muted"></i><a href="http://docs.pylonsproject.org/projects/pyramid/en/latest/">Docs</a></li>
              <li class="current-version">Generated by v1.7</li>
              <li><i class="glyphicon glyphicon-bookmark icon-muted"></i><a href="http://docs.pylonsproject.org/projects/pyramid/en/1.7-branch/">Docs</a></li>
              <li><i class="glyphicon glyphicon-cog icon-muted"></i><a href="https://github.com/Pylons/pyramid">Github Project</a></li>
              <li><i class="glyphicon glyphicon-globe icon-muted"></i><a href="irc://irc.freenode.net#pyramid">IRC Channel</a></li>
              <li><i class="glyphicon glyphicon-home icon-muted"></i><a href="http://pylonsproject.org">Pylons Project</a></li>
docs/tutorials/wiki/src/basiclayout/tutorial/tests.py
@@ -2,6 +2,7 @@
from pyramid import testing
class ViewTests(unittest.TestCase):
    def setUp(self):
        self.config = testing.setUp()