Don't create collections on GET requests

This commit is contained in:
Guillaume Ayoub 2016-04-07 19:03:27 +02:00
parent 1001bcb676
commit 595e2329ea

View File

@ -120,9 +120,9 @@ class Application(object):
def __init__(self): def __init__(self):
"""Initialize application.""" """Initialize application."""
super().__init__() super().__init__()
auth.load() auth._load()
storage.load() storage._load()
rights.load() rights._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
@ -413,19 +413,10 @@ class Application(object):
etag = item.etag etag = item.etag
else: else:
return client.NOT_FOUND, {}, None return client.NOT_FOUND, {}, None
elif not collection.exists:
log.LOGGER.debug("Collection %s unknown" % collection.name)
return client.NOT_FOUND
else: else:
# Create the collection if it does not exist
if not collection.exists:
if collection in write_collections:
log.LOGGER.debug(
"Creating collection %s" % collection.name)
collection.write()
else:
log.LOGGER.debug(
"Collection %s not available and could not be created "
"due to missing write rights" % collection.name)
return NOT_ALLOWED
# Get whole collection # Get whole collection
answer_text = collection.text answer_text = collection.text
etag = collection.etag etag = collection.etag