summaryrefslogtreecommitdiffstats
path: root/module/web
diff options
context:
space:
mode:
authorGravatar RaNaN <Mast3rRaNaN@hotmail.de> 2010-11-27 00:27:42 +0100
committerGravatar RaNaN <Mast3rRaNaN@hotmail.de> 2010-11-27 00:27:42 +0100
commitefb8bb0d3f626d1f38950b677fc22e4703e777f4 (patch)
treeb90827b4adacd539bef6d55a615f2d176d57d2dd /module/web
parentrelpath for 2.5 (diff)
downloadpyload-efb8bb0d3f626d1f38950b677fc22e4703e777f4.tar.xz
fix
Diffstat (limited to 'module/web')
-rw-r--r--module/web/pyload/templatetags/quotepath.py14
-rw-r--r--module/web/pyload/views.py14
2 files changed, 13 insertions, 15 deletions
diff --git a/module/web/pyload/templatetags/quotepath.py b/module/web/pyload/templatetags/quotepath.py
index f3d9d7b2c..3678b9391 100644
--- a/module/web/pyload/templatetags/quotepath.py
+++ b/module/web/pyload/templatetags/quotepath.py
@@ -1,5 +1,4 @@
import os
-from posixpath import curdir, sep, pardir, join
from django.template.defaultfilters import stringfilter
from django import template
@@ -48,18 +47,5 @@ def path_make_relative(path):
else:
return p + os.path.sep
-def relpath(path, start=curdir):
- """Return a relative version of a path"""
- if not path:
- raise ValueError("no path specified")
- start_list = posixpath.abspath(start).split(sep)
- path_list = posixpath.abspath(path).split(sep)
- # Work out how much of the filepath is shared by start and path.
- i = len(posixpath.commonprefix([start_list, path_list]))
- rel_list = [pardir] * (len(start_list)-i) + path_list[i:]
- if not rel_list:
- return curdir
- return join(*rel_list)
-
register.filter(path_make_relative)
diff --git a/module/web/pyload/views.py b/module/web/pyload/views.py
index 62c405339..0da21f556 100644
--- a/module/web/pyload/views.py
+++ b/module/web/pyload/views.py
@@ -20,7 +20,19 @@ from pyload.templatetags import quotepath
try:
from os.path import relpath
except:
- from pyload.templatetags import relpath
+ from posixpath import curdir, sep, pardir
+ def relpath(path, start=curdir):
+ """Return a relative version of a path"""
+ if not path:
+ raise ValueError("no path specified")
+ start_list = os.path.abspath(start).split(sep)
+ path_list = os.path.abspath(path).split(sep)
+ # Work out how much of the filepath is shared by start and path.
+ i = len(os.path.commonprefix([start_list, path_list]))
+ rel_list = [pardir] * (len(start_list)-i) + path_list[i:]
+ if not rel_list:
+ return curdir
+ return join(*rel_list)
from django.conf import settings
from django.contrib.auth.decorators import login_required