API Documentation for urlpath

Autogenerated API Docs

Contents

This is an autogenerated API Doc for the module "urlpath".

It was generated on: Monday, January 01 06:46 PM.

Functions

nativejoin

def nativejoin(base, path):

Joins two paths - returning a native file path.

Given a base path and a relative location, (in posix format) return a file path in a (relatively) OS native way.

pathjoin

def pathjoin(base, *paths):

Join paths to a base, observing pardir.

If base doesn't end with '/' we assume it's a file rather than a directory.
(so we get rid of it)

relpath

def relpath(origin, dest):

Given two absolute paths, work out a path from origin to destination.

Assumes UNIX/URL type relative paths. If origin doesn't end with '/' we assume it's a file rather than a directory.

If the same paths are passed in :
if the path ends with ('/') then we return '' else we return the last part of the path (presumably a filename)

If origin or dest don't start with '/' then we add it.

We are assuming relative paths on the same device
(i.e. same top level directory)

relpathto

def relpathto(thisdir, origin, dest):

Given two paths relative to a directory, work out a path from origin to destination.

Assumes UNIX/URL type relative paths. If origin doesn't end with '/' we assume it's a file rather than a directory.

If the same paths are passed in :
if the path ends with ('/') then we return '' else we return the last part of the path (presumably a filename)
If thisdir doesn't start with '/' then we add one
(this makes the top level of thisdir our root directory)

testJoin

def testJoin():

testRelpath

def testRelpath():

testRelpathto

def testRelpathto():

testRelpathto2

def testRelpathto2():

tslash

def tslash(apath):

Add a trailing slash to a path if it needs one.

Doesn't use os.sep because you end up jiggered on windoze - when you want separators for URLs.