cubicweb/utils.py
changeset 12743 a74e77469540
parent 12567 26744ad37953
child 12753 38d24fb2ae48
--- a/cubicweb/utils.py	Wed Oct 16 14:49:38 2019 +0200
+++ b/cubicweb/utils.py	Wed May 22 14:23:01 2019 +0200
@@ -565,6 +565,17 @@
     return 'javascript: ' + PERCENT_IN_URLQUOTE_RE.sub(r'%25', javascript_code)
 
 
+def get_pdb():
+    "return ipdb if its installed, otherwise pdb"
+    try:
+        import ipdb
+    except ImportError:
+        import pdb
+        return pdb
+    else:
+        return ipdb
+
+
 logger = getLogger('cubicweb.utils')
 
 class QueryCache(object):