|
1 | 1 | # -*- coding: utf-8 -*-
|
2 | 2 |
|
3 | 3 | import operator
|
4 |
| -import simplejson |
| 4 | +import json |
5 | 5 | import urllib2
|
6 | 6 |
|
7 | 7 | import openerp
|
@@ -267,7 +267,7 @@ def create_an_event(self, cr, uid, event, context=None):
|
267 | 267 |
|
268 | 268 | url = "/calendar/v3/calendars/%s/events?fields=%s&access_token=%s" % ('primary', urllib2.quote('id,updated'), self.get_token(cr, uid, context))
|
269 | 269 | headers = {'Content-type': 'application/json', 'Accept': 'text/plain'}
|
270 |
| - data_json = simplejson.dumps(data) |
| 270 | + data_json = json.dumps(data) |
271 | 271 |
|
272 | 272 | return gs_pool._do_request(cr, uid, url, data_json, headers, type='POST', context=context)
|
273 | 273 |
|
@@ -368,7 +368,7 @@ def update_to_google(self, cr, uid, oe_event, google_event, context):
|
368 | 368 | headers = {'Content-type': 'application/json', 'Accept': 'text/plain'}
|
369 | 369 | data = self.generate_data(cr, uid, oe_event, context=context)
|
370 | 370 | data['sequence'] = google_event.get('sequence', 0)
|
371 |
| - data_json = simplejson.dumps(data) |
| 371 | + data_json = json.dumps(data) |
372 | 372 |
|
373 | 373 | status, content, ask_time = self.pool['google.service']._do_request(cr, uid, url, data_json, headers, type='PATCH', context=context)
|
374 | 374 |
|
@@ -402,7 +402,7 @@ def update_recurrent_event_exclu(self, cr, uid, instance_id, event_ori_google_id
|
402 | 402 |
|
403 | 403 | data['sequence'] = self.get_sequence(cr, uid, instance_id, context)
|
404 | 404 |
|
405 |
| - data_json = simplejson.dumps(data) |
| 405 | + data_json = json.dumps(data) |
406 | 406 | return gs_pool._do_request(cr, uid, url, data_json, headers, type='PUT', context=context)
|
407 | 407 |
|
408 | 408 | def update_from_google(self, cr, uid, event, single_event_dict, type, context):
|
@@ -697,7 +697,7 @@ def update_events(self, cr, uid, lastSync=False, context=None):
|
697 | 697 | registry = openerp.modules.registry.RegistryManager.get(request.session.db)
|
698 | 698 | with registry.cursor() as cur:
|
699 | 699 | self.pool['res.users'].write(cur, SUPERUSER_ID, [uid], {'google_calendar_last_sync_date': False}, context=context)
|
700 |
| - error_key = simplejson.loads(str(e)) |
| 700 | + error_key = json.loads(str(e)) |
701 | 701 | error_key = error_key.get('error', {}).get('message', 'nc')
|
702 | 702 | error_msg = "Google is lost... the next synchro will be a full synchro. \n\n %s" % error_key
|
703 | 703 | raise self.pool.get('res.config.settings').get_config_warning(cr, _(error_msg), context=context)
|
@@ -858,7 +858,7 @@ def update_events(self, cr, uid, lastSync=False, context=None):
|
858 | 858 | try:
|
859 | 859 | self.delete_an_event(cr, uid, current_event[0], context=context)
|
860 | 860 | except Exception, e:
|
861 |
| - error = simplejson.loads(e.read()) |
| 861 | + error = json.loads(e.read()) |
862 | 862 | error_nr = error.get('error', {}).get('code')
|
863 | 863 | # if already deleted from gmail or never created
|
864 | 864 | if error_nr in (404, 410,):
|
|
0 commit comments