commit
e9423e2972
|
@ -165,6 +165,8 @@ def get_attribute_mapping(cr, uid, calname, context=None):
|
|||
res[attr] = {}
|
||||
res[attr]['field'] = field.field_id.name
|
||||
res[attr]['type'] = field.field_id.ttype
|
||||
if field.fn == 'datetime_utc':
|
||||
res[attr]['type'] = 'utc'
|
||||
if field.fn == 'hours':
|
||||
res[attr]['type'] = "timedelta"
|
||||
if res[attr]['type'] in ('one2many', 'many2many', 'many2one'):
|
||||
|
@ -228,6 +230,7 @@ def map_data(cr, uid, obj, context=None):
|
|||
id = modobj.create(cr, uid, map_val, context=context)
|
||||
vals[field] = id
|
||||
continue
|
||||
|
||||
if field_type == 'timedelta':
|
||||
if map_val:
|
||||
vals[field] = (map_val.seconds/float(86400) + map_val.days)
|
||||
|
@ -255,7 +258,6 @@ class CalDAV(object):
|
|||
@param name: Get Attribute Name
|
||||
@param type: Get Attribute Type
|
||||
"""
|
||||
|
||||
if self.__attribute__.get(name):
|
||||
val = self.__attribute__.get(name).get(type, None)
|
||||
valtype = self.__attribute__.get(name).get('type', None)
|
||||
|
@ -338,6 +340,8 @@ class CalDAV(object):
|
|||
date_local = cal_data.value.astimezone(_server_tzinfo)
|
||||
self.ical_set(cal_data.name.lower(), date_local, 'value')
|
||||
continue
|
||||
# date_local = cal_data.value.astimezone(pytz.utc)
|
||||
|
||||
self.ical_set(cal_data.name.lower(), cal_data.value, 'value')
|
||||
vals = map_data(cr, uid, self, context=context)
|
||||
return vals
|
||||
|
@ -447,6 +451,21 @@ class CalDAV(object):
|
|||
dtfield.value = self.format_date_tz(parser.parse(data[map_field]), tzval.title())
|
||||
else:
|
||||
dtfield.value = parser.parse(data[map_field])
|
||||
|
||||
elif map_type == 'utc'and data[map_field]:
|
||||
if tzval:
|
||||
local = pytz.timezone (tzval.title())
|
||||
naive = datetime.strptime (data[map_field], "%Y-%m-%d %H:%M:%S")
|
||||
local_dt = naive.replace (tzinfo = local)
|
||||
utc_dt = local_dt.astimezone (pytz.utc)
|
||||
vevent.add(field).value = utc_dt
|
||||
else:
|
||||
utc_timezone = pytz.timezone ('UTC')
|
||||
naive = datetime.strptime (data[map_field], "%Y-%m-%d %H:%M:%S")
|
||||
local_dt = naive.replace (tzinfo = utc_timezone)
|
||||
utc_dt = local_dt.astimezone (pytz.utc)
|
||||
vevent.add(field).value = utc_dt
|
||||
|
||||
elif map_type == "timedelta":
|
||||
vevent.add(field).value = timedelta(hours=data[map_field])
|
||||
elif map_type == "many2one":
|
||||
|
@ -829,6 +848,7 @@ class basic_calendar_fields(osv.osv):
|
|||
'fn': fields.selection([('field', 'Use the field'),
|
||||
('const', 'Expression as constant'),
|
||||
('hours', 'Interval in hours'),
|
||||
('datetime_utc', 'Datetime In UTC'),
|
||||
], 'Function'),
|
||||
'mapping': fields.text('Mapping'),
|
||||
}
|
||||
|
|
|
@ -525,6 +525,9 @@ class node_dir(node_database):
|
|||
# TODO: the write date should be MAX(file.write)..
|
||||
self.write_date = dirr and (dirr.write_date or dirr.create_date) or False
|
||||
self.content_length = 0
|
||||
|
||||
self.unixperms = 040750
|
||||
|
||||
try:
|
||||
self.uuser = (dirr.user_id and dirr.user_id.login) or 'nobody'
|
||||
except Exception:
|
||||
|
@ -764,6 +767,7 @@ class node_res_dir(node_class):
|
|||
# TODO: the write date should be MAX(file.write)..
|
||||
self.write_date = dirr.write_date or dirr.create_date
|
||||
self.content_length = 0
|
||||
self.unixperms = 040750
|
||||
try:
|
||||
self.uuser = (dirr.user_id and dirr.user_id.login) or 'nobody'
|
||||
except Exception:
|
||||
|
@ -1526,4 +1530,4 @@ class nodefd_static(StringIO, node_descriptor):
|
|||
cr.close()
|
||||
StringIO.close(self)
|
||||
|
||||
#eof
|
||||
#eof
|
||||
|
|
|
@ -44,6 +44,7 @@ class document_ftp_configuration(osv.osv_memory):
|
|||
# Update the action for FTP browse.
|
||||
aid = data_pool._get_id(cr, uid, 'document_ftp', 'action_document_browse')
|
||||
aid = data_pool.browse(cr, uid, aid, context=context).res_id
|
||||
self.pool.get('ir.actions.url').write(cr, uid, [aid], {'url': 'ftp://'+(conf.host or 'localhost:8021')+'/'})
|
||||
self.pool.get('ir.actions.url').write(cr, uid, [aid],
|
||||
{'url': 'ftp://'+(conf.host or 'localhost:8021')+'/' + cr.dbname+'/'})
|
||||
|
||||
document_ftp_configuration()
|
||||
|
|
|
@ -84,14 +84,13 @@ class DAVHandler(HttpOptions, FixSendError, DAVRequestHandler):
|
|||
def setup(self):
|
||||
self.davpath = '/'+config.get_misc('webdav','vdir','webdav')
|
||||
addr, port = self.server.server_name, self.server.server_port
|
||||
server_proto = getattr(self.server,'proto', 'http').lower()
|
||||
try:
|
||||
if hasattr(self.request, 'getsockname'):
|
||||
addr, port = self.request.getsockname()
|
||||
addr, port = self.request.getsockname()
|
||||
except Exception, e:
|
||||
self.log_error("Cannot calculate own address: %s" , e)
|
||||
# Too early here to use self.headers
|
||||
self.baseuri = "%s://%s:%d/"% (server_proto, addr, port)
|
||||
|
||||
self.log_error("Cannot calculate own address:" , e)
|
||||
self.baseuri = "http://%s:%d/"% (addr, port)
|
||||
|
||||
self.IFACE_CLASS = openerp_dav_handler(self, self.verbose)
|
||||
|
||||
def copymove(self, CLASS):
|
||||
|
|
Loading…
Reference in New Issue