diff options
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) |