Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
path: root/mwlib/caller.py
blob: 583a123ce63ec25c08c21bd3f9da29ef74621465 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
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)