summaryrefslogtreecommitdiffstats
path: root/module/utils
diff options
context:
space:
mode:
authorGravatar RaNaN <Mast3rRaNaN@hotmail.de> 2012-01-13 23:24:21 +0100
committerGravatar RaNaN <Mast3rRaNaN@hotmail.de> 2012-01-13 23:24:21 +0100
commitc7ad1cc5b4a5d190a060e3ddd9274c3065da6708 (patch)
tree639062525ddde3b8c785f26a0f4091ec10d9e204 /module/utils
parentfixed pyflakes and sloccount (diff)
downloadpyload-c7ad1cc5b4a5d190a060e3ddd9274c3065da6708.tar.xz
plugin unit test, closed #499, #500
Diffstat (limited to 'module/utils')
-rw-r--r--module/utils/__init__.py7
-rw-r--r--module/utils/fs.py2
2 files changed, 8 insertions, 1 deletions
diff --git a/module/utils/__init__.py b/module/utils/__init__.py
index b68928f04..bf11fbc69 100644
--- a/module/utils/__init__.py
+++ b/module/utils/__init__.py
@@ -160,6 +160,13 @@ def accumulate(it, inv_map=None):
def to_string(value):
return str(value) if not isinstance(value, basestring) else value
+def to_int(string):
+ """ return int from string or 0 """
+ try:
+ return int(string)
+ except ValueError:
+ return 0
+
def from_string(value, typ=None):
""" cast value to given type, unicode for strings """
diff --git a/module/utils/fs.py b/module/utils/fs.py
index 03832e368..c1927423a 100644
--- a/module/utils/fs.py
+++ b/module/utils/fs.py
@@ -35,7 +35,7 @@ def remove(path):
def exists(path):
return os.path.exists(fs_encode(path))
-def makedirs(path, mode=0660):
+def makedirs(path, mode=0777):
return os.makedirs(fs_encode(path), mode)
def listdir(path):