[Checkins] SVN: grokproject/branches/d2m-dual-startup/ commit altered files for dual configuration

Michael Haubenwallner michael at d2m.at
Thu Jun 12 02:17:03 EDT 2008


Log message for revision 87321:
  commit altered files for dual configuration

Changed:
  U   grokproject/branches/d2m-dual-startup/CHANGES.txt
  U   grokproject/branches/d2m-dual-startup/README.txt
  U   grokproject/branches/d2m-dual-startup/TODO.txt
  U   grokproject/branches/d2m-dual-startup/grokproject/template/buildout.cfg_tmpl
  A   grokproject/branches/d2m-dual-startup/grokproject/template/etc/
  A   grokproject/branches/d2m-dual-startup/grokproject/template/etc/debug.ini_tmpl
  A   grokproject/branches/d2m-dual-startup/grokproject/template/etc/deploy.ini_tmpl
  A   grokproject/branches/d2m-dual-startup/grokproject/template/etc/site.zcml_tmpl
  A   grokproject/branches/d2m-dual-startup/grokproject/template/etc/zdaemon.conf
  A   grokproject/branches/d2m-dual-startup/grokproject/template/etc/zope.conf
  U   grokproject/branches/d2m-dual-startup/grokproject/template/setup.py_tmpl
  A   grokproject/branches/d2m-dual-startup/grokproject/template/src/+package+/startup.py
  U   grokproject/branches/d2m-dual-startup/tests.txt

-=-
Modified: grokproject/branches/d2m-dual-startup/CHANGES.txt
===================================================================
--- grokproject/branches/d2m-dual-startup/CHANGES.txt	2008-06-12 05:15:44 UTC (rev 87320)
+++ grokproject/branches/d2m-dual-startup/CHANGES.txt	2008-06-12 06:17:02 UTC (rev 87321)
@@ -1,6 +1,14 @@
 Changes
 =======
 
+branch (2008-06-12)
+-------------------
+
+* Support for dual startup of "zopectl" and "paster serve".
+  Modified buildout.cfg, additional templates taken from zopeproject.
+  Both configurations use the same directories/files for filestorage 
+  (parts/data) and logging (parts/zopectl).
+
 0.8 (unreleased)
 ------------------
 

Modified: grokproject/branches/d2m-dual-startup/README.txt
===================================================================
--- grokproject/branches/d2m-dual-startup/README.txt	2008-06-12 05:15:44 UTC (rev 87320)
+++ grokproject/branches/d2m-dual-startup/README.txt	2008-06-12 06:17:02 UTC (rev 87321)
@@ -16,11 +16,30 @@
 
 After the project area has been created successfully, you will find an
 empty Python package in the ``src`` directory in which you can place
-the code for your web application.  To start the Zope server, execute
-``bin/zopectl fg``.
+the code for your web application.  
 
+To start the Zope server, choose one of the two command schemes::
+
+  - ``bin/zopectl fg``
+  
+    starts the twisted server
+    
+  - ``bin/paster serve etc/debug.ini
+  
+    starts the pythonpaste http server with debug enabled
+    
+  - ``bin/paster serve etc/deploy.ini
+  
+    starts the pythonpaste http server without eror console
+    
+When using paster, automatic reloading after code changes can be enabled
+by running::
+
+  - ``bin/paster serve --reload etc/debug.ini
+
 For those who know paster: ``grokproject`` is just a wrapper around a
 paster template.  So instead of running the ``grokproject`` command,
 you can also run:
 
   $ paster create -t grok MammotHerd
+  
\ No newline at end of file

Modified: grokproject/branches/d2m-dual-startup/TODO.txt
===================================================================
--- grokproject/branches/d2m-dual-startup/TODO.txt	2008-06-12 05:15:44 UTC (rev 87320)
+++ grokproject/branches/d2m-dual-startup/TODO.txt	2008-06-12 06:17:02 UTC (rev 87321)
@@ -15,3 +15,13 @@
 * Remove find-links from generated buildout.cfg when grok 0.13 goes
   live.  0.12 depends on find-links to get zope.tal 3.4.0b1 which was
   never released on the cheeseshop.
+
+
+branch
+------
+
+* force HTTPBasicAuth dialog on first access (instead of Error traceback)
+
+* enable restart/shutdown in admin/server console for 'paster serve' mode
+
+  
\ No newline at end of file

