Example #1
0
 def link(self, name, **variables):
     return misc.relpath(self.url_for(name, **variables), self.path_info)
Example #2
0
def test_relpath():
    eq_(misc.relpath('a/b/c','.'), 'a/b/c')
    eq_(misc.relpath('.','a/b/c'), 'a/b/c')
    eq_(misc.relpath('a/b/file','a/b/d/file'),'../file')
    eq_(misc.relpath('a/b/d/file','a/b/file'),'d/file')

    eq_(misc.relpath('a/file','a/b/c/file'),'../../file')
    eq_(misc.relpath('a/b/file','a/b/c/file'),'../file')
    eq_(misc.relpath('a/b/c/file','a/b/c/file'),'file')

    eq_(misc.relpath('a/b/c/e/file','a/b/c/e/file'),'file')
    eq_(misc.relpath('a/b/c/e/file','a/b/c/file'),'e/file')
    eq_(misc.relpath('a/b/c/e/file','a/b/file'),'c/e/file')
    eq_(misc.relpath('a/b/c/e/file','a/file'),'b/c/e/file')

    eq_(misc.relpath('h/b/c/e/file','a'),'h/b/c/e/file')