diff options
| author | rpa (Open ERP) <rpa@tinyerp.com> | 2010-12-16 11:23:48 +0530 |
|---|---|---|
| committer | rpa (Open ERP) <rpa@tinyerp.com> | 2010-12-16 11:23:48 +0530 |
| commit | 7d5e28fbb8d49b8a2825bfdd525938d99574e234 (patch) | |
| tree | c1e90a7757ef2b3fee2190a44a4f7d448707d23b /addons/fetchmail/fetchmail.py | |
| parent | 953a15d2a7391370414462402198780b06d45243 (diff) | |
| parent | 4e307d022c8fbdba848b8a4f57d668a4b6bd036f (diff) | |
[MERGE]: Merge with lp:~openerp-dev/openobject-addons/trunk-dev-addons2
bzr revid: rpa@tinyerp.com-20101216055348-7yrvv48hjq15grv9
Diffstat (limited to 'addons/fetchmail/fetchmail.py')
| -rw-r--r-- | addons/fetchmail/fetchmail.py | 26 |
1 files changed, 15 insertions, 11 deletions
diff --git a/addons/fetchmail/fetchmail.py b/addons/fetchmail/fetchmail.py index 7592061ec36..772771db915 100644 --- a/addons/fetchmail/fetchmail.py +++ b/addons/fetchmail/fetchmail.py @@ -71,9 +71,9 @@ class email_server(osv.osv): 'user_id': lambda self, cr, uid, ctx: uid, } - def check_duplicate(self, cr, uid, ids): + def check_duplicate(self, cr, uid, ids, context=None): # RFC *-* Why this limitation? why not in SQL constraint? - vals = self.read(cr, uid, ids, ['user', 'password'])[0] + vals = self.read(cr, uid, ids, ['user', 'password'], context=context)[0] cr.execute("select count(id) from email_server where user=%s and password=%s", (vals['user'], vals['password'])) res = cr.fetchone() if res: @@ -105,12 +105,14 @@ class email_server(osv.osv): return {'value':{'port':port}} - def set_draft(self, cr, uid, ids, context={}): + def set_draft(self, cr, uid, ids, context=None): self.write(cr, uid, ids , {'state':'draft'}) return True - def button_confirm_login(self, cr, uid, ids, context={}): - for server in self.browse(cr, uid, ids, context): + def button_confirm_login(self, cr, uid, ids, context=None): + if context is None: + context = {} + for server in self.browse(cr, uid, ids, context=context): logger.notifyChannel('imap', netsvc.LOG_INFO, 'fetchmail start checking for new emails on %s' % (server.name)) context.update({'server_id': server.id, 'server_type': server.type}) try: @@ -144,20 +146,22 @@ class email_server(osv.osv): logger.notifyChannel(server.type, netsvc.LOG_WARNING, '%s' % (e)) return True - def button_fetch_mail(self, cr, uid, ids, context={}): + def button_fetch_mail(self, cr, uid, ids, context=None): self.fetch_mail(cr, uid, ids, context=context) return True - def _fetch_mails(self, cr, uid, ids=False, context={}): + def _fetch_mails(self, cr, uid, ids=False, context=None): if not ids: ids = self.search(cr, uid, []) return self.fetch_mail(cr, uid, ids, context=context) - def fetch_mail(self, cr, uid, ids, context={}): + def fetch_mail(self, cr, uid, ids, context=None): + if context is None: + context = {} email_tool = self.pool.get('email.server.tools') action_pool = self.pool.get('ir.actions.server') context.update({'get_server': True}) - for server in self.browse(cr, uid, ids, context): + for server in self.browse(cr, uid, ids, context=context): count = 0 user = server.user_id.id or uid try: @@ -215,7 +219,7 @@ class mailgate_message(osv.osv): _order = 'id desc' def create(self, cr, uid, values, context=None): - if not context: + if context is None: context={} server_id = context.get('server_id',False) server_type = context.get('server_type',False) @@ -227,7 +231,7 @@ class mailgate_message(osv.osv): return res def write(self, cr, uid, ids, values, context=None): - if not context: + if context is None: context={} server_id = context.get('server_id',False) server_type = context.get('server_type',False) |
