Commits

defnull committed 4705fe9

Try-blocks are virtually free, so lets speed up the common case.

  • Participants
  • Parent commits 5a6bd7f
  • Branches context

Comments (0)

Files changed (1)

 
 def get_context():
     ''' Return request context associated with calling thread, or None. '''
-    return getattr(_lctx, 'context', None) or getattr(_lctx, '_bc_copy', None)
+    try: return _lctx.context
+    except AttributeError:
+        try: return _lctx._bc_copy
+        except AttributeError:
+            return None
 
 
 def _redirecting_property(getter, name):