summaryrefslogtreecommitdiffstats
path: root/module/utils
diff options
context:
space:
mode:
authorGravatar RaNaN <Mast3rRaNaN@hotmail.de> 2012-06-03 17:45:10 +0200
committerGravatar RaNaN <Mast3rRaNaN@hotmail.de> 2012-06-03 17:45:10 +0200
commit0d2d6daef850ac6bcc7fafccd230e52d2a862c2c (patch)
tree73e36baba63e4c0895149bab9fe698d32f405828 /module/utils
parentsmall typo fixes and TODOs (diff)
downloadpyload-0d2d6daef850ac6bcc7fafccd230e52d2a862c2c.tar.xz
updates for database + api
Diffstat (limited to 'module/utils')
-rw-r--r--module/utils/__init__.py9
1 files changed, 9 insertions, 0 deletions
diff --git a/module/utils/__init__.py b/module/utils/__init__.py
index 37e65c738..28d734bb5 100644
--- a/module/utils/__init__.py
+++ b/module/utils/__init__.py
@@ -212,6 +212,15 @@ def from_string(value, typ=None):
else:
return value
+def get_index(l, value):
+ """ .index method that also works on tuple and python 2.5 """
+ for pos, t in enumerate(l):
+ if t == value:
+ return pos
+
+ # Matches behavior of list.index
+ raise ValueError("list.index(x): x not in list")
+
def html_unescape(text):
"""Removes HTML or XML character references and entities from a text string"""