diff options
| author | Kersten Jeremy <jke@openerp.com> | 2014-02-25 17:58:59 +0100 |
|---|---|---|
| committer | Kersten Jeremy <jke@openerp.com> | 2014-02-25 17:58:59 +0100 |
| commit | 8b927d7d1cd4eef054622822ccf5492c1ff7772a (patch) | |
| tree | 9a1bdd174945d4077250c6f8d159ec4b5fa1e1f9 /addons/calendar/controllers/main.py | |
| parent | 2907c8dd6611999dc1d89cf77bfbf8bd1273f6dd (diff) | |
[FIX] fix bug in send_mail_to_attendee of calendar where we passed browse_list and not dict(ids), typo controller calendarr PEP8
bzr revid: jke@openerp.com-20140225165859-1vyjtirgjmbhoij4
Diffstat (limited to 'addons/calendar/controllers/main.py')
| -rw-r--r-- | addons/calendar/controllers/main.py | 27 |
1 files changed, 12 insertions, 15 deletions
diff --git a/addons/calendar/controllers/main.py b/addons/calendar/controllers/main.py index 941c92dcc3d..98625be42da 100644 --- a/addons/calendar/controllers/main.py +++ b/addons/calendar/controllers/main.py @@ -1,21 +1,19 @@ import simplejson -import urllib import openerp import openerp.addons.web.http as http from openerp.addons.web.http import request import openerp.addons.web.controllers.main as webmain import json -from openerp.addons.web.http import SessionExpiredException -from werkzeug.exceptions import BadRequest + class meeting_invitation(http.Controller): @http.route('/calendar/meeting/accept', type='http', auth="calendar") - def accept(self, db, token, action, id,**kwargs): + def accept(self, db, token, action, id, **kwargs): registry = openerp.modules.registry.RegistryManager.get(db) attendee_pool = registry.get('calendar.attendee') with registry.cursor() as cr: - attendee_id = attendee_pool.search(cr, openerp.SUPERUSER_ID, [('access_token','=',token),('state','!=', 'accepted')]) + attendee_id = attendee_pool.search(cr, openerp.SUPERUSER_ID, [('access_token', '=', token), ('state', '!=', 'accepted')]) if attendee_id: attendee_pool.do_accept(cr, openerp.SUPERUSER_ID, attendee_id) return self.view(db, token, action, id, view='form') @@ -25,7 +23,7 @@ class meeting_invitation(http.Controller): registry = openerp.modules.registry.RegistryManager.get(db) attendee_pool = registry.get('calendar.attendee') with registry.cursor() as cr: - attendee_id = attendee_pool.search(cr, openerp.SUPERUSER_ID, [('access_token','=',token),('state','!=', 'declined')]) + attendee_id = attendee_pool.search(cr, openerp.SUPERUSER_ID, [('access_token', '=', token), ('state', '!=', 'declined')]) if attendee_id: attendee_pool.do_decline(cr, openerp.SUPERUSER_ID, attendee_id) return self.view(db, token, action, id, view='form') @@ -36,13 +34,13 @@ class meeting_invitation(http.Controller): meeting_pool = registry.get('calendar.event') attendee_pool = registry.get('calendar.attendee') with registry.cursor() as cr: - attendee_data = meeting_pool.get_attendee(cr, openerp.SUPERUSER_ID, id); - attendee = attendee_pool.search_read(cr, openerp.SUPERUSER_ID, [('access_token','=',token)],[]) - + attendee_data = meeting_pool.get_attendee(cr, openerp.SUPERUSER_ID, id) + attendee = attendee_pool.search_read(cr, openerp.SUPERUSER_ID, [('access_token', '=', token)], []) + if attendee: attendee_data['current_attendee'] = attendee[0] js = "\n ".join('<script type="text/javascript" src="%s"></script>' % i for i in webmain.manifest_list('js', db=db)) - css = "\n ".join('<link rel="stylesheet" href="%s">' % i for i in webmain.manifest_list('css',db=db)) + css = "\n ".join('<link rel="stylesheet" href="%s">' % i for i in webmain.manifest_list('css', db=db)) return webmain.html_template % { 'js': js, @@ -50,7 +48,7 @@ class meeting_invitation(http.Controller): 'modules': simplejson.dumps(webmain.module_boot(db)), 'init': "s.calendar.event('%s', '%s', '%s', '%s' , '%s');" % (db, action, id, 'form', json.dumps(attendee_data)), } - + # Function used, in RPC to check every 5 minutes, if notification to do for an event or not @http.route('/calendar/notify', type='json', auth="none") def notify(self): @@ -58,15 +56,14 @@ class meeting_invitation(http.Controller): uid = request.session.uid context = request.session.context with registry.cursor() as cr: - res = registry.get("calendar.alarm_manager").get_next_notif(cr,uid,context=context) + res = registry.get("calendar.alarm_manager").get_next_notif(cr, uid, context=context) return res - + @http.route('/calendar/notify_ack', type='json', auth="none") def notify_ack(self, type=''): registry = openerp.modules.registry.RegistryManager.get(request.session.db) uid = request.session.uid context = request.session.context with registry.cursor() as cr: - res = registry.get("res.partner").calendar_last_notif(cr,uid,context=context) + res = registry.get("res.partner").calendar_last_notif_ack(cr, uid, context=context) return res - |
