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