Jigar Amin  (OpenERP) has proposed merging 
lp:~openerp-dev/openobject-addons/trunk-import_google-bug_pickle-jam into 
lp:~openerp-dev/openobject-addons/trunk-import_google.

Requested reviews:
  Bhumika (OpenERP) (sbh-openerp)

For more details, see:
https://code.launchpad.net/~openerp-dev/openobject-addons/trunk-import_google-bug_pickle-jam/+merge/65780

Bug fix:
 + After import timezone object should be in context, removed it from context 
and make direct param for the method
Kindly Review this
Thank You
-- 
https://code.launchpad.net/~openerp-dev/openobject-addons/trunk-import_google-bug_pickle-jam/+merge/65780
Your team OpenERP R&D Team is subscribed to branch 
lp:~openerp-dev/openobject-addons/trunk-import_google.
=== modified file 'import_google/wizard/import_google.py'
--- import_google/wizard/import_google.py	2011-06-22 11:31:57 +0000
+++ import_google/wizard/import_google.py	2011-06-24 12:12:36 +0000
@@ -77,11 +77,10 @@
         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 @@
         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 @@
 
                 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)

=== modified file 'import_google/wizard/import_google_data.py'
--- import_google/wizard/import_google_data.py	2011-06-23 13:07:23 +0000
+++ import_google/wizard/import_google_data.py	2011-06-24 12:12:36 +0000
@@ -160,18 +160,13 @@
                         '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',

_______________________________________________
Mailing list: https://launchpad.net/~openerp-dev-gtk
Post to     : [email protected]
Unsubscribe : https://launchpad.net/~openerp-dev-gtk
More help   : https://help.launchpad.net/ListHelp

Reply via email to