[Checkins] SVN: grokcore.startup/branches/ipython-debug-shell/src/grokcore/startup/ make the original interactive_debug_prompt() function return an ipython prompt or the "classic" one

Jan Wijbrand Kolman cvs-admin at zope.org
Tue May 1 14:23:08 UTC 2012


Log message for revision 125496:
  make the original interactive_debug_prompt() function return an ipython prompt or the "classic" one

Changed:
  U   grokcore.startup/branches/ipython-debug-shell/src/grokcore/startup/README.txt
  U   grokcore.startup/branches/ipython-debug-shell/src/grokcore/startup/__init__.py
  U   grokcore.startup/branches/ipython-debug-shell/src/grokcore/startup/startup.py

-=-
Modified: grokcore.startup/branches/ipython-debug-shell/src/grokcore/startup/README.txt
===================================================================
--- grokcore.startup/branches/ipython-debug-shell/src/grokcore/startup/README.txt	2012-05-01 13:28:48 UTC (rev 125495)
+++ grokcore.startup/branches/ipython-debug-shell/src/grokcore/startup/README.txt	2012-05-01 14:23:02 UTC (rev 125496)
@@ -337,9 +337,9 @@
     ... pprint(__name__)""")
     >>>
     >>> sys.argv = ['get_debugger', script]
-    >>> from grokcore.startup import get_debugger
+    >>> from grokcore.startup import interactive_debug_prompt
     >>> try:
-    ...     get_debugger(zope_conf=zopeconf)
+    ...     interactive_debug_prompt(zope_conf=zopeconf)
     ... except SystemExit:
     ...     # Catch the exit from the interactive prompt as it would
     ...     # exit this test as well.

Modified: grokcore.startup/branches/ipython-debug-shell/src/grokcore/startup/__init__.py
===================================================================
--- grokcore.startup/branches/ipython-debug-shell/src/grokcore/startup/__init__.py	2012-05-01 13:28:48 UTC (rev 125495)
+++ grokcore.startup/branches/ipython-debug-shell/src/grokcore/startup/__init__.py	2012-05-01 14:23:02 UTC (rev 125496)
@@ -12,27 +12,8 @@
 #
 ##############################################################################
 # Make this a package.
-from grokcore.startup.startup import (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
-    except ImportError:
-        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)
-
+from grokcore.startup.startup import (
+    application_factory,
+    debug_application_factory,
+    interactive_debug_prompt,
+    )

Modified: grokcore.startup/branches/ipython-debug-shell/src/grokcore/startup/startup.py
===================================================================
--- grokcore.startup/branches/ipython-debug-shell/src/grokcore/startup/startup.py	2012-05-01 13:28:48 UTC (rev 125495)
+++ grokcore.startup/branches/ipython-debug-shell/src/grokcore/startup/startup.py	2012-05-01 14:23:02 UTC (rev 125496)
@@ -32,9 +32,7 @@
     # Return the created application
     return app
 
-def interactive_debug_prompt(
-    zope_conf=os.path.join('parts', 'etc', 'zope.conf')):
-
+def _classic_debug_prompt(zope_conf):
     db = zope.app.wsgi.config(zope_conf)
     debugger = zope.app.debug.Debugger.fromDatabase(db)
     globals_ = {
@@ -67,3 +65,14 @@
         "The 'app' variable contains the Debugger, 'app.publish(path)' "
         "simulates a request.")
     code.interact(banner=banner, local=globals_)
+
+def _ipython_debug_prompt(zope_conf):
+    from grokcore.startup.debug import ipython_debug_prompt
+    return ipython_debug_prompt(zope_conf)
+
+def interactive_debug_prompt(zope_conf):
+    try:
+        import IPython
+    except ImportError:
+        return _classic_debug_prompt(zope_conf)
+    return _ipython_debug_prompt(zope_conf)



More information about the checkins mailing list