[REF] document_webdav: reg_http_service accepts the HTTPDir arguments,

renamed auth_proxy to auth_provider.

bzr revid: vmt@openerp.com-20110908123115-meorb9rnc2j0rb40
This commit is contained in:
Vo Minh Thu 2011-09-08 14:31:15 +02:00
parent be827a813a
commit 1a40e51294
2 changed files with 9 additions and 12 deletions

View File

@ -454,7 +454,7 @@ class openerp_dav_handler(dav_interface):
def get_cr(self, uri, allow_last=False):
""" Split the uri, grab a cursor for that db
"""
pdb = self.parent.auth_proxy.last_auth
pdb = self.parent.auth_provider.last_auth
dbname, uri2 = self.get_db(uri, rest_ret=True, allow_last=allow_last)
uri2 = (uri2 and uri2.split('/')) or []
if not dbname:
@ -462,10 +462,10 @@ class openerp_dav_handler(dav_interface):
# if dbname was in our uri, we should have authenticated
# against that.
assert pdb == dbname, " %s != %s" %(pdb, dbname)
res = self.parent.auth_proxy.auth_creds.get(dbname, False)
res = self.parent.auth_provider.auth_creds.get(dbname, False)
if not res:
self.parent.auth_proxy.checkRequest(self.parent, uri, dbname)
res = self.parent.auth_proxy.auth_creds[dbname]
self.parent.auth_provider.checkRequest(self.parent, uri, dbname)
res = self.parent.auth_provider.auth_creds[dbname]
user, passwd, dbn2, uid = res
db,pool = pooler.get_db_and_pool(dbname)
cr = db.cursor()

View File

@ -40,7 +40,7 @@ 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 HTTPDir, FixSendError, HttpOptions
from service.websrv_lib import FixSendError, HttpOptions
from BaseHTTPServer import BaseHTTPRequestHandler
import urlparse
import urllib
@ -572,7 +572,7 @@ try:
conf = OpenDAVConfig(**_dc)
handler._config = conf
reg_http_service(HTTPDir(directory,DAVHandler,DAVAuthProvider()))
reg_http_service(directory, DAVHandler, DAVAuthProvider())
logging.getLogger('webdav').info("WebDAV service registered at path: %s/ "% directory)
if not (config.get_misc('webdav', 'no_root_hack', False)):
@ -592,9 +592,7 @@ try:
# the StaticHttpHandler can find its dir_path.
config.misc.setdefault('static-http',{})['dir_path'] = dir_path
if reg_http_service(HTTPDir('/', DAVStaticHandler)):
logging.getLogger("web-services").info("WebDAV registered HTTP dir %s for /" % \
(dir_path))
reg_http_service('/', DAVStaticHandler)
except Exception, e:
logging.getLogger('webdav').error('Cannot launch webdav: %s' % e)
@ -613,8 +611,7 @@ def init_well_known():
reps['/'+uri] = path
if int(num_svcs):
if http_server.reg_http_service(HTTPDir('/.well-known', RedirectHTTPHandler)):
logging.getLogger("web-services").info("Registered HTTP redirect handler at /.well-known" )
reg_http_service('/.well-known', RedirectHTTPHandler)
init_well_known()
@ -641,7 +638,7 @@ def init_principals_redirect():
dbname = config.get('db_name', False)
if dbname:
PrincipalsRedirect.redirect_paths[''] = '/webdav/%s/principals' % dbname
reg_http_service(HTTPDir('/principals', PrincipalsRedirect))
reg_http_service('/principals', PrincipalsRedirect)
logging.getLogger("web-services").info(
"Registered HTTP redirect handler for /principals to the %s db.",
dbname)