diff options
author | Wade Brainerd <wadetb@gmail.com> | 2008-05-23 22:58:23 (GMT) |
---|---|---|
committer | Wade Brainerd <wadetb@gmail.com> | 2008-05-23 22:58:23 (GMT) |
commit | dd58bf72d6799438d8033cf7de6bc26a711734c3 (patch) | |
tree | 12c5c75e465b5c7889857116839f4dcd215fc230 /mwlib/caller.py | |
parent | 02242194e156b00cef18506ab37d4a51ba36ac57 (diff) |
Rename step 1. Breaking the renames up because Git fails to recognize them when too many are done at once.
Diffstat (limited to 'mwlib/caller.py')
-rwxr-xr-x | mwlib/caller.py | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/mwlib/caller.py b/mwlib/caller.py new file mode 100755 index 0000000..583a123 --- /dev/null +++ b/mwlib/caller.py @@ -0,0 +1,20 @@ +#! /usr/bin/env python + +# Copyright (c) 2007-2008 PediaPress GmbH +# See README.txt for additional licensing information. + +import sys +import os + +def caller(n=2): + """return caller as string""" + f = sys._getframe(n) + return "%s:%s" % (f.f_code.co_filename, f.f_lineno) + +def short(n=2): + """return caller as string""" + f = sys._getframe(n) + return "%s:%s" % (os.path.basename(f.f_code.co_filename), f.f_lineno) + +def callerframe(n=2): + return sys._getframe(n) |