Skip to content

Commit

Permalink
Disable more webdav logic when ZServer is not installed.
Browse files Browse the repository at this point in the history
  • Loading branch information
hannosch committed Sep 6, 2016
1 parent 4c67c77 commit b15d479
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions src/ZPublisher/BaseRequest.py
Expand Up @@ -39,9 +39,12 @@
from ZPublisher.Converters import type_converters
from ZPublisher.interfaces import UseTraversalDefault

HAS_ZSERVER = True
try:
dist = pkg_resources.get_distribution('ZServer')
except pkg_resources.DistributionNotFound:
HAS_ZSERVER = False

def is_xmlrpc_response(response):
return False
else:
Expand Down Expand Up @@ -189,7 +192,7 @@ class BaseRequest:
collection of variable to value mappings.
"""

maybe_webdav_client = 1
maybe_webdav_client = HAS_ZSERVER

# While the following assignment is not strictly necessary, it
# prevents alot of unnecessary searches because, without it,
Expand Down Expand Up @@ -394,18 +397,16 @@ def traverse(self, path, response=None, validated_hook=None):
# How did this request come in? (HTTP GET, PUT, POST, etc.)
method = request_get('REQUEST_METHOD', 'GET').upper()

# Probably a browser
no_acquire_flag = 0
if (method in ('GET', 'POST', 'PURGE') and
not is_xmlrpc_response(response)):
# Probably a browser
no_acquire_flag = 0
# index_html is still the default method, only any object can
# override it by implementing its own __browser_default__ method
method = 'index_html'
elif self.maybe_webdav_client:
# Probably a WebDAV client.
no_acquire_flag = 1
else:
no_acquire_flag = 0

URL = request['URL']
parents = request['PARENTS']
Expand Down

0 comments on commit b15d479

Please sign in to comment.