Commit b15d4794 authored by Hanno Schlichting's avatar Hanno Schlichting

Disable more webdav logic when ZServer is not installed.

parent 4c67c77b
...@@ -39,9 +39,12 @@ from zope.traversing.namespace import nsParse ...@@ -39,9 +39,12 @@ from zope.traversing.namespace import nsParse
from ZPublisher.Converters import type_converters from ZPublisher.Converters import type_converters
from ZPublisher.interfaces import UseTraversalDefault from ZPublisher.interfaces import UseTraversalDefault
HAS_ZSERVER = True
try: try:
dist = pkg_resources.get_distribution('ZServer') dist = pkg_resources.get_distribution('ZServer')
except pkg_resources.DistributionNotFound: except pkg_resources.DistributionNotFound:
HAS_ZSERVER = False
def is_xmlrpc_response(response): def is_xmlrpc_response(response):
return False return False
else: else:
...@@ -189,7 +192,7 @@ class BaseRequest: ...@@ -189,7 +192,7 @@ class BaseRequest:
collection of variable to value mappings. collection of variable to value mappings.
""" """
maybe_webdav_client = 1 maybe_webdav_client = HAS_ZSERVER
# While the following assignment is not strictly necessary, it # While the following assignment is not strictly necessary, it
# prevents alot of unnecessary searches because, without it, # prevents alot of unnecessary searches because, without it,
...@@ -394,18 +397,16 @@ class BaseRequest: ...@@ -394,18 +397,16 @@ class BaseRequest:
# How did this request come in? (HTTP GET, PUT, POST, etc.) # How did this request come in? (HTTP GET, PUT, POST, etc.)
method = request_get('REQUEST_METHOD', 'GET').upper() method = request_get('REQUEST_METHOD', 'GET').upper()
# Probably a browser
no_acquire_flag = 0
if (method in ('GET', 'POST', 'PURGE') and if (method in ('GET', 'POST', 'PURGE') and
not is_xmlrpc_response(response)): not is_xmlrpc_response(response)):
# Probably a browser
no_acquire_flag = 0
# index_html is still the default method, only any object can # index_html is still the default method, only any object can
# override it by implementing its own __browser_default__ method # override it by implementing its own __browser_default__ method
method = 'index_html' method = 'index_html'
elif self.maybe_webdav_client: elif self.maybe_webdav_client:
# Probably a WebDAV client. # Probably a WebDAV client.
no_acquire_flag = 1 no_acquire_flag = 1
else:
no_acquire_flag = 0
URL = request['URL'] URL = request['URL']
parents = request['PARENTS'] parents = request['PARENTS']
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment