diff options
| author | 2009-12-26 21:17:45 +0100 | |
|---|---|---|
| committer | 2009-12-26 21:17:45 +0100 | |
| commit | 15841561a8e5650d88e4af477b8e4f8f96a81253 (patch) | |
| tree | d1cbee2d936ed90fdf99df90b1bcec9b31e58257 /module/Plugin.py | |
| parent | fixed view update (diff) | |
| download | pyload-15841561a8e5650d88e4af477b8e4f8f96a81253.tar.xz | |
pluginconfig now in xml
Diffstat (limited to 'module/Plugin.py')
| -rw-r--r-- | module/Plugin.py | 23 | 
1 files changed, 12 insertions, 11 deletions
| diff --git a/module/Plugin.py b/module/Plugin.py index 7e6ca4e35..9390cbe07 100644 --- a/module/Plugin.py +++ b/module/Plugin.py @@ -20,15 +20,16 @@  import ConfigParser  import logging  import re -from os.path import exists +from os.path import exists, join  from module.network.Request import Request +from module.XMLConfigParser import XMLConfigParser  class Plugin():      def __init__(self, parent): -        self.parser = ConfigParser.SafeConfigParser() +        self.configparser = XMLConfigParser(join("module","config","plugin.xml"), join("module","config","plugin_default.xml"))          self.config = {}          props = {}          props['name'] = "BasePlugin" @@ -112,19 +113,19 @@ class Plugin():          self.req.download(url, location)      def set_config(self): -        pass +        for k, v in self.config: +            self.configparser.set(self.props['name'], k, v)      def get_config(self, value): -        self.parser.read("pluginconfig") -        return self.parser.get(self.props['name'], value) +        self.configparser.loadData() +        return self.configparser.get(self.props['name'], value)      def read_config(self): -        self.parser.read("pluginconfig") - -        if self.parser.has_section(self.props['name']): -            for option in self.parser.options(self.props['name']): -                self.config[option] = self.parser.get(self.props['name'], option, raw=True) -                self.config[option] = False if self.config[option].lower() == 'false' else self.config[option] +        self.configparser.loadData() +        try: +            self.config = self.configparser.getConfig()[self.props['name']] +        except: +            pass      def init_ocr(self):          modul = __import__("module.captcha." + self.props['name'], fromlist=['captcha']) | 
