Document, calendar: Patch code from trunk-xrg branch
several fixes that hadn't been backported or applied correctly. bzr revid: p_christ@hol.gr-20101012112030-snnb4fjkya4ndqkm
This commit is contained in:
parent
849548ccf1
commit
305b48abe3
|
@ -1,5 +1,5 @@
|
|||
"id","name","model_id:id","group_id:id","perm_read","perm_write","perm_create","perm_unlink"
|
||||
"access_calendar_attendee","calendar.attendee","model_calendar_attendee","base.group_user",1,1,1,0
|
||||
"access_calendar_attendee","calendar.attendee","model_calendar_attendee","base.group_user",1,1,1,1
|
||||
"access_calendar_alarm","calendar.alarm","model_calendar_alarm","base.group_user",1,1,1,1
|
||||
"access_res_alarm","res.alarm","model_res_alarm","base.group_user",1,1,1,1
|
||||
"access_calendar_todo","calendar.todo","model_calendar_todo","base.group_user",1,1,1,1
|
||||
|
|
|
|
@ -421,7 +421,7 @@ class res_node_calendar(nodes.node_class):
|
|||
self.calendar_id = hasattr(parent, 'calendar_id') and parent.calendar_id or False
|
||||
if res_obj:
|
||||
if not self.calendar_id: self.calendar_id = res_obj.id
|
||||
pr = res_obj.perm_read()[0]
|
||||
pr = res_obj.perm_read(context=context, details=False)[0]
|
||||
self.create_date = pr.get('create_date')
|
||||
self.write_date = pr.get('write_date') or pr.get('create_date')
|
||||
self.displayname = res_obj.name
|
||||
|
|
|
@ -335,8 +335,8 @@ class CalDAV(object):
|
|||
if cal_data.name.lower() in self.__attribute__:
|
||||
if cal_data.params.get('X-VOBJ-ORIGINAL-TZID'):
|
||||
self.ical_set('vtimezone', cal_data.params.get('X-VOBJ-ORIGINAL-TZID'), 'value')
|
||||
date_utc = cal_data.value.astimezone(pytz.utc)
|
||||
self.ical_set(cal_data.name.lower(), date_utc, 'value')
|
||||
date_local = cal_data.value.astimezone(_server_tzinfo)
|
||||
self.ical_set(cal_data.name.lower(), date_local, 'value')
|
||||
continue
|
||||
self.ical_set(cal_data.name.lower(), cal_data.value, 'value')
|
||||
vals = map_data(cr, uid, self, context=context)
|
||||
|
|
|
@ -22,7 +22,7 @@
|
|||
|
||||
{
|
||||
'name': 'Integrated Document Management System',
|
||||
'version': '1.1',
|
||||
'version': '2.0',
|
||||
'category': 'Generic Modules/Others',
|
||||
'description': """This is a complete document management system:
|
||||
* User Authentication
|
||||
|
|
|
@ -21,11 +21,11 @@
|
|||
import logging
|
||||
import os
|
||||
import tempfile
|
||||
from subprocess import Popen, PIPE
|
||||
|
||||
class NhException(Exception):
|
||||
pass
|
||||
|
||||
from subprocess import Popen, PIPE
|
||||
|
||||
class indexer(object):
|
||||
""" An indexer knows how to parse the content of some file.
|
||||
|
|
|
@ -66,6 +66,7 @@ class node_context(object):
|
|||
A context is a set of persistent data, which may influence the structure
|
||||
of the nodes. All other transient information during a data query should
|
||||
be passed down with function arguments.
|
||||
"""
|
||||
cached_roots = {}
|
||||
node_file_class = None
|
||||
|
||||
|
@ -101,7 +102,8 @@ class node_context(object):
|
|||
|
||||
def get_uri(self, cr, uri):
|
||||
""" Although this fn passes back to doc.dir, it is needed since
|
||||
it is a potential caching point """
|
||||
it is a potential caching point.
|
||||
"""
|
||||
(ndir, duri) = self._dirobj._locate_child(cr, self.uid, self.rootdir, uri, None, self)
|
||||
while duri:
|
||||
ndir = ndir.child(cr, duri[0])
|
||||
|
@ -495,7 +497,10 @@ class node_dir(node_database):
|
|||
self.write_date = dirr and (dirr.write_date or dirr.create_date) or False
|
||||
self.content_length = 0
|
||||
self.unixperms = 040750
|
||||
self.uuser = (dirr.user_id and dirr.user_id.login) or 'nobody'
|
||||
try:
|
||||
self.uuser = (dirr.user_id and dirr.user_id.login) or 'nobody'
|
||||
except Exception:
|
||||
self.uuser = 'nobody'
|
||||
self.ugroup = mkdosname(dirr.company_id and dirr.company_id.name, default='nogroup')
|
||||
self.uidperms = dirr.get_dir_permissions()
|
||||
if dctx:
|
||||
|
@ -692,7 +697,10 @@ class node_res_dir(node_class):
|
|||
self.write_date = dirr.write_date or dirr.create_date
|
||||
self.content_length = 0
|
||||
self.unixperms = 040750
|
||||
self.uuser = (dirr.user_id and dirr.user_id.login) or 'nobody'
|
||||
try:
|
||||
self.uuser = (dirr.user_id and dirr.user_id.login) or 'nobody'
|
||||
except Exception:
|
||||
self.uuser = 'nobody'
|
||||
self.ugroup = mkdosname(dirr.company_id and dirr.company_id.name, default='nogroup')
|
||||
self.uidperms = dirr.get_dir_permissions()
|
||||
self.res_model = dirr.ressource_type_id and dirr.ressource_type_id.model or False
|
||||
|
@ -1003,9 +1011,9 @@ class node_res_obj(node_class):
|
|||
uid = self.context.uid
|
||||
ctx = self.context.context.copy()
|
||||
ctx.update(self.dctx)
|
||||
res_obj = dirobj.pool.get(self.context.context['res_model'])
|
||||
res_obj = dirobj.pool.get(self.res_model)
|
||||
|
||||
object2 = res_obj.browse(cr, uid, self.context.context['res_id']) or False
|
||||
object2 = res_obj.browse(cr, uid, self.res_id) or False
|
||||
|
||||
obj = dirobj.browse(cr, uid, self.dir_id)
|
||||
if obj and (obj.type == 'ressource') and not object2:
|
||||
|
@ -1079,7 +1087,10 @@ class node_file(node_class):
|
|||
elif not parent.check_perms('w'):
|
||||
self.uidperms = 4
|
||||
|
||||
self.uuser = (fil.user_id and fil.user_id.login) or 'nobody'
|
||||
try:
|
||||
self.uuser = (fil.user_id and fil.user_id.login) or 'nobody'
|
||||
except Exception:
|
||||
self.uuser = 'nobody'
|
||||
self.ugroup = mkdosname(fil.company_id and fil.company_id.name, default='nogroup')
|
||||
|
||||
# This only propagates the problem to get_data. Better
|
||||
|
|
|
@ -363,7 +363,6 @@ class abstracted_fs(object):
|
|||
"""Remove the specified directory."""
|
||||
cr, node, rem = datacr
|
||||
assert node
|
||||
cr = self.get_node_cr(node)
|
||||
node.rmcol(cr)
|
||||
cr.commit()
|
||||
|
||||
|
|
|
@ -5,10 +5,10 @@
|
|||
from document_ftp import test_easyftp as te
|
||||
ftp = te.get_plain_ftp(timeout=1.0)
|
||||
-
|
||||
I create a folder called '<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>' in the server.
|
||||
I create in the server a folder called 'Äïêéìáóôéêüò ÖÜêåëëïò'
|
||||
-
|
||||
!record {model: document.directory, id: dir_itests }:
|
||||
name: '<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>'
|
||||
name: 'Äïêéìáóôéêüò ÖÜêåëëïò'
|
||||
parent_id: document.dir_root
|
||||
-
|
||||
And then I create another folder, under it, through FTP
|
||||
|
@ -16,68 +16,68 @@
|
|||
!python {model: ir.attachment}: |
|
||||
cr.commit()
|
||||
from document_ftp import test_easyftp as te
|
||||
ftp = te.get_ftp_folder(cr, uid, self, 'Documents/<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>')
|
||||
ftp.mkd("<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD> <20><><EFBFBD><EFBFBD>")
|
||||
ftp = te.get_ftp_folder(cr, uid, self, 'Documents/Äïêéìáóôéêüò ÖÜêåëëïò')
|
||||
ftp.mkd("ÖÜêåëëïò áðü êÜôù")
|
||||
-
|
||||
I check that this folder exists at the server
|
||||
-
|
||||
!assert {model: document.directory, id: , search: "[('name','=','<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD> <20><><EFBFBD><EFBFBD>')]" }:
|
||||
!assert {model: document.directory, id: , search: "[('name','=','ÖÜêåëëïò áðü êÜôù')]" }:
|
||||
- parent_id != False
|
||||
-
|
||||
I login with FTP and check that '<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>' is there
|
||||
I login with FTP and check that 'Äïêéìáóôéêüò ÖÜêåëëïò' is there
|
||||
-
|
||||
!python {model: ir.attachment}: |
|
||||
from document_ftp import test_easyftp as te
|
||||
ftp = te.get_ftp_folder(cr, uid, self, 'Documents/<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>/<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD> <20><><EFBFBD><EFBFBD>')
|
||||
ftp = te.get_ftp_folder(cr, uid, self, 'Documents/Äïêéìáóôéêüò ÖÜêåëëïò/ÖÜêåëëïò áðü êÜôù')
|
||||
-
|
||||
I create a file named '<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>' into that folder
|
||||
I create a file named 'ÄïêéìÞ' into that folder
|
||||
-
|
||||
!python {model: ir.attachment}: |
|
||||
from document_ftp import test_easyftp as te
|
||||
from cStringIO import StringIO
|
||||
ftp = te.get_ftp_folder(cr, uid, self, 'Documents/<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>/<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD> <20><><EFBFBD><EFBFBD>')
|
||||
fdata = StringIO('<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><> utf-8')
|
||||
ftp.storbinary('STOR <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>.txt', fdata)
|
||||
ftp = te.get_ftp_folder(cr, uid, self, 'Documents/Äïêéìáóôéêüò ÖÜêåëëïò/ÖÜêåëëïò áðü êÜôù')
|
||||
fdata = StringIO('êåßìåíï ìå utf-8')
|
||||
ftp.storbinary('STOR ÄïêéìÞ.txt', fdata)
|
||||
-
|
||||
I remove the '<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>.txt' file
|
||||
I remove the 'ÄïêéìÞ.txt' file
|
||||
-
|
||||
!python {model: ir.attachment}: |
|
||||
from document_ftp import test_easyftp as te
|
||||
from cStringIO import StringIO
|
||||
ftp = te.get_ftp_folder(cr, uid, self, 'Documents/<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>/<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD> <20><><EFBFBD><EFBFBD>')
|
||||
ftp.delete('<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>.txt')
|
||||
ftp = te.get_ftp_folder(cr, uid, self, 'Documents/Äïêéìáóôéêüò ÖÜêåëëïò/ÖÜêåëëïò áðü êÜôù')
|
||||
ftp.delete('ÄïêéìÞ.txt')
|
||||
-
|
||||
I rename '<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD> <20><><EFBFBD><EFBFBD>' into '<27><><EFBFBD><EFBFBD><EFBFBD>'
|
||||
I rename 'ÖÜêåëëïò áðü êÜôù' into 'Üëëïò'
|
||||
-
|
||||
!python {model: ir.attachment}: |
|
||||
from document_ftp import test_easyftp as te
|
||||
ftp = te.get_ftp_folder(cr, uid, self, 'Documents/<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>')
|
||||
ftp.rename("<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD> <20><><EFBFBD><EFBFBD>", "<22><><EFBFBD><EFBFBD><EFBFBD>")
|
||||
ftp = te.get_ftp_folder(cr, uid, self, 'Documents/Äïêéìáóôéêüò ÖÜêåëëïò')
|
||||
ftp.rename("ÖÜêåëëïò áðü êÜôù", "Üëëïò")
|
||||
-
|
||||
I place a file 'file <EFBFBD>3' in '<27><><EFBFBD><EFBFBD><EFBFBD>'
|
||||
I place a file 'file Ö3' in 'Üëëïò'
|
||||
-
|
||||
!python {model: ir.attachment}: |
|
||||
from document_ftp import test_easyftp as te
|
||||
from cStringIO import StringIO
|
||||
ftp = te.get_ftp_folder(cr, uid, self, 'Documents/<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>/<2F><><EFBFBD><EFBFBD><EFBFBD>')
|
||||
fdata = StringIO('<EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>')
|
||||
ftp.storbinary('STOR file <EFBFBD>3.txt', fdata)
|
||||
ftp = te.get_ftp_folder(cr, uid, self, 'Documents/Äïêéìáóôéêüò ÖÜêåëëïò/Üëëïò')
|
||||
fdata = StringIO('êé Üëëï êåßìåíï')
|
||||
ftp.storbinary('STOR file Ö3.txt', fdata)
|
||||
-
|
||||
I rename the file into file+range(1..200) (large filename)
|
||||
-
|
||||
!python {model: ir.attachment}: |
|
||||
from document_ftp import test_easyftp as te
|
||||
from cStringIO import StringIO
|
||||
ftp = te.get_ftp_folder(cr, uid, self, 'Documents/<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>/<2F><><EFBFBD><EFBFBD><EFBFBD>')
|
||||
ftp = te.get_ftp_folder(cr, uid, self, 'Documents/Äïêéìáóôéêüò ÖÜêåëëïò/Üëëïò')
|
||||
vuvuzela = 'b'+''.join('z' * 200)+'!'
|
||||
ftp.rename("file <EFBFBD>3.txt", vuvuzela)
|
||||
ftp.rename("file Ö3.txt", vuvuzela)
|
||||
-
|
||||
I delete the file with the large name
|
||||
-
|
||||
!python {model: ir.attachment}: |
|
||||
from document_ftp import test_easyftp as te
|
||||
from cStringIO import StringIO
|
||||
ftp = te.get_ftp_folder(cr, uid, self, 'Documents/<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>/<2F><><EFBFBD><EFBFBD><EFBFBD>')
|
||||
ftp = te.get_ftp_folder(cr, uid, self, 'Documents/Äïêéìáóôéêüò ÖÜêåëëïò/Üëëïò')
|
||||
vuvuzela = 'b'+''.join('z' * 200)+'!'
|
||||
ftp.delete(vuvuzela)
|
||||
|
||||
|
|
|
@ -81,7 +81,14 @@ class DAVHandler(HttpOptions, FixSendError, DAVRequestHandler):
|
|||
|
||||
def setup(self):
|
||||
self.davpath = '/'+config.get_misc('webdav','vdir','webdav')
|
||||
self.baseuri = "http://%s:%d/"% (self.server.server_name, self.server.server_port)
|
||||
addr, port = self.server.server_name, self.server.server_port
|
||||
server_proto = getattr(self.server,'proto', 'http').lower()
|
||||
try:
|
||||
addr, port = self.request.getsockname()
|
||||
except Exception, e:
|
||||
self.log_error("Cannot calculate own address:" , e)
|
||||
# Too early here to use self.headers
|
||||
self.baseuri = "%s://%s:%d/"% (server_proto, addr, port)
|
||||
self.IFACE_CLASS = openerp_dav_handler(self, self.verbose)
|
||||
|
||||
def copymove(self, CLASS):
|
||||
|
|
Loading…
Reference in New Issue