summaryrefslogtreecommitdiff
path: root/addons/fetchmail/fetchmail.py
diff options
context:
space:
mode:
authorrpa (Open ERP) <rpa@tinyerp.com>2010-12-20 13:52:55 +0530
committerrpa (Open ERP) <rpa@tinyerp.com>2010-12-20 13:52:55 +0530
commit4e307d022c8fbdba848b8a4f57d668a4b6bd036f (patch)
tree249f8361bac695c0bec0c844d964194202d680a0 /addons/fetchmail/fetchmail.py
parent6e34e7c52a3f37876b627fb5c80ac79d3c614807 (diff)
parentc2f85df411949653257c5b51f1578a1e40709510 (diff)
[MERGE]: Merge with lp:openobject-addons
bzr revid: rpa@tinyerp.com-20101215042654-04ccazkz5v57ml3j bzr revid: rpa@tinyerp.com-20101216043335-ji5h61dra451cml4 bzr revid: rpa@tinyerp.com-20101220082255-1g3ea50rkjlacwqw
Diffstat (limited to 'addons/fetchmail/fetchmail.py')
-rw-r--r--addons/fetchmail/fetchmail.py26
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)