[Checkins]
SVN: grokproject/branches/use-zopeproject/grokproject/template/s
Port over recent improvements from zopeproject
Philipp von Weitershausen
philikon at philikon.de
Fri Oct 5 12:05:32 EDT 2007
Log message for revision 80661:
Port over recent improvements from zopeproject
Changed:
U grokproject/branches/use-zopeproject/grokproject/template/setup.py_tmpl
D grokproject/branches/use-zopeproject/grokproject/template/src/+package+/application.py
A grokproject/branches/use-zopeproject/grokproject/template/src/+package+/startup.py
A grokproject/branches/use-zopeproject/grokproject/template/src/+package+/testing.py
D grokproject/branches/use-zopeproject/grokproject/template/src/+package+/testing.py_tmpl
-=-
Modified: grokproject/branches/use-zopeproject/grokproject/template/setup.py_tmpl
===================================================================
--- grokproject/branches/use-zopeproject/grokproject/template/setup.py_tmpl 2007-10-05 15:59:03 UTC (rev 80660)
+++ grokproject/branches/use-zopeproject/grokproject/template/setup.py_tmpl 2007-10-05 16:05:32 UTC (rev 80661)
@@ -1,29 +1,35 @@
from setuptools import setup, find_packages
-version = '${repr(version)|0.0}'
+setup(name=${repr(project)},
-setup(name=${repr(project)},
- version=version,
- description="${description|nothing}",
- long_description="""\
-${long_description|nothing}""",
- # Get strings from http://www.python.org/pypi?%3Aaction=list_classifiers
- classifiers=[],
- keywords=${repr(keywords)|empty},
- author=${repr(author)|empty},
- author_email=${repr(author_email)|empty},
- url=${repr(url)|empty},
- license=${repr(license_name)|empty},
- package_dir={'': 'src'},
+ # Fill in project info below
+ version='0.1',
+ description="",
+ long_description="",
+ keywords='',
+ author='',
+ author_email='',
+ url='',
+ license='',
+ # Get more from http://www.python.org/pypi?%3Aaction=list_classifiers
+ classifiers=['Programming Language :: Python',
+ 'Environment :: Web Environment',
+ 'Topic :: Internet :: WWW/HTTP :: WSGI :: Application',
+ 'Framework :: Zope3',
+ ],
+
packages=find_packages('src'),
+ package_dir = {'': 'src'},
include_package_data=True,
- zip_safe=${repr(bool(zip_safe))|False},
+ zip_safe=False,
install_requires=['setuptools',
'grok',
- # Add extra requirements here
],
- entry_points="""
+ entry_points = """
+ [console_scripts]
+ ${package}-debug = ${package}.startup:interactive_debug_prompt
+ ${package}-ctl = ${package}.startup:zdaemon_controller
[paste.app_factory]
- main = ${package}.application:application_factory
- """,
+ main = ${package}.startup:application_factory
+ """
)
Deleted: grokproject/branches/use-zopeproject/grokproject/template/src/+package+/application.py
===================================================================
--- grokproject/branches/use-zopeproject/grokproject/template/src/+package+/application.py 2007-10-05 15:59:03 UTC (rev 80660)
+++ grokproject/branches/use-zopeproject/grokproject/template/src/+package+/application.py 2007-10-05 16:05:32 UTC (rev 80661)
@@ -1,32 +0,0 @@
-import sys, os
-import ZConfig
-import zope.event
-import zope.app.appsetup
-from zope.app.wsgi import WSGIPublisherApplication
-from zope.app.appsetup.appsetup import multi_database
-from zope.app.appsetup.interfaces import DatabaseOpened, ProcessStarting
-
-def application_factory(global_conf, conf='zope.conf'):
- # load 'zope.conf' configuration
- schema_xml = os.path.join(
- os.path.dirname(zope.app.appsetup.__file__), 'schema', 'schema.xml')
- schema = ZConfig.loadSchema(schema_xml)
- options, handlers = ZConfig.loadConfig(
- schema, os.path.join(global_conf['here'], conf))
-
- if options.path:
- sys.path[0:0] = [os.path.abspath(p) for p in options.path]
- options.eventlog()
-
- # load ZCML configuration
- features = ()
- if options.devmode:
- features += ('devmode',)
- zope.app.appsetup.config(options.site_definition, features)
-
- # notify of ZODB database opening
- db = multi_database(options.databases)[0][0]
- zope.event.notify(DatabaseOpened(db))
-
- zope.event.notify(ProcessStarting())
- return WSGIPublisherApplication(db)
Copied: grokproject/branches/use-zopeproject/grokproject/template/src/+package+/startup.py (from rev 80603, grokproject/branches/use-zopeproject/grokproject/template/src/+package+/application.py)
===================================================================
--- grokproject/branches/use-zopeproject/grokproject/template/src/+package+/startup.py (rev 0)
+++ grokproject/branches/use-zopeproject/grokproject/template/src/+package+/startup.py 2007-10-05 16:05:32 UTC (rev 80661)
@@ -0,0 +1,35 @@
+import os
+import sys
+import code
+import zdaemon.zdctl
+import zope.app.wsgi
+import zope.app.debug
+
+def application_factory(global_conf, conf='zope.conf'):
+ zope_conf = os.path.join(global_conf['here'], conf)
+ return zope.app.wsgi.getWSGIApplication(zope_conf)
+
+def interactive_debug_prompt(zope_conf='zope.conf'):
+ db = zope.app.wsgi.config(zope_conf)
+ debugger = zope.app.debug.Debugger.fromDatabase(db)
+ # Invoke an interactive interpreter shell
+ banner = ("Welcome to the interactive debug prompt.\n"
+ "The 'root' variable contains the ZODB root folder.\n"
+ "The 'app' variable contains the Debugger, 'app.publish(path)' "
+ "simulates a request.")
+ code.interact(banner=banner, local={'debugger': debugger,
+ 'app': debugger,
+ 'root': debugger.root()})
+
+class ControllerCommands(zdaemon.zdctl.ZDCmd):
+
+ def do_debug(self, rest):
+ interactive_debug_prompt()
+
+ def help_debug(self):
+ print "debug -- Initialize the application, providing a debugger"
+ print " object at an interactive Python prompt."
+
+def zdaemon_controller(zdaemon_conf='zdaemon.conf'):
+ args = ['-C', zdaemon_conf] + sys.argv[1:]
+ zdaemon.zdctl.main(args, options=None, cmdclass=ControllerCommands)
Copied: grokproject/branches/use-zopeproject/grokproject/template/src/+package+/testing.py (from rev 80603, grokproject/branches/use-zopeproject/grokproject/template/src/+package+/testing.py_tmpl)
===================================================================
--- grokproject/branches/use-zopeproject/grokproject/template/src/+package+/testing.py (rev 0)
+++ grokproject/branches/use-zopeproject/grokproject/template/src/+package+/testing.py 2007-10-05 16:05:32 UTC (rev 80661)
@@ -0,0 +1,21 @@
+import os.path
+from zope.testing import doctest
+from zope.app.testing import functional
+
+ftesting_zcml = os.path.join(os.path.dirname(__file__), 'ftesting.zcml')
+FunctionalLayer = functional.ZCMLLayer(ftesting_zcml, __name__,
+ 'FunctionalLayer')
+
+def FunctionalDocTestSuite(module=None, **kw):
+ module = doctest._normalize_module(module)
+ suite = functional.FunctionalDocTestSuite(module, **kw)
+ suite.layer = FunctionalLayer
+ return suite
+
+def FunctionalDocFileSuite(path, **kw):
+ suite = functional.FunctionalDocFileSuite(path, **kw)
+ suite.layer = FunctionalLayer
+ return suite
+
+class FunctionalTestCase(functional.FunctionalTestCase):
+ layer = FunctionalLayer
Deleted: grokproject/branches/use-zopeproject/grokproject/template/src/+package+/testing.py_tmpl
===================================================================
--- grokproject/branches/use-zopeproject/grokproject/template/src/+package+/testing.py_tmpl 2007-10-05 15:59:03 UTC (rev 80660)
+++ grokproject/branches/use-zopeproject/grokproject/template/src/+package+/testing.py_tmpl 2007-10-05 16:05:32 UTC (rev 80661)
@@ -1,7 +0,0 @@
-import os.path
-import ${package}
-from zope.app.testing.functional import ZCMLLayer
-
-ftesting_zcml = os.path.join(
- os.path.dirname(${package}.__file__), 'ftesting.zcml')
-FunctionalLayer = ZCMLLayer(ftesting_zcml, __name__, 'FunctionalLayer')
More information about the Checkins
mailing list