예제 #1
0
 def new_from_conf(cls):
     db_conf = conf.get_config("taemin").get("database", {})
     return cls(db_conf.get("type", "sqlite"),
                name=db_conf.get("name", "/etc/taemin/taemin.db"),
                user=db_conf.get("user", ""),
                password=db_conf.get("password", ""),
                host=db_conf.get("host", "localhost"))
예제 #2
0
    def __init__(self, *args):
        self.sd_notify = sdnotify.get_notifier()
        self.conf = conf.get_config("taemin")
        self.conf.load(*args)

        general_conf = self.conf.get("general", {})
        self.chans = general_conf.get("chans")
        if not self.chans:
            self.chans = []
        self.name = general_conf.get("name", "Taemin")
        self.desc = general_conf.get("desc", "Le Splendide")
        self.server = general_conf.get("server", "")
        self.port = general_conf.get("port", 6667)
        self.tls = general_conf.get("tls", False)

        self.log = logger.Logger()
        self.mailation = courriel.Mailage(self)

        if self.tls == True:
            ssl_factory = irc.connection.Factory(wrapper=ssl.wrap_socket)
        else:
            ssl_factory = irc.connection.Factory()

        irc.bot.SingleServerIRCBot.__init__(self, [(self.server, self.port)],
                                            self.name,
                                            self.desc,
                                            connect_factory=ssl_factory)

        self.sd_notify.status("Load plugins...")

        self.plugins = self._get_plugins()
        self.user_init = {}
예제 #3
0
파일: database.py 프로젝트: ningirsu/taemin
 def new_from_conf(cls):
     db_conf = conf.get_config("taemin").get("database", {})
     return cls(db_conf.get("type", "mysql"),
                name=db_conf.get("name", "/etc/taemin/taemin.db"),
                user=db_conf.get("user", ""),
                password=db_conf.get("password", ""),
                host=db_conf.get("host", "localhost"))
예제 #4
0
    def __init__(self):
        logging.Logger.__init__(self, __name__)
        self._conf = conf.get_config("taemin").get("general", {})

        self.setLevel(
            self._LEVEL.get(self._conf.get("log_level"), logging.INFO))
        self.addHandler(self._get_handler())
        sys.excepthook = self._handler_exception
예제 #5
0
파일: bot.py 프로젝트: hugoShaka/taemin
    def __init__(self, *args):
        self.sd_notify = sdnotify.get_notifier()
        self.conf = conf.get_config("taemin")
        self.conf.load(*args)

        general_conf = self.conf.get("general", {})
        self.chans = general_conf.get("chans")
        if not self.chans:
            self.chans = []
        self.name = general_conf.get("name", "Taemin")
        self.desc = general_conf.get("desc", "Le Splendide")
        self.server = general_conf.get("server", "")
        self.port = general_conf.get("port", 6667)

        self.log = logger.Logger()
        self.mailation = courriel.Mailage(self)

        irc.bot.SingleServerIRCBot.__init__(self, [(self.server, self.port)], self.name, self.desc)

        self.sd_notify.status("Load plugins...")

        self.plugins = self._get_plugins()
        self.user_init = {}
예제 #6
0
""" Commont test file """

import unittest

from taemin import conf

conf.get_config("taemin").load("-c", "test/conf.yml")

from taemin import bot


class TaeminTest(unittest.TestCase):
    """ Base for all test """
    def setUp(self):
        self.taemin = bot.Taemin("-c", "test/conf.yml")