diff options
| author | ron@tinyerp.com <> | 2011-10-21 11:11:13 +0530 |
|---|---|---|
| committer | ron@tinyerp.com <> | 2011-10-21 11:11:13 +0530 |
| commit | ae326f69099cc3a8a167ea5cd4bd3d37d3bafa4e (patch) | |
| tree | 5fbeea3c7591ef4e34219f12a6834033182dfc93 /addons/caldav | |
| parent | c650f6eac93b8986fae89145d0cd14a67867aadd (diff) | |
| parent | 9ada92fa884805e5ac147e7d82cbb24b028e82ab (diff) | |
[MERGE] Merged with lp:addons
bzr revid: ron@tinyerp.com-20111021054113-qitxy96fyx36fi8m
Diffstat (limited to 'addons/caldav')
| -rw-r--r-- | addons/caldav/caldav_node.py | 2 | ||||
| -rw-r--r-- | addons/caldav/calendar.py | 14 | ||||
| -rw-r--r-- | addons/caldav/wizard/caldav_browse.py | 25 |
3 files changed, 15 insertions, 26 deletions
diff --git a/addons/caldav/caldav_node.py b/addons/caldav/caldav_node.py index 5272d0fc1fd..71e9bdc2468 100644 --- a/addons/caldav/caldav_node.py +++ b/addons/caldav/caldav_node.py @@ -324,7 +324,6 @@ class node_calendar(nodes.node_class): uid = self.context.uid res = self.set_data(cr, data) - if res and len(res): # We arbitrarily construct only the first node of the data # that have been imported. ICS may have had more elements, @@ -332,6 +331,7 @@ class node_calendar(nodes.node_class): assert isinstance(res[0], (int, long)) fnodes = fil_obj.get_calendar_objects(cr, uid, [self.calendar_id], self, domain=[('id','=',res[0])], context=ctx) + if self.context.get('DAV-client','') in ('iPhone', 'iCalendar',): # For those buggy clients, register the alias bca_obj = fil_obj.pool.get('basic.calendar.alias') diff --git a/addons/caldav/calendar.py b/addons/caldav/calendar.py index a70a31bc017..94d28e4ad37 100644 --- a/addons/caldav/calendar.py +++ b/addons/caldav/calendar.py @@ -121,10 +121,10 @@ def str2mailto(emailstr, multi=False): for mas in mailz: m = mege.match(mas.strip()) if not m: - # one of the rare non-matching strings is "sad" :( - # retz.append({ 'name': mas.strip() }) - # continue - raise ValueError("Invalid email address %r" % mas) + #one of the rare non-matching strings is "sad" :( + retz.append({ 'name': mas.strip() }) + continue + # raise ValueError("Invalid email address %r" % mas) rd = { 'name': m.group(1).strip(), 'email': m.group(5), } if m.group(2): @@ -189,6 +189,9 @@ def map_data(cr, uid, obj, context=None): field = obj.ical_get(map_dict, 'field') field_type = obj.ical_get(map_dict, 'type') if field: + #ignore write date, this field is resered for the orm + if field == 'write_date': + continue if field_type == 'selection': if not map_val: continue @@ -299,7 +302,6 @@ class CalDAV(object): att_data = [] exdates = [] _server_tzinfo = pytz.timezone(tools.get_server_timezone()) - for cal_data in child.getChildren(): if cal_data.name.lower() == 'organizer': dmail = { 'name': cal_data.params.get('CN', ['',])[0], @@ -552,7 +554,7 @@ class CalDAV(object): @param data_id: Get Data’s ID or False @param context: A standard dictionary for contextual values """ - + ical_data = content self.__attribute__ = get_attribute_mapping(cr, uid, self._calname, context) parsedCal = vobject.readOne(ical_data) diff --git a/addons/caldav/wizard/caldav_browse.py b/addons/caldav/wizard/caldav_browse.py index f6ecc5dccd5..5b78c480d07 100644 --- a/addons/caldav/wizard/caldav_browse.py +++ b/addons/caldav/wizard/caldav_browse.py @@ -24,6 +24,7 @@ from tools import config import base64 import addons from tools.translate import _ +import tools class caldav_browse(osv.osv_memory): @@ -176,16 +177,6 @@ configuration pref_ids = pref_obj.browse(cr, uid ,context.get('rec_id',False), context=context) res = {} host = context.get('host') - port = '' - prefix = 'http://' - if not config.get('xmlrpc'): - if not config.get('netrpc'): - prefix = 'https://' - port = config.get('xmlrpcs_port', 8071) - else: - port = config.get('netrpc_port',8070) - else: - port = config.get('xmlrpc_port',8069) if not config.get_misc('webdav','enable',True): raise Exception("WebDAV is disabled, cannot continue") user_pool = self.pool.get('res.users') @@ -195,16 +186,16 @@ configuration if pref_ids: pref_ids = pref_ids[0] if pref_ids.device == 'iphone': - url = host + ':' + str(port) + '/'+ pref_ids.service + '/' + cr.dbname + '/'+'calendars/' + url = host + '/'+ pref_ids.service + '/' + cr.dbname + '/'+'calendars/' else : - url = host + ':' + str(port) + '/'+ pref_ids.service + '/' + cr.dbname + '/'+'calendars/'+ 'users/'+ current_user.login + '/'+ pref_ids.collection.name+ '/'+ pref_ids.calendar.name + url = host + '/'+ pref_ids.service + '/' + cr.dbname + '/'+'calendars/'+ 'users/'+ current_user.login + '/'+ pref_ids.collection.name+ '/'+ pref_ids.calendar.name res['description'] = self.__doc.get(pref_ids.device , self.__doc['other']) file = open(addons.get_module_resource('caldav','doc', 'caldav_doc.pdf'),'rb') res['caldav_doc_file'] = base64.encodestring(file.read()) #res['doc_link'] = 'http://doc.openerp.com/' - res['url'] = prefix+url + res['url'] = url return res def browse_caldav(self, cr, uid, ids, context): @@ -239,12 +230,8 @@ class user_preference(osv.osv_memory): return ids[0] def _get_default_host(self, cr, uid, context): - ids=self.search(cr,uid,[]) - host_name = '' - if ids: - ids = len(ids)> 1 and len(ids)-1 or ids[0] # Use len(ids)-1 for taking the value of last id - host_name = self.browse(cr, uid,[ids],context=context)[0].host_name - return host_name + + return self.pool.get('ir.config_parameter').get_param(cr, uid, 'web.base.url', default='http://localhost:8069', context=context) _defaults={ 'service': 'webdav', |