Modified: grokproject/branches/d2m-dual-startup/grokproject/template/buildout.cfg_tmpl
===================================================================
--- grokproject/branches/d2m-dual-startup/grokproject/template/buildout.cfg_tmpl	2008-06-12 05:15:44 UTC (rev 87320)
+++ grokproject/branches/d2m-dual-startup/grokproject/template/buildout.cfg_tmpl	2008-06-12 06:17:02 UTC (rev 87321)
@@ -1,6 +1,6 @@
 [buildout]
 develop = .
-parts = app data zopectl i18n test
+parts = app apptwisted data zopectl i18n test
 newest = ${newest}
 extends = versions.cfg
 find-links = http://download.zope.org/distribution
@@ -11,6 +11,15 @@
 versions = versions
 
 [app]
+recipe = zc.recipe.egg
+eggs = ${egg}
+       z3c.evalexception>=2.0
+       Paste
+       PasteScript
+       PasteDeploy
+interpreter = python
+
+[apptwisted]
 recipe = zc.zope3recipes>=0.5.3:application
 eggs = ${egg}
 site.zcml = <include package="${package}" />
@@ -52,7 +61,7 @@
 # this section named so that the start/stop script is called bin/zopectl
 [zopectl]
 recipe = zc.zope3recipes:instance
-application = app
+application = apptwisted
 zope.conf = $${data:zconfig}
 
 [test]

Added: grokproject/branches/d2m-dual-startup/grokproject/template/etc/debug.ini_tmpl
===================================================================
--- grokproject/branches/d2m-dual-startup/grokproject/template/etc/debug.ini_tmpl	                        (rev 0)
+++ grokproject/branches/d2m-dual-startup/grokproject/template/etc/debug.ini_tmpl	2008-06-12 06:17:02 UTC (rev 87321)
@@ -0,0 +1,13 @@
+[filter-app:main]
+# Change the last part from 'ajax' to 'pdb' for a post-mortem debugger
+# on the console:
+use = egg:z3c.evalexception#ajax
+next = zope
+
+[app:zope]
+use = egg:${egg}
+
+[server:main]
+use = egg:Paste#http
+host = 127.0.0.1
+port = 8080
\ No newline at end of file

Added: grokproject/branches/d2m-dual-startup/grokproject/template/etc/deploy.ini_tmpl
===================================================================
--- grokproject/branches/d2m-dual-startup/grokproject/template/etc/deploy.ini_tmpl	                        (rev 0)
+++ grokproject/branches/d2m-dual-startup/grokproject/template/etc/deploy.ini_tmpl	2008-06-12 06:17:02 UTC (rev 87321)
@@ -0,0 +1,7 @@
+[app:main]
+use = egg:${egg}
+
+[server:main]
+use = egg:Paste#http
+host = 127.0.0.1
+port = 8080
\ No newline at end of file

Added: grokproject/branches/d2m-dual-startup/grokproject/template/etc/site.zcml_tmpl
===================================================================
--- grokproject/branches/d2m-dual-startup/grokproject/template/etc/site.zcml_tmpl	                        (rev 0)
+++ grokproject/branches/d2m-dual-startup/grokproject/template/etc/site.zcml_tmpl	2008-06-12 06:17:02 UTC (rev 87321)
@@ -0,0 +1,34 @@
+<configure xmlns="http://namespaces.zope.org/zope"
+           i18n_domain="${package}">
+
+  <include package="${package}" />
+
+  <unauthenticatedPrincipal id="zope.anybody"
+                            title="Unauthenticated User" />
+  <unauthenticatedGroup id="zope.Anybody"
+                        title="Unauthenticated Users" />
+  <authenticatedGroup id="zope.Authenticated"
+                    title="Authenticated Users" />
+  <everybodyGroup id="zope.Everybody"
+                  title="All Users" />
+  <principal id="zope.manager"
+             title="Manager"
+             login=${user}
+             password_manager="Plain Text"
+             password=${passwd}
+             />
+
+  <!-- Replace the following directive if you do not want
+       public access -->
+  <grant permission="zope.View"
+         principal="zope.Anybody" />
+  <grant permission="zope.app.dublincore.view"
+         principal="zope.Anybody" />
+
+  <role id="zope.Manager" title="Site Manager" />
+  <role id="zope.Member" title="Site Member" />
+  <grantAll role="zope.Manager" />
+  <grant role="zope.Manager"
+         principal="zope.manager" />
+
+</configure>
\ No newline at end of file

