diff options
author | RaNaN <Mast3rRaNaN@hotmail.de> | 2012-06-03 17:45:10 +0200 |
---|---|---|
committer | RaNaN <Mast3rRaNaN@hotmail.de> | 2012-06-03 17:45:10 +0200 |
commit | 0d2d6daef850ac6bcc7fafccd230e52d2a862c2c (patch) | |
tree | 73e36baba63e4c0895149bab9fe698d32f405828 /module/utils | |
parent | small typo fixes and TODOs (diff) | |
download | pyload-0d2d6daef850ac6bcc7fafccd230e52d2a862c2c.tar.xz |
updates for database + api
Diffstat (limited to 'module/utils')
-rw-r--r-- | module/utils/__init__.py | 9 |
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""" |