OpenERP 6.1 on Ubuntu 14.04+: how to fix problem with pywebdav

Credits: https://bugs.launchpad.net/openobject-addons/+bug/1008513/+index?ss=1

Symptoms:

After migration on Ubuntu 14.04, many of us experienced a problem that OpenERP server cannot start. As it was described in our blog here, OpenERP 6.1 doesn’t work with pywebdav version 9.8. The main reason why it doesn’t work is described into “the credits” article and because the method of import pywebdav library is changed for version 9.8.

Fix:

In order to fix the issue, you can apply the fix explained into the credits article. The fix affects 3 files as follows:

  • <OpenERP server>/addons/document_webdav/dav_fs.py  - one needs to remove 5 lines of code and adds 11 lines of code;
  • <OpenERP server>/addons/document_webdav/webdav.py  - one needs to remove 4 lines of code and adds 9 lines of code;
  • <OpenERP server>/addons/document_webdav/webdav_server.py - - one needs to remove 5 lines of code and adds 11 lines of code;

Hereby is the update code listing which you can get at the link I provided at the beginning of the article:

[toggle_box align="left" width="100%" background="#f5f5f5"] [toggle_item title="modified file 'document_webdav/dav_fs.py'" color="#fff" icon="code" ] [highlighter label="Add/Remove lines list" linenums="yes" startnums="1"]

--- document_webdav/dav_fs.py 2011-12-19 16:54:40 +0000

+++ document_webdav/dav_fs.py 2014-05-16 09:22:46 +0000

@@ -27,13 +27,19 @@

 

import netsvc

import urlparse

-

-from DAV.constants import COLLECTION #, OBJECT

-from DAV.errors import DAV_Error, DAV_Forbidden, DAV_NotFound

-from DAV.iface import dav_interface

import urllib

-from DAV.davcmd import copyone, copytree, moveone, movetree, delone, deltree

+try:

+ from pywebdav.lib.constants import COLLECTION # , OBJECT

+ from pywebdav.lib.errors import DAV_Error, DAV_Forbidden, DAV_NotFound

+ from pywebdav.lib.iface import dav_interface

+ from pywebdav.lib.davcmd import copyone, copytree, moveone, movetree, delone, deltree

+except ImportError:

+ from DAV.constants import COLLECTION #, OBJECT

+ from DAV.errors import DAV_Error, DAV_Forbidden, DAV_NotFound

+ from DAV.iface import dav_interface

+ from DAV.davcmd import copyone, copytree, moveone, movetree, delone, deltree

+

from cache import memoize

from tools import misc

 

 

[/highlighter] [/toggle_item] [toggle_item title="modified file 'document_webdav/webdav.py'" color="#fff" icon="code" ] [highlighter label="Add/Remove lines list" linenums="yes" startnums="1"]

=== modified file 'document_webdav/webdav.py'

--- document_webdav/webdav.py 2011-12-19 16:54:40 +0000

+++ document_webdav/webdav.py 2014-05-16 09:22:46 +0000

@@ -30,11 +30,16 @@

from tools.translate import _

 

try:

- from DAV import utils

- from DAV.propfind import PROPFIND

- from DAV.report import REPORT

+ from pywebdav.lib import utils

+ from pywebdav.lib.propfind import PROPFIND

+ from pywebdav.lib.report import REPORT

except ImportError:

- 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=/'))

+ try:

+ from DAV import utils

+ from DAV.propfind import PROPFIND

+ from DAV.report import REPORT

+ except ImportError:

+ 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=/'))

 

import tools

 

[/highlighter] [/toggle_item] [toggle_item title="modified file 'document_webdav/webdav_server.py'" color="#fff" icon="code" ] [highlighter label="Add/Remove lines list" linenums="yes" startnums="1"]

 

=== modified file 'document_webdav/webdav_server.py'

--- document_webdav/webdav_server.py 2012-02-09 09:06:22 +0000

+++ document_webdav/webdav_server.py 2014-05-16 09:22:46 +0000

@@ -38,7 +38,6 @@

import netsvc

from dav_fs import openerp_dav_handler

from tools.config import config

-from DAV.WebDAVServer import DAVRequestHandler

from service import http_server

from service.websrv_lib import FixSendError, HttpOptions

from BaseHTTPServer import BaseHTTPRequestHandler

@@ -48,13 +47,20 @@

import time

from string import atoi

import addons

-from DAV.utils import IfParser, TagList

-from DAV.errors import DAV_Error, DAV_Forbidden, DAV_NotFound

-from DAV.propfind import PROPFIND

-# from DAV.constants import DAV_VERSION_1, DAV_VERSION_2

from xml.dom import minidom

from redirect import RedirectHTTPHandler

 

+try:

+ from pywebdav.lib.WebDAVServer import DAVRequestHandler

+ from pywebdav.lib.utils import IfParser, TagList

+ from pywebdav.lib.errors import DAV_Error, DAV_Forbidden, DAV_NotFound

+ from pywebdav.lib.propfind import PROPFIND

+except ImportError:

+ from DAV.WebDAVServer import DAVRequestHandler

+ from DAV.utils import IfParser, TagList

+ from DAV.errors import DAV_Error, DAV_Forbidden, DAV_NotFound

+ from DAV.propfind import PROPFIND

+

khtml_re = re.compile(r' KHTML/([0-9\.]+) ')

 

def OpenDAVConfig(**kw):

[/highlighter] [/toggle_item] [/toggle_box]
Comments:

In the code above, all lines with leading - market to remove, while lines with leading + are to be added.