|
@@ -200,22 +200,22 @@ class Application:
|
|
|
path = item.collection.path
|
|
path = item.collection.path
|
|
|
if self.authorized(user, path, "r"):
|
|
if self.authorized(user, path, "r"):
|
|
|
self.logger.debug(
|
|
self.logger.debug(
|
|
|
- "%s has read access to collection %s" %
|
|
|
|
|
- (user or "Anonymous", path or "/"))
|
|
|
|
|
|
|
+ "%s has read access to collection %s",
|
|
|
|
|
+ user or "Anonymous", path or "/")
|
|
|
read_allowed_items.append(item)
|
|
read_allowed_items.append(item)
|
|
|
else:
|
|
else:
|
|
|
self.logger.debug(
|
|
self.logger.debug(
|
|
|
- "%s has NO read access to collection %s" %
|
|
|
|
|
- (user or "Anonymous", path or "/"))
|
|
|
|
|
|
|
+ "%s has NO read access to collection %s",
|
|
|
|
|
+ user or "Anonymous", path or "/")
|
|
|
if self.authorized(user, path, "w"):
|
|
if self.authorized(user, path, "w"):
|
|
|
self.logger.debug(
|
|
self.logger.debug(
|
|
|
- "%s has write access to collection %s" %
|
|
|
|
|
- (user or "Anonymous", path or "/"))
|
|
|
|
|
|
|
+ "%s has write access to collection %s",
|
|
|
|
|
+ user or "Anonymous", path or "/")
|
|
|
write_allowed_items.append(item)
|
|
write_allowed_items.append(item)
|
|
|
else:
|
|
else:
|
|
|
self.logger.debug(
|
|
self.logger.debug(
|
|
|
- "%s has NO write access to collection %s" %
|
|
|
|
|
- (user or "Anonymous", path or "/"))
|
|
|
|
|
|
|
+ "%s has NO write access to collection %s",
|
|
|
|
|
+ user or "Anonymous", path or "/")
|
|
|
return read_allowed_items, write_allowed_items
|
|
return read_allowed_items, write_allowed_items
|
|
|
|
|
|
|
|
def __call__(self, environ, start_response):
|
|
def __call__(self, environ, start_response):
|
|
@@ -225,16 +225,16 @@ class Application:
|
|
|
# Start response
|
|
# Start response
|
|
|
status = "%i %s" % (
|
|
status = "%i %s" % (
|
|
|
status, client.responses.get(status, "Unknown"))
|
|
status, client.responses.get(status, "Unknown"))
|
|
|
- self.logger.debug("Answer status: %s" % status)
|
|
|
|
|
|
|
+ self.logger.debug("Answer status: %s", status)
|
|
|
start_response(status, list(headers.items()))
|
|
start_response(status, list(headers.items()))
|
|
|
# Return response content
|
|
# Return response content
|
|
|
return [answer] if answer else []
|
|
return [answer] if answer else []
|
|
|
|
|
|
|
|
self.logger.debug("\n") # Add empty lines between requests in debug
|
|
self.logger.debug("\n") # Add empty lines between requests in debug
|
|
|
- self.logger.info("%s request at %s received" % (
|
|
|
|
|
- environ["REQUEST_METHOD"], environ["PATH_INFO"]))
|
|
|
|
|
|
|
+ self.logger.info("%s request at %s received",
|
|
|
|
|
+ environ["REQUEST_METHOD"], environ["PATH_INFO"])
|
|
|
headers = pprint.pformat(self.headers_log(environ))
|
|
headers = pprint.pformat(self.headers_log(environ))
|
|
|
- self.logger.debug("Request headers:\n%s" % headers)
|
|
|
|
|
|
|
+ self.logger.debug("Request headers:\n%s", headers)
|
|
|
|
|
|
|
|
# Strip base_prefix from request URI
|
|
# Strip base_prefix from request URI
|
|
|
base_prefix = self.configuration.get("server", "base_prefix")
|
|
base_prefix = self.configuration.get("server", "base_prefix")
|
|
@@ -323,7 +323,7 @@ class Application:
|
|
|
|
|
|
|
|
# Set content length
|
|
# Set content length
|
|
|
if answer:
|
|
if answer:
|
|
|
- self.logger.debug("Response content:\n%s" % answer)
|
|
|
|
|
|
|
+ self.logger.debug("Response content:\n%s", answer)
|
|
|
answer = answer.encode(self.encoding)
|
|
answer = answer.encode(self.encoding)
|
|
|
accept_encoding = [
|
|
accept_encoding = [
|
|
|
encoding.strip() for encoding in
|
|
encoding.strip() for encoding in
|
|
@@ -381,7 +381,7 @@ class Application:
|
|
|
if content_length > 0:
|
|
if content_length > 0:
|
|
|
content = self.decode(
|
|
content = self.decode(
|
|
|
environ["wsgi.input"].read(content_length), environ)
|
|
environ["wsgi.input"].read(content_length), environ)
|
|
|
- self.logger.debug("Request content:\n%s" % content.strip())
|
|
|
|
|
|
|
+ self.logger.debug("Request content:\n%s", content.strip())
|
|
|
else:
|
|
else:
|
|
|
content = None
|
|
content = None
|
|
|
return content
|
|
return content
|