Added: grokproject/branches/d2m-dual-startup/grokproject/template/etc/zdaemon.conf
===================================================================
--- grokproject/branches/d2m-dual-startup/grokproject/template/etc/zdaemon.conf	                        (rev 0)
+++ grokproject/branches/d2m-dual-startup/grokproject/template/etc/zdaemon.conf	2008-06-12 06:17:02 UTC (rev 87321)
@@ -0,0 +1,8 @@
+<runner>
+  program bin/paster serve etc/deploy.ini
+  daemon on
+  transcript parts/zopectl/zdaemon.log
+  socket-name parts/zopectl/zdaemonsock
+  # Enable this to run the child process as a different user
+  # user zope
+</runner>
\ No newline at end of file

Added: grokproject/branches/d2m-dual-startup/grokproject/template/etc/zope.conf
===================================================================
--- grokproject/branches/d2m-dual-startup/grokproject/template/etc/zope.conf	                        (rev 0)
+++ grokproject/branches/d2m-dual-startup/grokproject/template/etc/zope.conf	2008-06-12 06:17:02 UTC (rev 87321)
@@ -0,0 +1,39 @@
+# Identify the component configuration used to define the site:
+site-definition etc/site.zcml
+
+<zodb>
+  # Standard Filestorage
+  <filestorage>
+    path parts/data/Data.fs
+  </filestorage>
+
+# Uncomment this if you want to connect to a ZEO server instead:
+#  <zeoclient>
+#    server localhost:8100
+#    storage 1
+#    # ZEO client cache, in bytes
+#    cache-size 20MB
+#    # Uncomment to have a persistent disk cache
+#    #client zeo1
+#  </zeoclient>
+</zodb>
+
+<eventlog>
+  # This sets up logging to both a file and to standard output
+  # (STDOUT).  The "path" setting can be a relative or absolute
+  # filesystem path or the tokens STDOUT or STDERR.
+
+  <logfile>
+    path parts/zopectl/z3.log
+    formatter zope.exceptions.log.Formatter
+  </logfile>
+
+  <logfile>
+    path STDOUT
+    formatter zope.exceptions.log.Formatter
+  </logfile>
+</eventlog>
+
+# Comment this line to disable developer mode.  This should be done in
+# production
+devmode on
\ No newline at end of file

Modified: grokproject/branches/d2m-dual-startup/grokproject/template/setup.py_tmpl
===================================================================
--- grokproject/branches/d2m-dual-startup/grokproject/template/setup.py_tmpl	2008-06-12 05:15:44 UTC (rev 87320)
+++ grokproject/branches/d2m-dual-startup/grokproject/template/setup.py_tmpl	2008-06-12 06:17:02 UTC (rev 87321)
@@ -23,7 +23,11 @@
                         'z3c.testsetup',
                         # Add extra requirements here
                         ],
-      entry_points="""
-      # Add entry points here
+      entry_points = """
+      [console_scripts]
+      ${package}-debug = ${package}.startup:interactive_debug_prompt
+      ${package}-ctl = ${package}.startup:zdaemon_controller
+      [paste.app_factory]
+      main = ${package}.startup:application_factory
       """,
       )

Added: grokproject/branches/d2m-dual-startup/grokproject/template/src/+package+/startup.py
===================================================================
--- grokproject/branches/d2m-dual-startup/grokproject/template/src/+package+/startup.py	                        (rev 0)
+++ grokproject/branches/d2m-dual-startup/grokproject/template/src/+package+/startup.py	2008-06-12 06:17:02 UTC (rev 87321)
@@ -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)
\ No newline at end of file

Modified: grokproject/branches/d2m-dual-startup/tests.txt
===================================================================
--- grokproject/branches/d2m-dual-startup/tests.txt	2008-06-12 05:15:44 UTC (rev 87320)
+++ grokproject/branches/d2m-dual-startup/tests.txt	2008-06-12 06:17:02 UTC (rev 87321)
@@ -25,6 +25,7 @@
     bootstrap.py
     buildout.cfg
     develop-eggs
+    etc
     parts
     setup.py
     src
@@ -38,5 +39,7 @@
     app_templates
     configure.zcml
     ftesting.zcml
+    startup.py
     static
     tests.py
+    
\ No newline at end of file



More information about the Checkins mailing list