summaryrefslogtreecommitdiff
path: root/docs
diff options
context:
space:
mode:
authorChris McDonough <chrism@agendaless.com>2008-08-24 01:57:45 +0000
committerChris McDonough <chrism@agendaless.com>2008-08-24 01:57:45 +0000
commit980db5f3a1b2e7c8f46136f42ea521ee6987da7c (patch)
tree19e3a64593114a6529d65f63312b772d878a2d7d /docs
parent9dd41c468b3c81231e7b0f37201f8519148ec090 (diff)
downloadpyramid-980db5f3a1b2e7c8f46136f42ea521ee6987da7c.tar.gz
pyramid-980db5f3a1b2e7c8f46136f42ea521ee6987da7c.tar.bz2
pyramid-980db5f3a1b2e7c8f46136f42ea521ee6987da7c.zip
First checkin using StudlyCaps MyProject.
Diffstat (limited to 'docs')
-rw-r--r--docs/narr/myproject/CHANGES.txt3
-rw-r--r--docs/narr/myproject/README.txt4
-rw-r--r--docs/narr/myproject/ez_setup.py272
-rw-r--r--docs/narr/myproject/myproject.ini12
-rw-r--r--docs/narr/myproject/myproject/__init__.py2
-rw-r--r--docs/narr/myproject/myproject/configure.zcml13
-rw-r--r--docs/narr/myproject/myproject/models.py14
-rw-r--r--docs/narr/myproject/myproject/run.py13
-rw-r--r--docs/narr/myproject/myproject/templates/mytemplate.pt7
-rw-r--r--docs/narr/myproject/myproject/tests.py45
-rw-r--r--docs/narr/myproject/myproject/views.py5
-rw-r--r--docs/narr/myproject/setup.py44
-rw-r--r--docs/narr/project.rst164
13 files changed, 84 insertions, 514 deletions
diff --git a/docs/narr/myproject/CHANGES.txt b/docs/narr/myproject/CHANGES.txt
deleted file mode 100644
index 1544cf53b..000000000
--- a/docs/narr/myproject/CHANGES.txt
+++ /dev/null
@@ -1,3 +0,0 @@
-0.1
-
- Initial version
diff --git a/docs/narr/myproject/README.txt b/docs/narr/myproject/README.txt
deleted file mode 100644
index 644ff3aec..000000000
--- a/docs/narr/myproject/README.txt
+++ /dev/null
@@ -1,4 +0,0 @@
-myproject README
-
-
-
diff --git a/docs/narr/myproject/ez_setup.py b/docs/narr/myproject/ez_setup.py
deleted file mode 100644
index 89cf056d9..000000000
--- a/docs/narr/myproject/ez_setup.py
+++ /dev/null
@@ -1,272 +0,0 @@
-#!python
-"""Bootstrap setuptools installation
-
-If you want to use setuptools in your package's setup.py, just include this
-file in the same directory with it, and add this to the top of your setup.py::
-
- from ez_setup import use_setuptools
- use_setuptools()
-
-If you want to require a specific version of setuptools, set a download
-mirror, or use an alternate download directory, you can do so by supplying
-the appropriate options to ``use_setuptools()``.
-
-This file can also be run as a script to install or upgrade setuptools.
-"""
-import sys
-DEFAULT_VERSION = "0.6c8"
-DEFAULT_URL = "http://pypi.python.org/packages/%s/s/setuptools/" % sys.version[:3]
-
-md5_data = {
- 'setuptools-0.6b1-py2.3.egg': '8822caf901250d848b996b7f25c6e6ca',
- 'setuptools-0.6b1-py2.4.egg': 'b79a8a403e4502fbb85ee3f1941735cb',
- 'setuptools-0.6b2-py2.3.egg': '5657759d8a6d8fc44070a9d07272d99b',
- 'setuptools-0.6b2-py2.4.egg': '4996a8d169d2be661fa32a6e52e4f82a',
- 'setuptools-0.6b3-py2.3.egg': 'bb31c0fc7399a63579975cad9f5a0618',
- 'setuptools-0.6b3-py2.4.egg': '38a8c6b3d6ecd22247f179f7da669fac',
- 'setuptools-0.6b4-py2.3.egg': '62045a24ed4e1ebc77fe039aa4e6f7e5',
- 'setuptools-0.6b4-py2.4.egg': '4cb2a185d228dacffb2d17f103b3b1c4',
- 'setuptools-0.6c1-py2.3.egg': 'b3f2b5539d65cb7f74ad79127f1a908c',
- 'setuptools-0.6c1-py2.4.egg': 'b45adeda0667d2d2ffe14009364f2a4b',
- 'setuptools-0.6c2-py2.3.egg': 'f0064bf6aa2b7d0f3ba0b43f20817c27',
- 'setuptools-0.6c2-py2.4.egg': '616192eec35f47e8ea16cd6a122b7277',
- 'setuptools-0.6c3-py2.3.egg': 'f181fa125dfe85a259c9cd6f1d7b78fa',
- 'setuptools-0.6c3-py2.4.egg': 'e0ed74682c998bfb73bf803a50e7b71e',
- 'setuptools-0.6c3-py2.5.egg': 'abef16fdd61955514841c7c6bd98965e',
- 'setuptools-0.6c4-py2.3.egg': 'b0b9131acab32022bfac7f44c5d7971f',
- 'setuptools-0.6c4-py2.4.egg': '2a1f9656d4fbf3c97bf946c0a124e6e2',
- 'setuptools-0.6c4-py2.5.egg': '8f5a052e32cdb9c72bcf4b5526f28afc',
- 'setuptools-0.6c5-py2.3.egg': 'ee9fd80965da04f2f3e6b3576e9d8167',
- 'setuptools-0.6c5-py2.4.egg': 'afe2adf1c01701ee841761f5bcd8aa64',
- 'setuptools-0.6c5-py2.5.egg': 'a8d3f61494ccaa8714dfed37bccd3d5d',
- 'setuptools-0.6c6-py2.3.egg': '35686b78116a668847237b69d549ec20',
- 'setuptools-0.6c6-py2.4.egg': '3c56af57be3225019260a644430065ab',
- 'setuptools-0.6c6-py2.5.egg': 'b2f8a7520709a5b34f80946de5f02f53',
- 'setuptools-0.6c7-py2.3.egg': '209fdf9adc3a615e5115b725658e13e2',
- 'setuptools-0.6c7-py2.4.egg': '5a8f954807d46a0fb67cf1f26c55a82e',
- 'setuptools-0.6c7-py2.5.egg': '45d2ad28f9750e7434111fde831e8372',
- 'setuptools-0.6c8-py2.3.egg': '50759d29b349db8cfd807ba8303f1902',
- 'setuptools-0.6c8-py2.4.egg': 'cba38d74f7d483c06e9daa6070cce6de',
- 'setuptools-0.6c8-py2.5.egg': '1721747ee329dc150590a58b3e1ac95b',
-}
-
-import sys, os
-
-def _validate_md5(egg_name, data):
- if egg_name in md5_data:
- from md5 import md5
- digest = md5(data).hexdigest()
- if digest != md5_data[egg_name]:
- print >>sys.stderr, (
- "md5 validation of %s failed! (Possible download problem?)"
- % egg_name
- )
- sys.exit(2)
- return data
-
-
-def use_setuptools(
- version=DEFAULT_VERSION, download_base=DEFAULT_URL, to_dir=os.curdir,
- download_delay=15
-):
- """Automatically find/download setuptools and make it available on sys.path
-
- `version` should be a valid setuptools version number that is available
- as an egg for download under the `download_base` URL (which should end with
- a '/'). `to_dir` is the directory where setuptools will be downloaded, if
- it is not already available. If `download_delay` is specified, it should
- be the number of seconds that will be paused before initiating a download,
- should one be required. If an older version of setuptools is installed,
- this routine will print a message to ``sys.stderr`` and raise SystemExit in
- an attempt to abort the calling script.
- """
- was_imported = 'pkg_resources' in sys.modules or 'setuptools' in sys.modules
- def do_download():
- egg = download_setuptools(version, download_base, to_dir, download_delay)
- sys.path.insert(0, egg)
- import setuptools; setuptools.bootstrap_install_from = egg
- try:
- import pkg_resources
- except ImportError:
- return do_download()
- try:
- pkg_resources.require("setuptools>="+version); return
- except pkg_resources.VersionConflict, e:
- if was_imported:
- print >>sys.stderr, (
- "The required version of setuptools (>=%s) is not available, and\n"
- "can't be installed while this script is running. Please install\n"
- " a more recent version first, using 'easy_install -U setuptools'."
- "\n\n(Currently using %r)"
- ) % (version, e.args[0])
- sys.exit(2)
- else:
- del pkg_resources, sys.modules['pkg_resources'] # reload ok
- return do_download()
- except pkg_resources.DistributionNotFound:
- return do_download()
-
-def download_setuptools(
- version=DEFAULT_VERSION, download_base=DEFAULT_URL, to_dir=os.curdir,
- delay = 15
-):
- """Download setuptools from a specified location and return its filename
-
- `version` should be a valid setuptools version number that is available
- as an egg for download under the `download_base` URL (which should end
- with a '/'). `to_dir` is the directory where the egg will be downloaded.
- `delay` is the number of seconds to pause before an actual download attempt.
- """
- import urllib2, shutil
- egg_name = "setuptools-%s-py%s.egg" % (version,sys.version[:3])
- url = download_base + egg_name
- saveto = os.path.join(to_dir, egg_name)
- src = dst = None
- if not os.path.exists(saveto): # Avoid repeated downloads
- try:
- from distutils import log
- if delay:
- log.warn("""
----------------------------------------------------------------------------
-This script requires setuptools version %s to run (even to display
-help). I will attempt to download it for you (from
-%s), but
-you may need to enable firewall access for this script first.
-I will start the download in %d seconds.
-
-(Note: if this machine does not have network access, please obtain the file
-
- %s
-
-and place it in this directory before rerunning this script.)
----------------------------------------------------------------------------""",
- version, download_base, delay, url
- ); from time import sleep; sleep(delay)
- log.warn("Downloading %s", url)
- src = urllib2.urlopen(url)
- # Read/write all in one block, so we don't create a corrupt file
- # if the download is interrupted.
- data = _validate_md5(egg_name, src.read())
- dst = open(saveto,"wb"); dst.write(data)
- finally:
- if src: src.close()
- if dst: dst.close()
- return os.path.realpath(saveto)
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-def main(argv, version=DEFAULT_VERSION):
- """Install or upgrade setuptools and EasyInstall"""
- try:
- import setuptools
- except ImportError:
- egg = None
- try:
- egg = download_setuptools(version, delay=0)
- sys.path.insert(0,egg)
- from setuptools.command.easy_install import main
- return main(list(argv)+[egg]) # we're done here
- finally:
- if egg and os.path.exists(egg):
- os.unlink(egg)
- else:
- if setuptools.__version__ == '0.0.1':
- print >>sys.stderr, (
- "You have an obsolete version of setuptools installed. Please\n"
- "remove it from your system entirely before rerunning this script."
- )
- sys.exit(2)
-
- req = "setuptools>="+version
- import pkg_resources
- try:
- pkg_resources.require(req)
- except pkg_resources.VersionConflict:
- try:
- from setuptools.command.easy_install import main
- except ImportError:
- from easy_install import main
- main(list(argv)+[download_setuptools(delay=0)])
- sys.exit(0) # try to force an exit
- else:
- if argv:
- from setuptools.command.easy_install import main
- main(argv)
- else:
- print "Setuptools version",version,"or greater has been installed."
- print '(Run "ez_setup.py -U setuptools" to reinstall or upgrade.)'
-
-def update_md5(filenames):
- """Update our built-in md5 registry"""
-
- import re
- from md5 import md5
-
- for name in filenames:
- base = os.path.basename(name)
- f = open(name,'rb')
- md5_data[base] = md5(f.read()).hexdigest()
- f.close()
-
- data = [" %r: %r,\n" % it for it in md5_data.items()]
- data.sort()
- repl = "".join(data)
-
- import inspect
- srcfile = inspect.getsourcefile(sys.modules[__name__])
- f = open(srcfile, 'rb'); src = f.read(); f.close()
-
- match = re.search("\nmd5_data = {\n([^}]+)}", src)
- if not match:
- print >>sys.stderr, "Internal error!"
- sys.exit(2)
-
- src = src[:match.start(1)] + repl + src[match.end(1):]
- f = open(srcfile,'w')
- f.write(src)
- f.close()
-
-
-if __name__=='__main__':
- if len(sys.argv)>2 and sys.argv[1]=='--md5update':
- update_md5(sys.argv[2:])
- else:
- main(sys.argv[1:])
-
-
-
-
-
diff --git a/docs/narr/myproject/myproject.ini b/docs/narr/myproject/myproject.ini
deleted file mode 100644
index 318c2214a..000000000
--- a/docs/narr/myproject/myproject.ini
+++ /dev/null
@@ -1,12 +0,0 @@
-[DEFAULT]
-debug = true
-
-[app:main]
-use = egg:myproject#app
-reload_templates = true
-
-[server:main]
-use = egg:PasteScript#cherrypy
-host = 0.0.0.0
-port = 5432
-numthreads = 4
diff --git a/docs/narr/myproject/myproject/__init__.py b/docs/narr/myproject/myproject/__init__.py
deleted file mode 100644
index cbdfd3ac6..000000000
--- a/docs/narr/myproject/myproject/__init__.py
+++ /dev/null
@@ -1,2 +0,0 @@
-# A package
-
diff --git a/docs/narr/myproject/myproject/configure.zcml b/docs/narr/myproject/myproject/configure.zcml
deleted file mode 100644
index fdae69cb3..000000000
--- a/docs/narr/myproject/myproject/configure.zcml
+++ /dev/null
@@ -1,13 +0,0 @@
-<configure xmlns="http://namespaces.zope.org/zope"
- xmlns:bfg="http://namespaces.repoze.org/bfg"
- i18n_domain="repoze.bfg">
-
- <!-- this directive must be included for the view declarations to work -->
- <include package="repoze.bfg" />
-
- <bfg:view
- for=".models.IMyModel"
- view=".views.my_view"
- />
-
-</configure>
diff --git a/docs/narr/myproject/myproject/models.py b/docs/narr/myproject/myproject/models.py
deleted file mode 100644
index 42efd9e0b..000000000
--- a/docs/narr/myproject/myproject/models.py
+++ /dev/null
@@ -1,14 +0,0 @@
-from zope.interface import Interface
-from zope.interface import implements
-
-class IMyModel(Interface):
- pass
-
-class MyModel(object):
- implements(IMyModel)
- pass
-
-root = MyModel()
-
-def get_root(environ):
- return root
diff --git a/docs/narr/myproject/myproject/run.py b/docs/narr/myproject/myproject/run.py
deleted file mode 100644
index f60a4023f..000000000
--- a/docs/narr/myproject/myproject/run.py
+++ /dev/null
@@ -1,13 +0,0 @@
-from repoze.bfg import make_app
-from repoze.bfg import get_options
-
-def app(global_config, **kw):
- # paster app config callback
- from myproject.models import get_root
- import myproject
- app = make_app(get_root, myproject, options=get_options(kw))
- return app
-
-if __name__ == '__main__':
- from paste import httpserver
- httpserver.serve(app(None), host='0.0.0.0', port='6543')
diff --git a/docs/narr/myproject/myproject/templates/mytemplate.pt b/docs/narr/myproject/myproject/templates/mytemplate.pt
deleted file mode 100644
index a7affedf9..000000000
--- a/docs/narr/myproject/myproject/templates/mytemplate.pt
+++ /dev/null
@@ -1,7 +0,0 @@
-<html xmlns="http://www.w3.org/1999/xhtml"
- xmlns:tal="http://xml.zope.org/namespaces/tal">
-<head></head>
-<body>
- <h1>Welcome to ${project}</h1>
-</body>
-</html>
diff --git a/docs/narr/myproject/myproject/tests.py b/docs/narr/myproject/myproject/tests.py
deleted file mode 100644
index d3d4628ff..000000000
--- a/docs/narr/myproject/myproject/tests.py
+++ /dev/null
@@ -1,45 +0,0 @@
-import unittest
-
-class ViewTests(unittest.TestCase):
- def setUp(self):
- # This sets up the application registry with the registrations
- # your application declares in its configure.zcml (including
- # dependent registrations for repoze.bfg itself). This is a
- # heavy-hammer way of making sure that your tests have enough
- # context to run properly. But tests will run faster if you
- # use only the registrations you need programmatically, so you
- # should explore ways to do that rather than rely on ZCML (see
- # the repoze.bfg tests for inspiration).
- self._cleanup()
- import myproject
- import zope.configuration.xmlconfig
- zope.configuration.xmlconfig.file('configure.zcml',
- package=myproject)
-
- def tearDown(self):
- self._cleanup()
-
- def _cleanup(self):
- # this clears the application registry
- from zope.testing.cleanup import cleanUp
- cleanUp()
-
- def test_my_view(self):
- from myproject.views import my_view
- context = DummyContext()
- request = DummyRequest()
- result = my_view(context, request)
- self.assertEqual(result.status, '200 OK')
- body = result.app_iter[0]
- self.failUnless('Welcome to myproject' in body)
- self.assertEqual(len(result.headerlist), 2)
- self.assertEqual(result.headerlist[0],
- ('content-type', 'text/html; charset=UTF-8'))
- self.assertEqual(result.headerlist[1], ('Content-Length',
- str(len(body))))
-
-class DummyContext:
- pass
-
-class DummyRequest:
- pass
diff --git a/docs/narr/myproject/myproject/views.py b/docs/narr/myproject/myproject/views.py
deleted file mode 100644
index 6e1be6190..000000000
--- a/docs/narr/myproject/myproject/views.py
+++ /dev/null
@@ -1,5 +0,0 @@
-from repoze.bfg.template import render_template_to_response
-
-def my_view(context, request):
- return render_template_to_response('templates/mytemplate.pt',
- project = 'myproject')
diff --git a/docs/narr/myproject/setup.py b/docs/narr/myproject/setup.py
deleted file mode 100644
index 2d9ccda1d..000000000
--- a/docs/narr/myproject/setup.py
+++ /dev/null
@@ -1,44 +0,0 @@
-import os
-
-from ez_setup import use_setuptools
-use_setuptools()
-
-from setuptools import setup, find_packages
-
-here = os.path.abspath(os.path.dirname(__file__))
-README = open(os.path.join(here, 'README.txt')).read()
-CHANGES = open(os.path.join(here, 'CHANGES.txt')).read()
-
-setup(name='myproject',
- version='0.1',
- description='myproject',
- long_description=README + '\n\n' + CHANGES,
- classifiers=[
- "Development Status :: 3 - Alpha",
- "Intended Audience :: Developers",
- "Programming Language :: Python",
- "Topic :: Internet :: WWW/HTTP",
- "Topic :: Internet :: WWW/HTTP :: Dynamic Content",
- "Topic :: Internet :: WWW/HTTP :: WSGI",
- "Topic :: Internet :: WWW/HTTP :: WSGI :: Application",
- ],
- author='',
- author_email='',
- url='',
- keywords='web wsgi bfg zope',
- packages=find_packages(),
- include_package_data=True,
- zip_safe=False,
- install_requires=[
- 'repoze.bfg',
- ],
- tests_require=[
- 'repoze.bfg',
- ],
- test_suite="myproject",
- entry_points = """\
- [paste.app_factory]
- app = myproject.run:app
- """
- )
-
diff --git a/docs/narr/project.rst b/docs/narr/project.rst
index 2ff8011ee..41e2599fb 100644
--- a/docs/narr/project.rst
+++ b/docs/narr/project.rst
@@ -18,50 +18,52 @@ create`` facility::
``paster create`` will ask you a single question: the *name* of the
project. You should use a string without spaces and with only letters
in it. Here's sample output from a run of ``paster create`` for a
-project we name ``myproject``::
+project we name ``MyProject``::
- $ paster create -t bfg
+ $ bin/paster create -t bfg
Selected and implied templates:
repoze.bfg#bfg repoze.bfg starter project
- Enter project name: myproject
+ Enter project name: MyProject
Variables:
- egg: myproject
+ egg: MyProject
package: myproject
- project: myproject
+ project: MyProject
Creating template bfg
- Creating directory ./myproject
+ Creating directory ./MyProject
Recursing into +package+
- Creating ./myproject/myproject/
- Copying __init__.py to ./myproject/myproject/__init__.py
- Copying configure.zcml to ./myproject/myproject/configure.zcml
- Copying models.py to ./myproject/myproject/models.py
- Copying run.py_tmpl to ./myproject/myproject/run.py
+ Creating ./MyProject/myproject/
+ Copying __init__.py to ./MyProject/myproject/__init__.py
+ Copying configure.zcml to ./MyProject/myproject/configure.zcml
+ Copying models.py to ./MyProject/myproject/models.py
+ Copying run.py_tmpl to ./MyProject/myproject/run.py
Recursing into templates
- Creating ./myproject/myproject/templates/
- Copying mytemplate.pt to ./myproject/myproject/templates/mytemplate.pt
- Copying views.py_tmpl to ./myproject/myproject/views.py
- Copying +package+.ini_tmpl to ./myproject/myproject.ini
- Copying CHANGES.txt_tmpl to ./myproject/CHANGES.txt
- Copying README.txt_tmpl to ./myproject/README.txt
- Copying ez_setup.py to ./myproject/ez_setup.py
- Copying setup.py_tmpl to ./myproject/setup.py
- Running /Users/chrism/projects/repoze-devel/bfg/bin/python setup.py egg_info
+ Creating ./MyProject/myproject/templates/
+ Copying mytemplate.pt to ./MyProject/myproject/templates/mytemplate.pt
+ Copying tests.py_tmpl to ./MyProject/myproject/tests.py
+ Copying views.py_tmpl to ./MyProject/myproject/views.py
+ Copying +project+.ini_tmpl to ./MyProject/MyProject.ini
+ Copying CHANGES.txt_tmpl to ./MyProject/CHANGES.txt
+ Copying README.txt_tmpl to ./MyProject/README.txt
+ Copying ez_setup.py to ./MyProject/ez_setup.py
+ Copying setup.py_tmpl to ./MyProject/setup.py
+ Running /Users/chrism/projects/repoze/bfg/bin/python setup.py egg_info
As a result of the above, a project is created in a directory named
-``myproject``. That directory is a :term:`setuptools` :term:`project`
+``MyProject``. That directory is a :term:`setuptools` :term:`project`
directory from which a Python setuptools :term:`distribution` can be
created. The ``setup.py`` file in that directory can be used to
distribute your application, or install your application for
deployment or development. A sample :term:`PasteDeploy` ``.ini`` file
-named ``myproject.ini`` will also be created in the project directory.
-You will use the ``paster serve`` command against this ``ini`` file to
-run your application.
+named ``MyProject.ini`` will also be created in the project directory.
+You will use the ``paster serve`` command against this ``.ini`` file
+to run your application.
-The main ``myproject`` directory contains an additional subdirectory
-(also named ``myproject``) representing a Python :term:`package` which
-holds very simple :mod:`repoze.bfg` sample code. This is where you'll
-edit your application's Python code and templates.
+The ``MyProject`` project directory contains an additional
+subdirectory named ``myproject`` (note the case difference)
+representing a Python :term:`package` which holds very simple
+:mod:`repoze.bfg` sample code. This is where you'll edit your
+application's Python code and templates.
Installing your Newly Created Project for Development
-----------------------------------------------------
@@ -76,9 +78,9 @@ Elided output from a run of this command is shown below::
$ python setup.py develop
...
- Finished processing dependencies for myproject==0.1
+ Finished processing dependencies for MyProject==0.1
-This will install your application 's :term:`package` into the
+This will install your application's :term:`package` into the
interpreter so it can be found and run as a :term:`WSGI` application
inside a WSGI server.
@@ -95,35 +97,35 @@ Here's sample output from a test run::
$ python setup.py test -q
running test
running egg_info
- writing requirements to myproject.egg-info/requires.txt
- writing myproject.egg-info/PKG-INFO
- writing top-level names to myproject.egg-info/top_level.txt
- writing dependency_links to myproject.egg-info/dependency_links.txt
- writing entry points to myproject.egg-info/entry_points.txt
- reading manifest file 'myproject.egg-info/SOURCES.txt'
- writing manifest file 'myproject.egg-info/SOURCES.txt'
+ writing requirements to MyProject.egg-info/requires.txt
+ writing MyProject.egg-info/PKG-INFO
+ writing top-level names to MyProject.egg-info/top_level.txt
+ writing dependency_links to MyProject.egg-info/dependency_links.txt
+ writing entry points to MyProject.egg-info/entry_points.txt
+ reading manifest file 'MyProject.egg-info/SOURCES.txt'
+ writing manifest file 'MyProject.egg-info/SOURCES.txt'
running build_ext
.
----------------------------------------------------------------------
- Ran 1 test in 0.566s
+ Ran 1 test in 0.647s
- OK
+OK
-The tests are found in the ``tests.py`` module in your
-paster-create-generated project. One sample test exists.
+The tests are found in the ``tests.py`` module in your ``paster
+create``-generated project. One sample test exists.
Runnning The Project Application
--------------------------------
Once the project is installed for development, you can run the
application it represents using the ``paster serve`` command against
-the generated ``myproject.ini`` configuration file::
+the generated ``MyProject.ini`` configuration file::
- $ paster serve myproject/myproject.ini
+ $ paster serve myproject/MyProject.ini
Here's sample output from a run::
- $ paster serve myproject/myproject.ini
+ $ paster serve myproject/MyProject.ini
Starting server in PID 16601.
serving on 0.0.0.0:6543 view at http://127.0.0.1:6543
@@ -136,23 +138,25 @@ port 6543.
development easier, as changes to Python code under
:mod:`repoze.bfg` is not put into effect until the server restarts.
-.. note:: When :mod:`repoze.bfg` starts, it writes a ``.pck`` file.
- In a typical setup this file will be written as
- ``configure.zcml.pck`` in the same directory that your
- application's ``configure.zcml`` is stored. This is temporary,
- cached data that can help your :mod:`repoze.bfg` application start
- slightly faster (its existence prevents the need to parse the XML
- in the .zcml file). You can delete it at will as necessary; it
- will be recreated. If it cannot be written due to filesystem
- permissions, :mod:`repoze.bfg` will just reparse the .zcml file
- every time it starts.
+.. note:: When :mod:`repoze.bfg` starts, it attempts to write a
+ ``.cache`` file which stores a cached version of your
+ :term:`application registry`. In a typical setup this file will be
+ written as ``configure.zcml.cache`` in the same directory that your
+ application's ``configure.zcml`` is stored. This is temporary data
+ that can help your :mod:`repoze.bfg` application start slightly
+ faster (its existence prevents the need to parse the XML stored in
+ the ``.zcml`` file if that file or any of files upon which it
+ depends files have not changed). You can delete it at will as
+ necessary; it will be recreated. If a ``.cache`` file cannot be
+ written due to filesystem permissions, :mod:`repoze.bfg` will just
+ reparse the ``.zcml`` file every time it starts.
Viewing the Application
-----------------------
Visit ``http://localhost:6542/`` in your browser. You will see::
- Welcome to myproject
+ Welcome to MyProject
That's the page shown by default when you visit an unmodified ``paster
create``-generated application.
@@ -166,9 +170,9 @@ Our generated :mod:`repoze.bfg` application is a setuptools
template generates a project which contains a package that shares its
name).
-The ``myproject`` project has the following directory structure::
+The ``MyProject`` project has the following directory structure::
- myproject/
+ MyProject/
|-- CHANGES.txt
|-- README.txt
|-- ez_setup.py
@@ -181,10 +185,10 @@ The ``myproject`` project has the following directory structure::
| | `-- mytemplate.pt
| |-- tests.py
| `-- views.py
- |-- myproject.ini
+ |-- MyProject.ini
`-- setup.py
-The ``myproject`` :term:`Project`
+The ``MyProject`` :term:`Project`
---------------------------------
The ``myproject`` :term:`project` is the distribution and deployment
@@ -203,7 +207,7 @@ describe, run, and test your application.
:term:`Setuptools` if the executing user does not have it
installed.
-#. ``myproject.ini`` is a :term:`PasteDeploy` configuration file that
+#. ``MyProject.ini`` is a :term:`PasteDeploy` configuration file that
can be used to execute your application.
#. ``setup.py`` is the file you'll use to test and distribute your
@@ -216,17 +220,17 @@ wants to install your package does not have :term:`Setuptools` already
installed. It is only imported by and used by ``setup.py``, so we
won't describe it here.
-``myproject.ini``
+``MyProject.ini``
~~~~~~~~~~~~~~~~~
-The ``myproject.ini`` file is a :term:`PasteDeploy` configuration
+The ``MyProject.ini`` file is a :term:`PasteDeploy` configuration
file. Its purpose is to specify an application to run when you invoke
``paster serve`` when you start an application, as well as the options
provided to that application.
-The generated ``myproject.ini`` file looks like so:
+The generated ``MyProject.ini`` file looks like so:
-.. literalinclude:: myproject/myproject.ini
+.. literalinclude:: MyProject/MyProject.ini
:linenos:
This file contains several "sections" including ``[DEFAULT]``,
@@ -249,7 +253,7 @@ convention signifying that it the default application.
The ``use`` setting is required in the ``[app:main]`` section. The
``use`` setting points at a :term:`setuptools` "entry point" named
-``myproject#app`` (the ``egg:`` prefix in ``egg:myproject#app``
+``MyProject#app`` (the ``egg:`` prefix in ``egg:MyProject#app``
indicates that this is an entry point specifier).
.. note::
@@ -262,13 +266,13 @@ indicates that this is an entry point specifier).
named ``[paste.app_factory]``. Within this section, there is a key
named ``app`` (the entry point name) which has a value
``myproject.run:app``. The *key* ``app`` is what our
- ``egg:myproject#app`` value of the ``use`` section in our config
+ ``egg:MyProject#app`` value of the ``use`` section in our config
file is pointing at. The value represents a Python "dotted-name"
path, which refers to a callable in our ``myproject`` package's
``run.py`` module.
In English, this entry point can thus be referred to as a "Paste
- application factory in the ``myproject`` package which has the
+ application factory in the ``MyProject`` project which has the
entry point named ``app`` where the entry point refers to a ``app``
function in the ``mypackage.run`` module". If indeed if you open
up the ``run.py`` module generated within the ``myproject``
@@ -279,7 +283,7 @@ indicates that this is an entry point specifier).
The ``use`` setting is the only setting required in the ``[app:main]``
section unless you've changed the callable referred to by the
-``myproject#app`` entry point to accept more arguments: other settings
+``MyProject#app`` entry point to accept more arguments: other settings
you add to this section are passed as keywords arguments to the
callable represented by this entry point (``app`` in our ``run.py``
module). You can provide startup-time configuration parameters to
@@ -327,7 +331,7 @@ distributing your application.
Our generated ``setup.py`` looks like this:
-.. literalinclude:: myproject/setup.py
+.. literalinclude:: MyProject/setup.py
:linenos:
The top of the file imports and uses ``ez_setup``, which causes
@@ -361,7 +365,7 @@ as a directory, which is more convenient). ``install_requires`` and
``repoze.bfg`` package. ``test_suite`` points at the package for our
application, which means all tests found in the package will be
installed. We examined ``entry_points`` in our discussion of the
-``myproject.ini`` file; this file defines the ``app`` entry point that
+``MyProject.ini`` file; this file defines the ``app`` entry point that
represent's our project's application.
Usually you only need to think about the contents of the ``setup.py``
@@ -372,7 +376,7 @@ this command now::
python setup.py sdist
This will create a tarball of your application in a ``dist``
-subdirectory named ``myproject-0.1.tar.gz``. You can send this
+subdirectory named ``MyProject-0.1.tar.gz``. You can send this
tarball to other people who want to use your application.
.. note::
@@ -390,7 +394,7 @@ tarball to other people who want to use your application.
The ``myproject`` :term:`Package`
---------------------------------
-The ``myproject`` :term:`package` lives inside the ``myproject``
+The ``myproject`` :term:`package` lives inside the ``MyProject``
:term:`project`. It contains:
#. An ``__init__.py`` file which signifies that this is a Python
@@ -425,7 +429,7 @@ particular way.
The ``configure.zcml`` represents the :term:`application
registry`. It looks like so:
-.. literalinclude:: myproject/myproject/configure.zcml
+.. literalinclude:: MyProject/myproject/configure.zcml
:linenos:
:language: xml
@@ -444,7 +448,7 @@ registry`. It looks like so:
period are "shortcuts" which point at files relative to the
:term:`package` in which the ``configure.zcml`` file lives. In
this case, since the ``configure.zcml`` file lives within the
- ``myproject`` project, the shorcut ``.models.IMyModel`` could also
+ ``myproject`` package, the shorcut ``.models.IMyModel`` could also
be spelled ``myproject.models.IMyModel`` (forming a full Python
dotted-path name to the ``IMyModel`` class). Likewise the shortcut
``.views.my_view`` could be replaced with
@@ -457,7 +461,7 @@ Much of the heavy lifting in a :mod:`repoze.bfg` application comes in
the form of *views*. A :term:`view` is the bridge between the content
in the model, and the HTML given back to the browser.
-.. literalinclude:: myproject/myproject/views.py
+.. literalinclude:: MyProject/myproject/views.py
:linenos:
#. Lines 3-5 provide the ``my_view`` that was registered as the view.
@@ -471,7 +475,7 @@ in the model, and the HTML given back to the browser.
``Request`` class representing the browser's request to our server.
#. The view renders a :term:`template` and returns the result as the
- :term:`response`. Note that because our ``myproject.ini`` has a
+ :term:`response`. Note that because our ``MyProject.ini`` has a
``reload_templates = true`` directive indicating that templates
should be reloaded when they change, you won't need to restart the
application server to see changes you make to templates. During
@@ -502,7 +506,7 @@ behavior. We then create an interface ``IMyModel`` that is a
associate it without our ``MyModel`` class by claiming that the class
``implements`` the interface.
-.. literalinclude:: myproject/myproject/models.py
+.. literalinclude:: MyProject/myproject/models.py
:linenos:
#. Lines 4-5 define the interface.
@@ -539,7 +543,7 @@ advertises itself to our :term:`PasteDeploy` ``.ini`` file. For
convenience, we also make it possible to run this module directory
without the PasteDeploy configuration file:
-.. literalinclude:: myproject/myproject/run.py
+.. literalinclude:: MyProject/myproject/run.py
:linenos:
#. Lines 1 - 2 import functions from :mod:`repoze.bfg` that we use later.
@@ -558,7 +562,7 @@ without the PasteDeploy configuration file:
The single :term:`template` in the project looks like so:
-.. literalinclude:: myproject/myproject/templates/mytemplate.pt
+.. literalinclude:: MyProject/myproject/templates/mytemplate.pt
:linenos:
:language: xml
@@ -572,7 +576,7 @@ by view functions.
The ``tests.py`` module includes unit tests for your application.
-.. literalinclude:: myproject/myproject/tests.py
+.. literalinclude:: MyProject/myproject/tests.py
:linenos:
This sample ``tests.py`` file has a single unit test defined within