From 9a3aaaad1f569ca78bf4fcac8d107ed778f8639b Mon Sep 17 00:00:00 2001 From: RaNaN Date: Sat, 25 Sep 2010 13:30:38 +0200 Subject: dir chown --- module/ConfigParser.py | 2 +- module/plugins/Plugin.py | 9 +++++++++ module/web/run_server.py | 1 + 3 files changed, 11 insertions(+), 1 deletion(-) (limited to 'module') diff --git a/module/ConfigParser.py b/module/ConfigParser.py index b8da9a32f..714e34ca9 100644 --- a/module/ConfigParser.py +++ b/module/ConfigParser.py @@ -76,7 +76,7 @@ class ConfigParser: f = open("plugin.conf", "wb") f.write("version: "+str(CONF_VERSION)) f.close() - print "Old version of config was replaced" + print "Old version of plugin-config replaced" except: if n < 3: sleep(0.3) diff --git a/module/plugins/Plugin.py b/module/plugins/Plugin.py index e7914c287..a12dfa686 100644 --- a/module/plugins/Plugin.py +++ b/module/plugins/Plugin.py @@ -267,6 +267,15 @@ class Plugin(object): if not exists(location): makedirs(location, int(self.core.config["permission"]["folder"],8)) + if self.core.config["permission"]["change_dl"] and os.name != "nt": + try: + uid = getpwnam(self.config["permission"]["user"])[2] + gid = getgrnam(self.config["permission"]["group"])[2] + + chown(location, uid, gid) + except Exception,e: + self.log.warning(_("Setting User and Group failed: %s") % str(e)) + name = self.pyfile.name.encode(sys.getfilesystemencoding(), "replace") newname = self.req.download(url, name, location, get, post, ref, cookies) diff --git a/module/web/run_server.py b/module/web/run_server.py index 34fca46c8..2dc97353a 100755 --- a/module/web/run_server.py +++ b/module/web/run_server.py @@ -54,6 +54,7 @@ def handle(* args): try: handler = AdminMediaHandler(WSGIHandler(), admin_media_path) run(addr, int(port), handler) + #@TODO catch unimportant Broken Pipe Errors except WSGIServerException, e: # Use helpful error messages instead of ugly tracebacks. -- cgit v1.2.3