[Checkins] SVN: Sandbox/philikon/zopeproject/trunk/ The package that zopeproject creates is now located in a ``src``

Philipp von Weitershausen philikon at philikon.de
Sat Sep 15 05:25:44 EDT 2007


Log message for revision 79657:
  The package that zopeproject creates is now located in a ``src``
  directory, where it's easier to single out among the other files and
  directories.
  
  

Changed:
  U   Sandbox/philikon/zopeproject/trunk/README.txt
  D   Sandbox/philikon/zopeproject/trunk/zopeproject/zope_app/+package+/
  U   Sandbox/philikon/zopeproject/trunk/zopeproject/zope_app/setup.py_tmpl
  A   Sandbox/philikon/zopeproject/trunk/zopeproject/zope_app/src/
  A   Sandbox/philikon/zopeproject/trunk/zopeproject/zope_app/src/+package+/
  D   Sandbox/philikon/zopeproject/trunk/zopeproject/zope_app/src/+package+/application.py
  A   Sandbox/philikon/zopeproject/trunk/zopeproject/zope_app/src/+package+/application.py

-=-
Modified: Sandbox/philikon/zopeproject/trunk/README.txt
===================================================================
--- Sandbox/philikon/zopeproject/trunk/README.txt	2007-09-15 09:11:01 UTC (rev 79656)
+++ Sandbox/philikon/zopeproject/trunk/README.txt	2007-09-15 09:25:44 UTC (rev 79657)
@@ -102,15 +102,15 @@
   of ``easy_install`` (used to install ``zc.buildout``) and the
   ``buildout`` command.
 
-What are the different files for?
-=================================
+What are the different files and directories for?
+=================================================
 
 ``deploy.ini``
   Configuration file for PasteDeploy_.  It defines which server
   software to launch and which WSGI application to invoke upon each
-  request (which is defined in ``myzopeproj/application.py``).  You
-  may also define WSGI middlewares here.  Invoke ``bin/paster serve``
-  with this file as an argument.
+  request (which is defined in ``src/myzopeproj/application.py``).
+  You may also define WSGI middlewares here.  Invoke ``bin/paster
+  serve`` with this file as an argument.
 
 ``zope.conf``
   This file will be read by the application factory in
@@ -141,15 +141,26 @@
   (``eggs-directory``) and determines whether buildout should check
   whether newer eggs are available online or not (``newest``).
 
+``src/``
+  This directory contains the Python package(s) of your application.
+  Normally there's just one package (``myzopeapp``), but you may add
+  more to this directory if you like.  The ``src`` directory will be
+  placed on the interpreter's search path by `zc.buildout`_.
+
+``var/``
+  The ZODB filestorage will place its files (``Data.fs``, lock files,
+  etc.) here.
+
 First steps with your application
 =================================
 
 After having started up Zope for the first time, you'll likely want to
 start developing your web application.  Code for your application goes
-into the ``myzopeproj`` package that was created by zopeproject.
+into the ``myzopeproj`` package that was created by zopeproject in the
+``src`` directory.
 
 For example, to get a simple "Hello world!" message displayed, create
-``myzopeproj/browser.py`` with the following contents::
+``src/myzopeproj/browser.py`` with the following contents::
 
   from zope.publisher.browser import BrowserPage
 
@@ -158,7 +169,8 @@
           return "<html><body><h1>Hello World!</h1></body></html>"
 
 Then all you need to do is hook up the page in ZCML.  To do that, add
-the following directive towards the end of ``myzopeproj/configure.zcml``::
+the following directive towards the end of
+``src/myzopeproj/configure.zcml``::
 
   <browser:page
       for="*"
@@ -192,7 +204,7 @@
 dependencies in ``setup.py`` (``install_requires``).  If this package
 defined any Zope components, you would probably also have to load its
 ZCML configuration by adding the following line to
-``myzopeproj/configure.zcml``::
+``src/myzopeproj/configure.zcml``::
 
   <include package="some.library" />
 
@@ -217,6 +229,10 @@
 * Added a debug script that configures the application and drops into
   an interpreter session.
 
+* The package that zopeproject creates is now located in a ``src``
+  directory, where it's easier to single out among the other files and
+  directories.
+
 0.3.2 (2007-07-17)
 ------------------
 

Modified: Sandbox/philikon/zopeproject/trunk/zopeproject/zope_app/setup.py_tmpl
===================================================================
--- Sandbox/philikon/zopeproject/trunk/zopeproject/zope_app/setup.py_tmpl	2007-09-15 09:11:01 UTC (rev 79656)
+++ Sandbox/philikon/zopeproject/trunk/zopeproject/zope_app/setup.py_tmpl	2007-09-15 09:25:44 UTC (rev 79657)
@@ -14,7 +14,8 @@
       url='',
       license='',
 
-      packages=find_packages(),
+      packages=find_packages('src'),
+      package_dir = {'': 'src'},
       include_package_data=True,
       zip_safe=False,
       install_requires=['setuptools',

Copied: Sandbox/philikon/zopeproject/trunk/zopeproject/zope_app/src/+package+ (from rev 79299, Sandbox/philikon/zopeproject/trunk/zopeproject/zope_app/+package+)

Deleted: Sandbox/philikon/zopeproject/trunk/zopeproject/zope_app/src/+package+/application.py
===================================================================
--- Sandbox/philikon/zopeproject/trunk/zopeproject/zope_app/+package+/application.py	2007-08-27 21:32:59 UTC (rev 79299)
+++ Sandbox/philikon/zopeproject/trunk/zopeproject/zope_app/src/+package+/application.py	2007-09-15 09:25:44 UTC (rev 79657)
@@ -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: Sandbox/philikon/zopeproject/trunk/zopeproject/zope_app/src/+package+/application.py (from rev 79656, Sandbox/philikon/zopeproject/trunk/zopeproject/zope_app/+package+/application.py)
===================================================================
--- Sandbox/philikon/zopeproject/trunk/zopeproject/zope_app/src/+package+/application.py	                        (rev 0)
+++ Sandbox/philikon/zopeproject/trunk/zopeproject/zope_app/src/+package+/application.py	2007-09-15 09:25:44 UTC (rev 79657)
@@ -0,0 +1,20 @@
+import os
+import code
+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()})



More information about the Checkins mailing list