Use " instead of ' (you can laugh at me)
This commit is contained in:
parent
36918232c0
commit
7bfc17a51d
@ -114,7 +114,7 @@ class Application(object):
|
|||||||
self.acl = acl.load()
|
self.acl = acl.load()
|
||||||
storage.load()
|
storage.load()
|
||||||
self.encoding = config.get("encoding", "request")
|
self.encoding = config.get("encoding", "request")
|
||||||
if config.getboolean('logging', 'full_environment'):
|
if config.getboolean("logging", "full_environment"):
|
||||||
self.headers_log = lambda environ: environ
|
self.headers_log = lambda environ: environ
|
||||||
|
|
||||||
# This method is overriden in __init__ if full_environment is set
|
# This method is overriden in __init__ if full_environment is set
|
||||||
@ -342,10 +342,10 @@ class Application(object):
|
|||||||
"""Manage MKCALENDAR request."""
|
"""Manage MKCALENDAR request."""
|
||||||
collection = collections[0]
|
collection = collections[0]
|
||||||
props = xmlutils.props_from_request(content)
|
props = xmlutils.props_from_request(content)
|
||||||
timezone = props.get('C:calendar-timezone')
|
timezone = props.get("C:calendar-timezone")
|
||||||
if timezone:
|
if timezone:
|
||||||
collection.replace('', timezone)
|
collection.replace("", timezone)
|
||||||
del props['C:calendar-timezone']
|
del props["C:calendar-timezone"]
|
||||||
with collection.props as collection_props:
|
with collection.props as collection_props:
|
||||||
for key, value in props.items():
|
for key, value in props.items():
|
||||||
collection_props[key] = value
|
collection_props[key] = value
|
||||||
@ -443,7 +443,7 @@ class Application(object):
|
|||||||
def report(self, environ, collections, content, user):
|
def report(self, environ, collections, content, user):
|
||||||
"""Manage REPORT request."""
|
"""Manage REPORT request."""
|
||||||
collection = collections[0]
|
collection = collections[0]
|
||||||
headers = {'Content-Type': 'text/xml'}
|
headers = {"Content-Type": "text/xml"}
|
||||||
answer = xmlutils.report(environ["PATH_INFO"], content, collection)
|
answer = xmlutils.report(environ["PATH_INFO"], content, collection)
|
||||||
return client.MULTI_STATUS, headers, answer
|
return client.MULTI_STATUS, headers, answer
|
||||||
|
|
||||||
|
@ -95,7 +95,7 @@ def run():
|
|||||||
if pid:
|
if pid:
|
||||||
try:
|
try:
|
||||||
if options.pid:
|
if options.pid:
|
||||||
open(options.pid, 'w').write(str(pid))
|
open(options.pid, "w").write(str(pid))
|
||||||
finally:
|
finally:
|
||||||
sys.exit()
|
sys.exit()
|
||||||
sys.stdout = sys.stderr = open(os.devnull, "w")
|
sys.stdout = sys.stderr = open(os.devnull, "w")
|
||||||
@ -116,9 +116,9 @@ def run():
|
|||||||
server_class = radicale.HTTPSServer if options.ssl else radicale.HTTPServer
|
server_class = radicale.HTTPSServer if options.ssl else radicale.HTTPServer
|
||||||
shutdown_program = threading.Event()
|
shutdown_program = threading.Event()
|
||||||
|
|
||||||
for host in options.hosts.split(','):
|
for host in options.hosts.split(","):
|
||||||
address, port = host.strip().rsplit(':', 1)
|
address, port = host.strip().rsplit(":", 1)
|
||||||
address, port = address.strip('[] '), int(port)
|
address, port = address.strip("[] "), int(port)
|
||||||
servers.append(
|
servers.append(
|
||||||
make_server(address, port, radicale.Application(),
|
make_server(address, port, radicale.Application(),
|
||||||
server_class, radicale.RequestHandler))
|
server_class, radicale.RequestHandler))
|
||||||
@ -174,5 +174,5 @@ def run():
|
|||||||
# pylint: enable=R0912,R0914
|
# pylint: enable=R0912,R0914
|
||||||
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == "__main__":
|
||||||
run()
|
run()
|
||||||
|
@ -83,8 +83,8 @@ for section, values in INITIAL_CONFIG.items():
|
|||||||
|
|
||||||
_CONFIG_PARSER.read("/etc/radicale/config")
|
_CONFIG_PARSER.read("/etc/radicale/config")
|
||||||
_CONFIG_PARSER.read(os.path.expanduser("~/.config/radicale/config"))
|
_CONFIG_PARSER.read(os.path.expanduser("~/.config/radicale/config"))
|
||||||
if 'RADICALE_CONFIG' in os.environ:
|
if "RADICALE_CONFIG" in os.environ:
|
||||||
_CONFIG_PARSER.read(os.environ['RADICALE_CONFIG'])
|
_CONFIG_PARSER.read(os.environ["RADICALE_CONFIG"])
|
||||||
|
|
||||||
# Wrap config module into ConfigParser instance
|
# Wrap config module into ConfigParser instance
|
||||||
sys.modules[__name__] = _CONFIG_PARSER
|
sys.modules[__name__] = _CONFIG_PARSER
|
||||||
|
@ -177,7 +177,7 @@ class Collection(object):
|
|||||||
"""
|
"""
|
||||||
self.encoding = "utf-8"
|
self.encoding = "utf-8"
|
||||||
split_path = path.split("/")
|
split_path = path.split("/")
|
||||||
self.path = path if path != '.' else ''
|
self.path = path if path != "." else ""
|
||||||
if principal and split_path and self.is_node(self.path):
|
if principal and split_path and self.is_node(self.path):
|
||||||
# Already existing principal collection
|
# Already existing principal collection
|
||||||
self.owner = split_path[0]
|
self.owner = split_path[0]
|
||||||
@ -428,8 +428,7 @@ class Collection(object):
|
|||||||
def name(self):
|
def name(self):
|
||||||
"""Collection name."""
|
"""Collection name."""
|
||||||
with self.props as props:
|
with self.props as props:
|
||||||
return props.get('D:displayname',
|
return props.get("D:displayname", self.path.split(os.path.sep)[-1])
|
||||||
self.path.split(os.path.sep)[-1])
|
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def headers(self):
|
def headers(self):
|
||||||
|
@ -110,7 +110,7 @@ class Collection(ical.Collection):
|
|||||||
yield properties
|
yield properties
|
||||||
# On exit
|
# On exit
|
||||||
self._create_dirs()
|
self._create_dirs()
|
||||||
with open(self._props_path, 'w') as prop_file:
|
with open(self._props_path, "w") as prop_file:
|
||||||
json.dump(properties, prop_file)
|
json.dump(properties, prop_file)
|
||||||
|
|
||||||
|
|
||||||
|
@ -106,11 +106,11 @@ def _tag_from_clark(name):
|
|||||||
|
|
||||||
"""
|
"""
|
||||||
match = CLARK_TAG_REGEX.match(name)
|
match = CLARK_TAG_REGEX.match(name)
|
||||||
if match and match.group('namespace') in NAMESPACES_REV:
|
if match and match.group("namespace") in NAMESPACES_REV:
|
||||||
args = {
|
args = {
|
||||||
'ns': NAMESPACES_REV[match.group('namespace')],
|
"ns": NAMESPACES_REV[match.group("namespace")],
|
||||||
'tag': match.group('tag')}
|
"tag": match.group("tag")}
|
||||||
return '%(ns)s:%(tag)s' % args
|
return "%(ns)s:%(tag)s" % args
|
||||||
return name
|
return name
|
||||||
|
|
||||||
|
|
||||||
@ -257,7 +257,7 @@ def _propfind_response(path, item, props, user):
|
|||||||
# pylint: enable=W0511
|
# pylint: enable=W0511
|
||||||
elif tag == _tag("D", "current-user-principal") and user:
|
elif tag == _tag("D", "current-user-principal") and user:
|
||||||
tag = ET.Element(_tag("D", "href"))
|
tag = ET.Element(_tag("D", "href"))
|
||||||
tag.text = '/%s/' % user
|
tag.text = "/%s/" % user
|
||||||
element.append(tag)
|
element.append(tag)
|
||||||
elif tag == _tag("D", "current-user-privilege-set"):
|
elif tag == _tag("D", "current-user-privilege-set"):
|
||||||
privilege = ET.Element(_tag("D", "privilege"))
|
privilege = ET.Element(_tag("D", "privilege"))
|
||||||
@ -339,10 +339,10 @@ def _add_propstat_to(element, tag, status_number):
|
|||||||
prop = ET.Element(_tag("D", "prop"))
|
prop = ET.Element(_tag("D", "prop"))
|
||||||
propstat.append(prop)
|
propstat.append(prop)
|
||||||
|
|
||||||
if '{' in tag:
|
if "{" in tag:
|
||||||
clark_tag = tag
|
clark_tag = tag
|
||||||
else:
|
else:
|
||||||
clark_tag = _tag(*tag.split(':', 1))
|
clark_tag = _tag(*tag.split(":", 1))
|
||||||
prop_tag = ET.Element(clark_tag)
|
prop_tag = ET.Element(clark_tag)
|
||||||
prop.append(prop_tag)
|
prop.append(prop_tag)
|
||||||
|
|
||||||
@ -359,8 +359,8 @@ def proppatch(path, xml_request, collection):
|
|||||||
"""
|
"""
|
||||||
# Reading request
|
# Reading request
|
||||||
root = ET.fromstring(xml_request.encode("utf8"))
|
root = ET.fromstring(xml_request.encode("utf8"))
|
||||||
props_to_set = props_from_request(root, actions=('set',))
|
props_to_set = props_from_request(root, actions=("set",))
|
||||||
props_to_remove = props_from_request(root, actions=('remove',))
|
props_to_remove = props_from_request(root, actions=("remove",))
|
||||||
|
|
||||||
# Writing answer
|
# Writing answer
|
||||||
multistatus = ET.Element(_tag("D", "multistatus"))
|
multistatus = ET.Element(_tag("D", "multistatus"))
|
||||||
|
Loading…
x
Reference in New Issue
Block a user