[FIX] sync_google_caledar

1) If a user is not a calendar user then raises an exception.
2) If an event doesn't have name then handles it with other string.

bzr revid: uco@tinyerp.com-20110317084519-ndi9n261cdqu4ra5
This commit is contained in:
Ujjvala Collins (OpenERP)
2011-03-17 14:15:19 +05:30
parent e3127a557a
commit 696b8ef1dd
@@ -170,10 +170,13 @@ class synchronize_google_calendar_events(osv.osv_memory):
user_obj = self.pool.get('res.users').browse(cr, uid, uid)
google = self.pool.get('google.login')
res = []
gd_client = google.google_login(cr, uid, user_obj.gmail_user, user_obj.gmail_password, type='calendar')
calendars = gd_client.GetAllCalendarsFeed()
for cal in calendars.entry:
res.append((cal.id.text, cal.title.text))
try:
gd_client = google.google_login(cr, uid, user_obj.gmail_user, user_obj.gmail_password, type='calendar')
calendars = gd_client.GetAllCalendarsFeed()
for cal in calendars.entry:
res.append((cal.id.text, cal.title.text))
except Exception, e:
raise osv.except_osv('Error !', e)
res.append(('all','All Calendars'))
return res
@@ -205,7 +208,7 @@ class synchronize_google_calendar_events(osv.osv_memory):
'noupdate': True
}
vals = {
'name': feed.title.text,
'name': feed.title.text or '(No title)',
'description': feed.content.text,
'categ_id': categ_id and categ_id[0]
}