Merge lp:~yann-papouin/ocb-addons/6.1-bug-1008513-dav-import-error into lp:ocb-addons/6.1

Proposed by Yann Papouin
Status: Merged
Merged at revision: 6847
Proposed branch: lp:~yann-papouin/ocb-addons/6.1-bug-1008513-dav-import-error
Merge into: lp:ocb-addons/6.1
Diff against target: 90 lines (+31/-14)
3 files modified
document_webdav/dav_fs.py (+11/-5)
document_webdav/webdav.py (+9/-4)
document_webdav/webdav_server.py (+11/-5)
To merge this branch: bzr merge lp:~yann-papouin/ocb-addons/6.1-bug-1008513-dav-import-error
Reviewer Review Type Date Requested Status
Stefan Rijnhart (Opener) Approve
Pedro Manuel Baeza code review Approve
Review via email: mp+219794@code.launchpad.net

Description of the change

Backport from 7.0 needed to run OpenERP 6.1 with DAV support on latest Linux distribution

To post a comment you must log in.
Revision history for this message
Pedro Manuel Baeza (pedro.baeza) wrote :

I think you may keep osv.except_osv in case both imports fail, or put an external dependency on manifest.

Regards.

review: Needs Fixing (code review)
6844. By Yann Papouin

Keep osv exception feedback when both import failed

Revision history for this message
Yann Papouin (yann-papouin) wrote :

You're right. Fixed!

Revision history for this message
Pedro Manuel Baeza (pedro.baeza) wrote :

Thanks for the changes!

Regards.

review: Approve (code review)
Revision history for this message
Stefan Rijnhart (Opener) (stefan-opener) wrote :

Thanks, I was aware of the problem and the fix looks good.

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'document_webdav/dav_fs.py'
2--- document_webdav/dav_fs.py 2011-12-19 16:54:40 +0000
3+++ document_webdav/dav_fs.py 2014-05-16 09:22:46 +0000
4@@ -27,13 +27,19 @@
5
6 import netsvc
7 import urlparse
8-
9-from DAV.constants import COLLECTION #, OBJECT
10-from DAV.errors import DAV_Error, DAV_Forbidden, DAV_NotFound
11-from DAV.iface import dav_interface
12 import urllib
13
14-from DAV.davcmd import copyone, copytree, moveone, movetree, delone, deltree
15+try:
16+ from pywebdav.lib.constants import COLLECTION # , OBJECT
17+ from pywebdav.lib.errors import DAV_Error, DAV_Forbidden, DAV_NotFound
18+ from pywebdav.lib.iface import dav_interface
19+ from pywebdav.lib.davcmd import copyone, copytree, moveone, movetree, delone, deltree
20+except ImportError:
21+ from DAV.constants import COLLECTION #, OBJECT
22+ from DAV.errors import DAV_Error, DAV_Forbidden, DAV_NotFound
23+ from DAV.iface import dav_interface
24+ from DAV.davcmd import copyone, copytree, moveone, movetree, delone, deltree
25+
26 from cache import memoize
27 from tools import misc
28
29
30=== modified file 'document_webdav/webdav.py'
31--- document_webdav/webdav.py 2011-12-19 16:54:40 +0000
32+++ document_webdav/webdav.py 2014-05-16 09:22:46 +0000
33@@ -30,11 +30,16 @@
34 from tools.translate import _
35
36 try:
37- from DAV import utils
38- from DAV.propfind import PROPFIND
39- from DAV.report import REPORT
40+ from pywebdav.lib import utils
41+ from pywebdav.lib.propfind import PROPFIND
42+ from pywebdav.lib.report import REPORT
43 except ImportError:
44- raise osv.except_osv(_('PyWebDAV Import Error!'), _('Please install PyWebDAV from http://code.google.com/p/pywebdav/downloads/detail?name=PyWebDAV-0.9.4.tar.gz&can=2&q=/'))
45+ try:
46+ from DAV import utils
47+ from DAV.propfind import PROPFIND
48+ from DAV.report import REPORT
49+ except ImportError:
50+ raise osv.except_osv(_('PyWebDAV Import Error!'), _('Please install PyWebDAV from http://code.google.com/p/pywebdav/downloads/detail?name=PyWebDAV-0.9.4.tar.gz&can=2&q=/'))
51
52 import tools
53
54
55=== modified file 'document_webdav/webdav_server.py'
56--- document_webdav/webdav_server.py 2012-02-09 09:06:22 +0000
57+++ document_webdav/webdav_server.py 2014-05-16 09:22:46 +0000
58@@ -38,7 +38,6 @@
59 import netsvc
60 from dav_fs import openerp_dav_handler
61 from tools.config import config
62-from DAV.WebDAVServer import DAVRequestHandler
63 from service import http_server
64 from service.websrv_lib import FixSendError, HttpOptions
65 from BaseHTTPServer import BaseHTTPRequestHandler
66@@ -48,13 +47,20 @@
67 import time
68 from string import atoi
69 import addons
70-from DAV.utils import IfParser, TagList
71-from DAV.errors import DAV_Error, DAV_Forbidden, DAV_NotFound
72-from DAV.propfind import PROPFIND
73-# from DAV.constants import DAV_VERSION_1, DAV_VERSION_2
74 from xml.dom import minidom
75 from redirect import RedirectHTTPHandler
76
77+try:
78+ from pywebdav.lib.WebDAVServer import DAVRequestHandler
79+ from pywebdav.lib.utils import IfParser, TagList
80+ from pywebdav.lib.errors import DAV_Error, DAV_Forbidden, DAV_NotFound
81+ from pywebdav.lib.propfind import PROPFIND
82+except ImportError:
83+ from DAV.WebDAVServer import DAVRequestHandler
84+ from DAV.utils import IfParser, TagList
85+ from DAV.errors import DAV_Error, DAV_Forbidden, DAV_NotFound
86+ from DAV.propfind import PROPFIND
87+
88 khtml_re = re.compile(r' KHTML/([0-9\.]+) ')
89
90 def OpenDAVConfig(**kw):

Subscribers

People subscribed via source and target branches