Beispiel #1
0
    def __init__(self, base, log_parent=None):
        self.log = log.get_logger(type(self).__name__, log_parent)
        self.base = base

        (scheme, netloc, path, query, fragment) \
                 = urlsplit(base, self.URL_SCHEMES[0], self.FRAGMENTS)
        if scheme not in self.URL_SCHEMES:
            raise WalkerError("Can't handle %s scheme" % scheme)
        self.scheme = scheme
        self.full_netloc = netloc

        try:
            (user_passwd, host) = netloc.split("@", 1)
            self.host = unquote_plus(host)

            try:
                (user, passwd) = user_passwd.split(":", 1)
                self.user = unquote_plus(user)
                self.passwd = unquote_plus(passwd)
            except ValueError:
                self.user = unquote_plus(user_passwd)
                self.passwd = None
        except ValueError:
            self.host = unquote_plus(netloc)
            self.user = None
            self.passwd = None

        self.query = query
        self.fragment = fragment

        self.path = as_dir(path)
 def testDeepParent(self):
     """get_logger works if deep-level logger is given."""
     from lp.registry.scripts.productreleasefinder.log import get_logger
     from logging import getLogger
     getLogger("foo")
     parent2 = getLogger("foo.bar")
     self.assertEquals(get_logger("test", parent2).name, "foo.bar.test")
 def testDeepParent(self):
     """get_logger works if deep-level logger is given."""
     from lp.registry.scripts.productreleasefinder.log import get_logger
     from logging import getLogger
     getLogger("foo")
     parent2 = getLogger("foo.bar")
     self.assertEqual(get_logger("test", parent2).name, "foo.bar.test")
Beispiel #4
0
    def __init__(self, base, log_parent=None):
        self.log = log.get_logger(type(self).__name__, log_parent)
        self.base = base

        (scheme, netloc, path, query, fragment) \
                 = urlsplit(base, self.URL_SCHEMES[0], self.FRAGMENTS)
        if scheme not in self.URL_SCHEMES:
            raise WalkerError("Can't handle %s scheme" % scheme)
        self.scheme = scheme
        self.full_netloc = netloc

        try:
            (user_passwd, host) = netloc.split("@", 1)
            self.host = unquote_plus(host)

            try:
                (user, passwd) = user_passwd.split(":", 1)
                self.user = unquote_plus(user)
                self.passwd = unquote_plus(passwd)
            except ValueError:
                self.user = unquote_plus(user_passwd)
                self.passwd = None
        except ValueError:
            self.host = unquote_plus(netloc)
            self.user = None
            self.passwd = None

        self.query = query
        self.fragment = fragment

        self.path = as_dir(path)
Beispiel #5
0
 def __init__(self, filters=(), log_parent=None):
     self.log = log.get_logger("Hose", log_parent)
     self.filter = Filter(filters, log_parent=self.log)
     self.urls = self.reduceWork([pattern.base_url for pattern in filters])
 def testNormalParent(self):
     """get_logger works if non-root logger is given."""
     from lp.registry.scripts.productreleasefinder.log import get_logger
     from logging import getLogger
     parent = getLogger("foo")
     self.assertEqual(get_logger("test", parent).name, "foo.test")
 def testRootParent(self):
     """get_logger works if root logger is given."""
     from lp.registry.scripts.productreleasefinder.log import get_logger
     from logging import root
     self.assertEqual(get_logger("test", root).name, "test")
 def testNoParent(self):
     """get_logger works if no parent is given."""
     from lp.registry.scripts.productreleasefinder.log import get_logger
     self.assertEqual(get_logger("test").name, "test")
 def testLogger(self):
     """get_logger returns a Logger instance."""
     from lp.registry.scripts.productreleasefinder.log import get_logger
     from logging import Logger
     self.assertTrue(isinstance(get_logger("test"), Logger))
 def testNormalParent(self):
     """get_logger works if non-root logger is given."""
     from lp.registry.scripts.productreleasefinder.log import get_logger
     from logging import getLogger
     parent = getLogger("foo")
     self.assertEquals(get_logger("test", parent).name, "foo.test")
 def testRootParent(self):
     """get_logger works if root logger is given."""
     from lp.registry.scripts.productreleasefinder.log import get_logger
     from logging import root
     self.assertEquals(get_logger("test", root).name, "test")
 def testNoParent(self):
     """get_logger works if no parent is given."""
     from lp.registry.scripts.productreleasefinder.log import get_logger
     self.assertEquals(get_logger("test").name, "test")
 def testLogger(self):
     """get_logger returns a Logger instance."""
     from lp.registry.scripts.productreleasefinder.log import get_logger
     from logging import Logger
     self.failUnless(isinstance(get_logger("test"), Logger))
Beispiel #14
0
 def __init__(self, filters=(), log_parent=None):
     self.log = log.get_logger("Hose", log_parent)
     self.filter = Filter(filters, log_parent=self.log)
     self.urls = self.reduceWork([pattern.base_url for pattern in filters])
Beispiel #15
0
 def __init__(self, filters=(), log_parent=None):
     self.log = log.get_logger("Filter", log_parent)
     self.filters = list(filters)