Commit 19a37ccd authored by Romain Bignon's avatar Romain Bignon

sqlite is optional with Browser

parent d65d551c
......@@ -27,7 +27,12 @@ import time
from logging import warning, error
from copy import copy
from weboob.tools.firefox_cookies import FirefoxCookieJar
try:
from weboob.tools.firefox_cookies import FirefoxCookieJar
HAVE_COOKIES = True
except ImportError, e:
warning("Unable to store cookies: %s" % e)
HAVE_COOKIES = False
class BrowserIncorrectPassword(Exception):
pass
......@@ -86,7 +91,7 @@ class Browser(mechanize.Browser):
]
# Share cookies with firefox
if firefox_cookies:
if firefox_cookies and HAVE_COOKIES:
self.__cookie = FirefoxCookieJar(self.DOMAIN, firefox_cookies)
self.__cookie.load()
self.set_cookiejar(self.__cookie)
......
......@@ -29,6 +29,7 @@ import sys
from weboob import Weboob
from weboob.capabilities import CAP_MAILS
from weboob.tools.application import BaseApplication
class User:
def __init__(self, username, password, email):
......@@ -36,13 +37,15 @@ class User:
self.password = password
self.email = email
class Application:
class Application(BaseApplication):
APPNAME = 'weboob2mail'
def __init__(self):
self.weboob = Weboob(self.APPNAME)
def main(self, argv):
if not self.config.values:
print >>sys.stderr, "Error: %s is not configured yet. Please call 'weboob2mail -c'" % argv[0]
print >>sys.stderr, "Also, you need to use 'weboobcfg' to set backend configs"
return -1
self.weboob.loadmodules(CAP_MAILS)
self.weboob.schedule(interval, self.process)
......@@ -56,8 +59,8 @@ class Application:
self.send_email(m)
def send_email(self, mail):
domain = ''
recipient = ''
domain = self.config.items['domain']
recipient = self.config.items['recipient']
reply_id = ''
if mail.getReplyID():
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment