Revision a7dff008 pithos/api/util.py
b/pithos/api/util.py | ||
---|---|---|
54 | 54 |
Conflict, LengthRequired, PreconditionFailed, RequestEntityTooLarge, |
55 | 55 |
RangeNotSatisfiable, InternalServerError, NotImplemented) |
56 | 56 |
from pithos.api.short_url import encode_url |
57 |
from pithos.api.settings import (BACKEND_DB_MODULE, BACKEND_DB_CONNECTION, |
|
58 |
BACKEND_BLOCK_MODULE, BACKEND_BLOCK_PATH, |
|
59 |
BACKEND_QUEUE_MODULE, BACKEND_QUEUE_CONNECTION, |
|
60 |
BACKEND_QUOTA, BACKEND_VERSIONING) |
|
57 | 61 |
from pithos.backends import connect_backend |
58 | 62 |
from pithos.backends.base import NotAllowedError, QuotaError |
59 | 63 |
|
... | ... | |
768 | 772 |
return json.dumps(l) |
769 | 773 |
|
770 | 774 |
def get_backend(): |
771 |
backend = connect_backend(db_module=settings.BACKEND_DB_MODULE,
|
|
772 |
db_connection=settings.BACKEND_DB_CONNECTION,
|
|
773 |
block_module=settings.BACKEND_BLOCK_MODULE,
|
|
774 |
block_path=settings.BACKEND_BLOCK_PATH,
|
|
775 |
queue_module=settings.BACKEND_QUEUE_MODULE,
|
|
776 |
queue_connection=settings.BACKEND_QUEUE_CONNECTION)
|
|
777 |
backend.default_policy['quota'] = settings.BACKEND_QUOTA
|
|
778 |
backend.default_policy['versioning'] = settings.BACKEND_VERSIONING
|
|
775 |
backend = connect_backend(db_module=BACKEND_DB_MODULE, |
|
776 |
db_connection=BACKEND_DB_CONNECTION, |
|
777 |
block_module=BACKEND_BLOCK_MODULE, |
|
778 |
block_path=BACKEND_BLOCK_PATH, |
|
779 |
queue_module=BACKEND_QUEUE_MODULE, |
|
780 |
queue_connection=BACKEND_QUEUE_CONNECTION) |
|
781 |
backend.default_policy['quota'] = BACKEND_QUOTA |
|
782 |
backend.default_policy['versioning'] = BACKEND_VERSIONING |
|
779 | 783 |
return backend |
780 | 784 |
|
781 | 785 |
def update_request_headers(request): |
... | ... | |
818 | 822 |
k.startswith('X-Object-') or k.startswith('Content-')): |
819 | 823 |
del(response[k]) |
820 | 824 |
response[quote(k)] = quote(v, safe='/=,:@; ') |
821 |
|
|
822 |
if settings.TEST: |
|
823 |
response['Date'] = format_date_time(time()) |
|
824 | 825 |
|
825 | 826 |
def render_fault(request, fault): |
826 |
if isinstance(fault, InternalServerError) and (settings.DEBUG or settings.TEST):
|
|
827 |
if isinstance(fault, InternalServerError) and settings.DEBUG:
|
|
827 | 828 |
fault.details = format_exc(fault) |
828 | 829 |
|
829 | 830 |
request.serialization = 'text' |
Also available in: Unified diff