[Checkins] SVN: bluebream/trunk/ LP #506879: debug shell added. Basic usage::

Baiju M baiju.m.mail at gmail.com
Wed Jan 13 06:18:52 EST 2010


Log message for revision 108102:
  LP #506879: debug shell added. Basic usage::
  
      ./bin/paster shell debug.ini
  

Changed:
  U   bluebream/trunk/CHANGES.txt
  U   bluebream/trunk/README.txt
  U   bluebream/trunk/docs/source/gettingstarted.rst
  U   bluebream/trunk/docs/source/tutorial.rst
  U   bluebream/trunk/src/bluebream/project_template/setup.py_tmpl
  A   bluebream/trunk/src/bluebream/project_template/src/+namespace_package+/+main_package+/debug.py
  U   bluebream/trunk/src/bluebream/tests/bluebream.txt

-=-
Modified: bluebream/trunk/CHANGES.txt
===================================================================
--- bluebream/trunk/CHANGES.txt	2010-01-13 11:10:19 UTC (rev 108101)
+++ bluebream/trunk/CHANGES.txt	2010-01-13 11:18:51 UTC (rev 108102)
@@ -4,6 +4,10 @@
 0.1.9 (unreleased)
 ------------------
 
+- LP #506879: debug shell added. Basic usage::
+
+    ./bin/paster shell debug.ini
+
 0.1.8 (2010-01-12)
 ------------------
 

Modified: bluebream/trunk/README.txt
===================================================================
--- bluebream/trunk/README.txt	2010-01-13 11:10:19 UTC (rev 108101)
+++ bluebream/trunk/README.txt	2010-01-13 11:18:51 UTC (rev 108102)
@@ -121,6 +121,10 @@
 
   $ ./bin/test
 
+To get the debug shell::
+
+  $ ./bin/paster shell debug.ini
+
 To run the server::
 
   $ ./bin/paster serve debug.ini

Modified: bluebream/trunk/docs/source/gettingstarted.rst
===================================================================
--- bluebream/trunk/docs/source/gettingstarted.rst	2010-01-13 11:10:19 UTC (rev 108101)
+++ bluebream/trunk/docs/source/gettingstarted.rst	2010-01-13 11:18:51 UTC (rev 108102)
@@ -170,6 +170,10 @@
 
   $ ./bin/test
 
+To get the debug shell::
+
+  $ ./bin/paster shell debug.ini
+
 To run the server::
 
   $ ./bin/paster serve debug.ini

Modified: bluebream/trunk/docs/source/tutorial.rst
===================================================================
--- bluebream/trunk/docs/source/tutorial.rst	2010-01-13 11:10:19 UTC (rev 108101)
+++ bluebream/trunk/docs/source/tutorial.rst	2010-01-13 11:18:51 UTC (rev 108102)
@@ -80,6 +80,7 @@
           Copying app.py to ./ticketcollector/src/tc/main/app.py
           Copying application.zcml_tmpl to ./ticketcollector/src/tc/main/application.zcml
           Copying configure.zcml_tmpl to ./ticketcollector/src/tc/main/configure.zcml
+          Copying debug.py to ./sample/src/test_name/test_main/debug.py
           Copying ftesting.zcml_tmpl to ./ticketcollector/src/tc/main/ftesting.zcml
           Copying interfaces.py to ./ticketcollector/src/tc/main/interfaces.py
           Copying securitypolicy.zcml_tmpl to ./ticketcollector/src/tc/main/securitypolicy.zcml

Modified: bluebream/trunk/src/bluebream/project_template/setup.py_tmpl
===================================================================
--- bluebream/trunk/src/bluebream/project_template/setup.py_tmpl	2010-01-13 11:10:19 UTC (rev 108101)
+++ bluebream/trunk/src/bluebream/project_template/setup.py_tmpl	2010-01-13 11:18:51 UTC (rev 108102)
@@ -58,5 +58,8 @@
       entry_points = """
       [paste.app_factory]
       main = ${namespace_package}.${main_package}.startup:application_factory
+
+      [paste.global_paster_command]
+      shell = ${namespace_package}.${main_package}.debug:Shell
       """,
       )

Added: bluebream/trunk/src/bluebream/project_template/src/+namespace_package+/+main_package+/debug.py
===================================================================
--- bluebream/trunk/src/bluebream/project_template/src/+namespace_package+/+main_package+/debug.py	                        (rev 0)
+++ bluebream/trunk/src/bluebream/project_template/src/+namespace_package+/+main_package+/debug.py	2010-01-13 11:18:51 UTC (rev 108102)
@@ -0,0 +1,35 @@
+import os
+from paste.script import command
+from paste.deploy import appconfig
+from zope.app.debug.debug import Debugger
+import zope.app.wsgi
+
+
+class Shell(command.Command):
+
+    max_args = 1
+    min_args = 1
+
+    usage = "CONFIG_FILE"
+    summary = "Python debug shell with BlueBream application loaded"
+    group_name = "bluebream"
+
+    parser = command.Command.standard_parser(verbose=True)
+
+    def command(self):
+        cwd = os.getcwd()
+        config_file = self.args[0]
+        config_name = 'config:%s' % config_file
+        conf = appconfig(config_name, relative_to=cwd)
+        zope_conf = conf['zope_conf']
+        db = zope.app.wsgi.config(zope_conf)
+        debugger = 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.")
+        __import__('code').interact(banner=banner,
+                                    local={'debugger': debugger,
+                                           'app': debugger,
+                                           'root': debugger.root()})

Modified: bluebream/trunk/src/bluebream/tests/bluebream.txt
===================================================================
--- bluebream/trunk/src/bluebream/tests/bluebream.txt	2010-01-13 11:10:19 UTC (rev 108101)
+++ bluebream/trunk/src/bluebream/tests/bluebream.txt	2010-01-13 11:18:51 UTC (rev 108102)
@@ -62,6 +62,7 @@
         Copying app.py to ./sample/src/test_name/test_main/app.py
         Copying application.zcml_tmpl to ./sample/src/test_name/test_main/application.zcml
         Copying configure.zcml_tmpl to ./sample/src/test_name/test_main/configure.zcml
+        Copying debug.py to ./sample/src/test_name/test_main/debug.py
         Copying ftesting.zcml_tmpl to ./sample/src/test_name/test_main/ftesting.zcml
         Copying interfaces.py to ./sample/src/test_name/test_main/interfaces.py
         Copying securitypolicy.zcml_tmpl to ./sample/src/test_name/test_main/securitypolicy.zcml



More information about the checkins mailing list