[FIX] pickle bug
bzr revid: jam@tinyerp.com-20110624120607-rce5msvoiprj7c6j
This commit is contained in:
parent
9d885ead0c
commit
b9f9f3f4d6
|
@ -77,11 +77,10 @@ class google_import(import_framework):
|
|||
return data_fetching_function.get(table)()
|
||||
|
||||
|
||||
def _get_tinydates(self, stime, etime,context):
|
||||
def _get_tinydates(self, stime, etime, au_tz):
|
||||
stime = dateutil.parser.parse(stime)
|
||||
etime = dateutil.parser.parse(etime)
|
||||
try:
|
||||
au_tz = context.get('au_tz')
|
||||
au_dt = au_tz.normalize(stime.replace(tzinfo=pytz.utc).astimezone(au_tz))
|
||||
timestring = datetime.datetime(*au_dt.timetuple()[:6]).strftime('%Y-%m-%d %H:%M:%S')
|
||||
au_dt = au_tz.normalize(etime.replace(tzinfo=pytz.utc).astimezone(au_tz))
|
||||
|
@ -188,8 +187,6 @@ class google_import(import_framework):
|
|||
else:
|
||||
time_zone = tools.get_server_timezone()
|
||||
au_tz = timezone(time_zone)
|
||||
context = self.context
|
||||
context.update({'au_tz':au_tz})
|
||||
event_vals = []
|
||||
for cal in self.calendars:
|
||||
events_query = gdata.calendar.service.CalendarEventQuery(user=urllib.unquote(cal.split('/')[~0]))
|
||||
|
@ -213,7 +210,7 @@ class google_import(import_framework):
|
|||
|
||||
timestring = timestring_end = datetime.datetime.now().strftime(self.DATETIME_FORMAT)
|
||||
if feed.when:
|
||||
timestring, timestring_end = self._get_tinydates(feed.when[0].start_time, feed.when[0].end_time,context)
|
||||
timestring, timestring_end = self._get_tinydates(feed.when[0].start_time, feed.when[0].end_time, au_tz)
|
||||
else:
|
||||
x = feed.recurrence.text.split(';')
|
||||
repeat_status = self._get_repeat_status(feed.recurrence.text)
|
||||
|
|
|
@ -160,18 +160,13 @@ class synchronize_google(osv.osv_memory):
|
|||
'password': gmail_pwd,
|
||||
'calendars': calendars,
|
||||
'instance': 'calendar'})
|
||||
|
||||
imp = google_import(self, cr, uid,'import_google' , "synchronize_google", gmail_user, context)
|
||||
imp.set_table_list(tables)
|
||||
imp.start()
|
||||
#Note: Cleaning timezone object from context to avoid pickle problem
|
||||
if 'au_tz' in context:
|
||||
context.pop('au_tz')
|
||||
context.update({'message': msg})
|
||||
obj_model = self.pool.get('ir.model.data')
|
||||
model_data_ids = obj_model.search(cr,uid,[('model','=','ir.ui.view'),('name','=','view_google_import_message_form')])
|
||||
resource_id = obj_model.read(cr, uid, model_data_ids, fields=['res_id'], context=context)[0]['res_id']
|
||||
|
||||
return {
|
||||
'view_type': 'form',
|
||||
'view_mode': 'form',
|
||||
|
|
Loading…
Reference in New Issue