diff options
author | RaNaN <Mast3rRaNaN@hotmail.de> | 2012-01-01 13:36:59 +0100 |
---|---|---|
committer | RaNaN <Mast3rRaNaN@hotmail.de> | 2012-01-01 13:36:59 +0100 |
commit | 35742c2cb023ac49ab3056752d2040cdb030cc2b (patch) | |
tree | d0f22f591b2b81ab24a982a44820a3d86ba5eea3 /module/utils | |
parent | missing import (diff) | |
download | pyload-35742c2cb023ac49ab3056752d2040cdb030cc2b.tar.xz |
Happy new Year !
Diffstat (limited to 'module/utils')
-rw-r--r-- | module/utils/__init__.py | 4 | ||||
-rw-r--r-- | module/utils/fs.py | 5 |
2 files changed, 8 insertions, 1 deletions
diff --git a/module/utils/__init__.py b/module/utils/__init__.py index 0d68448cb..a237fde9b 100644 --- a/module/utils/__init__.py +++ b/module/utils/__init__.py @@ -157,6 +157,10 @@ def fixup(m): return text # leave as is +def has_method(obj, name): + """ checks if 'name' was defined in obj, (false if it was inhereted) """ + return name in obj.__dict__ + def html_unescape(text): """Removes HTML or XML character references and entities from a text string""" return re.sub("&#?\w+;", fixup, text) diff --git a/module/utils/fs.py b/module/utils/fs.py index 23f87a326..037165b6b 100644 --- a/module/utils/fs.py +++ b/module/utils/fs.py @@ -20,7 +20,10 @@ else: # FS utilities def chmod(path, mode): - return os.chmod(fs_encode(path), mode) + try: + return os.chmod(fs_encode(path), mode) + except : + pass def chown(path, uid, gid): return os.chown(fs_encode(path), uid, gid) |