[Checkins] SVN: grokcore.startup/branches/ipython-debug-shell/ Rename new ipython debugger and clean up import stuff a bit.

Ulrich Fouquet cvs-admin at zope.org
Sun Apr 29 15:31:20 UTC 2012


Log message for revision 125395:
  Rename new ipython debugger and clean up import stuff a bit.

Changed:
  U   grokcore.startup/branches/ipython-debug-shell/buildout.cfg
  U   grokcore.startup/branches/ipython-debug-shell/setup.py
  U   grokcore.startup/branches/ipython-debug-shell/src/grokcore/startup/__init__.py
  U   grokcore.startup/branches/ipython-debug-shell/src/grokcore/startup/debug.py

-=-
Modified: grokcore.startup/branches/ipython-debug-shell/buildout.cfg
===================================================================
--- grokcore.startup/branches/ipython-debug-shell/buildout.cfg	2012-04-29 15:13:09 UTC (rev 125394)
+++ grokcore.startup/branches/ipython-debug-shell/buildout.cfg	2012-04-29 15:31:16 UTC (rev 125395)
@@ -17,5 +17,5 @@
 
 [test]
 recipe = zc.recipe.testrunner
-eggs = grokcore.startup
+eggs = grokcore.startup [test]
 defaults = ['--tests-pattern', '^f?tests$', '-v']

Modified: grokcore.startup/branches/ipython-debug-shell/setup.py
===================================================================
--- grokcore.startup/branches/ipython-debug-shell/setup.py	2012-04-29 15:13:09 UTC (rev 125394)
+++ grokcore.startup/branches/ipython-debug-shell/setup.py	2012-04-29 15:31:16 UTC (rev 125395)
@@ -18,6 +18,7 @@
     'zope.interface',
     'zope.testing',
     'zope.security',
+    'zope.securitypolicy',
     ]
 
 debug_requires = [

Modified: grokcore.startup/branches/ipython-debug-shell/src/grokcore/startup/__init__.py
===================================================================
--- grokcore.startup/branches/ipython-debug-shell/src/grokcore/startup/__init__.py	2012-04-29 15:13:09 UTC (rev 125394)
+++ grokcore.startup/branches/ipython-debug-shell/src/grokcore/startup/__init__.py	2012-04-29 15:31:16 UTC (rev 125395)
@@ -13,15 +13,26 @@
 ##############################################################################
 # Make this a package.
 from grokcore.startup.startup import (application_factory,
-                                      debug_application_factory)
+                                      debug_application_factory,
+                                      interactive_debug_prompt,)
 
+
+
 def get_debugger(zope_conf):
+    """Get an interactive debugger.
+
+    If IPython is available you get an IPython-based debugger with
+    lots of fancy features (see :mod:`grokcore.startup.debug` for
+    details.
+
+    Otherwise you get a plain debugger in pdb style.
+    """
     try:
         import IPython
-        from grokcore.startup.debug import GrokDebug
-        grokd = GrokDebug(zope_conf)
-        from grokcore.startup.debug import interactive_debug_prompt
-        return interactive_debug_prompt(zope_conf, grokd)
     except ImportError:
-        from grokcore.startup.startup import interactive_debug_prompt
         return interactive_debug_prompt(zope_conf)
+    # late import: the debug module is only importable with IPython
+    # available.
+    from grokcore.startup.debug import ipython_debug_prompt
+    return ipython_debug_prompt(zope_conf)
+

Modified: grokcore.startup/branches/ipython-debug-shell/src/grokcore/startup/debug.py
===================================================================
--- grokcore.startup/branches/ipython-debug-shell/src/grokcore/startup/debug.py	2012-04-29 15:13:09 UTC (rev 125394)
+++ grokcore.startup/branches/ipython-debug-shell/src/grokcore/startup/debug.py	2012-04-29 15:31:16 UTC (rev 125395)
@@ -70,7 +70,8 @@
         shell.user_ns.update(self.ns())
 
     def get_security_settings(self, path):
-        pprint(settingsForObject(get_context_by_path(self.get_start_context(path), path)))
+        pprint(settingsForObject(get_context_by_path(
+                    self.get_start_context(path), path)))
 
     def sync(self):
         self.root._p_jar.sync()
@@ -180,7 +181,8 @@
             if obj.__name__.startswith(tail)]
 
 
-def interactive_debug_prompt(zope_conf, grokd):
+def ipython_debug_prompt(zope_conf):
+    grokd = GrokDebug(zope_conf)
     banner = textwrap.dedent(
         """\
         IPython shell for Grok.



More information about the checkins mailing list