'Task starting, install cookiejar'

def on_task_start(self, task, config):

    import os
    config = self.prepare_config(config)
    cookie_type = config.get(u'type')
    cookie_file = os.path.expanduser(config.get(u'file'))
    cj = self.cookiejars.get(cookie_file, None)
    if (cj is not None):
        log.debug(u'Loading    cookiejar    from    cache.')
    elif (cookie_type == u'firefox3'):
        log.debug((u'Loading    %s    cookies' % cookie_type))
        cj = self.sqlite2cookie(cookie_file)
        self.cookiejars[cookie_file] = cj
    else:
        if (cookie_type == u'mozilla'):
            log.debug((u'Loading    %s    cookies' % cookie_type))
            cj = http.cookiejar.MozillaCookieJar()
            self.cookiejars[cookie_file] = cj
        elif (cookie_type == u'lwp'):
            log.debug((u'Loading    %s    cookies' % cookie_type))
            cj = http.cookiejar.LWPCookieJar()
            self.cookiejars[cookie_file] = cj
        else:
            raise plugin.PluginError((u'Unknown    cookie    type    %s' % cookie_type), log)
        try:
            cj.load(filename=cookie_file, ignore_expires=True)
            log.debug((u'%s    cookies    loaded' % cookie_type))
        except (http.cookiejar.LoadError, IOError):
            import sys
            raise plugin.PluginError((u'Cookies    could    not    be    loaded:    %s' % sys.exc_info()[1]), log)
    task.requests.add_cookiejar(cj)
