Merge commit 'refs/merge-requests/10' of git://gitorious.org/radicale/radicale into merge-requests/10
This commit is contained in:
commit
70e66ed070
2
config
2
config
@ -66,3 +66,5 @@ folder = ~/.config/radicale/calendars
|
|||||||
config = /etc/radicale/logging
|
config = /etc/radicale/logging
|
||||||
# Set the default logging level to debug
|
# Set the default logging level to debug
|
||||||
debug = False
|
debug = False
|
||||||
|
# Store all environment variables (including those set in the shell)
|
||||||
|
full_environment = False
|
||||||
|
@ -30,6 +30,7 @@ should have been included in this package.
|
|||||||
|
|
||||||
import os
|
import os
|
||||||
import posixpath
|
import posixpath
|
||||||
|
import pprint
|
||||||
import base64
|
import base64
|
||||||
import socket
|
import socket
|
||||||
import ssl
|
import ssl
|
||||||
@ -100,6 +101,16 @@ class Application(object):
|
|||||||
super(Application, self).__init__()
|
super(Application, self).__init__()
|
||||||
self.acl = acl.load()
|
self.acl = acl.load()
|
||||||
self.encoding = config.get("encoding", "request")
|
self.encoding = config.get("encoding", "request")
|
||||||
|
if config.getboolean('logging', 'full_environment'):
|
||||||
|
self.headers_log = lambda environ: environ
|
||||||
|
|
||||||
|
def headers_log(self, environ):
|
||||||
|
request_environ = dict(environ)
|
||||||
|
for shell_variable in os.environ:
|
||||||
|
#if shell_variable not in request_environ:
|
||||||
|
# continue
|
||||||
|
del request_environ[shell_variable]
|
||||||
|
return request_environ
|
||||||
|
|
||||||
def decode(self, text, environ):
|
def decode(self, text, environ):
|
||||||
"""Try to magically decode ``text`` according to given ``environ``."""
|
"""Try to magically decode ``text`` according to given ``environ``."""
|
||||||
@ -128,7 +139,8 @@ class Application(object):
|
|||||||
"""Manage a request."""
|
"""Manage a request."""
|
||||||
log.LOGGER.info("%s request at %s received" % (
|
log.LOGGER.info("%s request at %s received" % (
|
||||||
environ["REQUEST_METHOD"], environ["PATH_INFO"]))
|
environ["REQUEST_METHOD"], environ["PATH_INFO"]))
|
||||||
log.LOGGER.debug("Request headers:\n%s" % environ.items())
|
headers = pprint.pformat(self.headers_log(environ))
|
||||||
|
log.LOGGER.debug("Request headers:\n%s" % headers)
|
||||||
|
|
||||||
# Get content
|
# Get content
|
||||||
content_length = int(environ.get("CONTENT_LENGTH") or 0)
|
content_length = int(environ.get("CONTENT_LENGTH") or 0)
|
||||||
@ -296,7 +308,8 @@ class Application(object):
|
|||||||
|
|
||||||
def report(self, environ, calendar, content):
|
def report(self, environ, calendar, content):
|
||||||
"""Manage REPORT request."""
|
"""Manage REPORT request."""
|
||||||
|
headers = {'Content-Type': 'text/xml'}
|
||||||
answer = xmlutils.report(environ["PATH_INFO"], content, calendar)
|
answer = xmlutils.report(environ["PATH_INFO"], content, calendar)
|
||||||
return client.MULTI_STATUS, {}, answer
|
return client.MULTI_STATUS, headers, answer
|
||||||
|
|
||||||
# pylint: enable=W0612,W0613,R0201
|
# pylint: enable=W0612,W0613,R0201
|
||||||
|
@ -35,10 +35,14 @@ from radicale import client, config, ical
|
|||||||
NAMESPACES = {
|
NAMESPACES = {
|
||||||
"C": "urn:ietf:params:xml:ns:caldav",
|
"C": "urn:ietf:params:xml:ns:caldav",
|
||||||
"D": "DAV:",
|
"D": "DAV:",
|
||||||
"CS": "http://calendarserver.org/ns/"}
|
"CS": "http://calendarserver.org/ns/",
|
||||||
|
"ICAL": "http://apple.com/ns/ical/",
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
for short, url in NAMESPACES.items():
|
for short, url in NAMESPACES.items():
|
||||||
|
if short == "D":
|
||||||
|
short = ""
|
||||||
ET._namespace_map[url] = short
|
ET._namespace_map[url] = short
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user