Return to Snippet

Revision: 48041
at June 22, 2011 16:55 by jarnaldich


Initial Code
import os 
def rel(*x):
    return os.path.normcase(os.path.join(os.path.dirname(__file__), *x))

Initial URL


Initial Description
Sometimes (ex. django templates section at setting.py), a function expects an absolute path, but it's more practical when developing to refer it to the current file position in our code base. The rel function does exactly that.

Initial Title
Get an absolute from a path relative to the current file

Initial Tags
path

Initial Language
Python