Translation of UI (german and english)
Bugfix for feeds
- removed categories related and up
- load new books now working
- category random now working
login page is free of non accessible elements
boolean custom column is vivible in UI
books with only with certain languages can be shown
book shelfs can be deleted from UI
Anonymous user view is more resticted
Added browse of series in sidebar
Dependencys in vendor folder are updated to newer versions (licencs files are now present)
Bugfix editing Authors names
Made upload on windows working
This commit is contained in:
Vendored
+46
-26
@@ -5,18 +5,16 @@
|
||||
|
||||
Implements the WSGI wrappers (request and response).
|
||||
|
||||
:copyright: (c) 2011 by Armin Ronacher.
|
||||
:copyright: (c) 2015 by Armin Ronacher.
|
||||
:license: BSD, see LICENSE for more details.
|
||||
"""
|
||||
|
||||
from werkzeug.wrappers import Request as RequestBase, Response as ResponseBase
|
||||
from werkzeug.exceptions import BadRequest
|
||||
|
||||
from .debughelpers import attach_enctype_error_multidict
|
||||
from . import json
|
||||
from .globals import _request_ctx_stack
|
||||
|
||||
|
||||
_missing = object()
|
||||
|
||||
|
||||
@@ -40,30 +38,30 @@ class Request(RequestBase):
|
||||
specific ones.
|
||||
"""
|
||||
|
||||
#: the internal URL rule that matched the request. This can be
|
||||
#: The internal URL rule that matched the request. This can be
|
||||
#: useful to inspect which methods are allowed for the URL from
|
||||
#: a before/after handler (``request.url_rule.methods``) etc.
|
||||
#:
|
||||
#: .. versionadded:: 0.6
|
||||
url_rule = None
|
||||
|
||||
#: a dict of view arguments that matched the request. If an exception
|
||||
#: happened when matching, this will be `None`.
|
||||
#: A dict of view arguments that matched the request. If an exception
|
||||
#: happened when matching, this will be ``None``.
|
||||
view_args = None
|
||||
|
||||
#: if matching the URL failed, this is the exception that will be
|
||||
#: If matching the URL failed, this is the exception that will be
|
||||
#: raised / was raised as part of the request handling. This is
|
||||
#: usually a :exc:`~werkzeug.exceptions.NotFound` exception or
|
||||
#: something similar.
|
||||
routing_exception = None
|
||||
|
||||
# switched by the request context until 1.0 to opt in deprecated
|
||||
# module functionality
|
||||
# Switched by the request context until 1.0 to opt in deprecated
|
||||
# module functionality.
|
||||
_is_old_module = False
|
||||
|
||||
@property
|
||||
def max_content_length(self):
|
||||
"""Read-only view of the `MAX_CONTENT_LENGTH` config key."""
|
||||
"""Read-only view of the ``MAX_CONTENT_LENGTH`` config key."""
|
||||
ctx = _request_ctx_stack.top
|
||||
if ctx is not None:
|
||||
return ctx.app.config['MAX_CONTENT_LENGTH']
|
||||
@@ -73,7 +71,7 @@ class Request(RequestBase):
|
||||
"""The endpoint that matched the request. This in combination with
|
||||
:attr:`view_args` can be used to reconstruct the same or a
|
||||
modified URL. If an exception happened when matching, this will
|
||||
be `None`.
|
||||
be ``None``.
|
||||
"""
|
||||
if self.url_rule is not None:
|
||||
return self.url_rule.endpoint
|
||||
@@ -99,32 +97,50 @@ class Request(RequestBase):
|
||||
|
||||
@property
|
||||
def json(self):
|
||||
"""If the mimetype is `application/json` this will contain the
|
||||
parsed JSON data. Otherwise this will be `None`.
|
||||
"""If the mimetype is :mimetype:`application/json` this will contain the
|
||||
parsed JSON data. Otherwise this will be ``None``.
|
||||
|
||||
The :meth:`get_json` method should be used instead.
|
||||
"""
|
||||
# XXX: deprecate property
|
||||
from warnings import warn
|
||||
warn(DeprecationWarning('json is deprecated. '
|
||||
'Use get_json() instead.'), stacklevel=2)
|
||||
return self.get_json()
|
||||
|
||||
def get_json(self, force=False, silent=False, cache=True):
|
||||
"""Parses the incoming JSON request data and returns it. If
|
||||
parsing fails the :meth:`on_json_loading_failed` method on the
|
||||
request object will be invoked. By default this function will
|
||||
only load the json data if the mimetype is ``application/json``
|
||||
but this can be overriden by the `force` parameter.
|
||||
@property
|
||||
def is_json(self):
|
||||
"""Indicates if this request is JSON or not. By default a request
|
||||
is considered to include JSON data if the mimetype is
|
||||
:mimetype:`application/json` or :mimetype:`application/*+json`.
|
||||
|
||||
:param force: if set to `True` the mimetype is ignored.
|
||||
:param silent: if set to `False` this method will fail silently
|
||||
and return `False`.
|
||||
:param cache: if set to `True` the parsed JSON data is remembered
|
||||
.. versionadded:: 0.11
|
||||
"""
|
||||
mt = self.mimetype
|
||||
if mt == 'application/json':
|
||||
return True
|
||||
if mt.startswith('application/') and mt.endswith('+json'):
|
||||
return True
|
||||
return False
|
||||
|
||||
def get_json(self, force=False, silent=False, cache=True):
|
||||
"""Parses the incoming JSON request data and returns it. By default
|
||||
this function will return ``None`` if the mimetype is not
|
||||
:mimetype:`application/json` but this can be overridden by the
|
||||
``force`` parameter. If parsing fails the
|
||||
:meth:`on_json_loading_failed` method on the request object will be
|
||||
invoked.
|
||||
|
||||
:param force: if set to ``True`` the mimetype is ignored.
|
||||
:param silent: if set to ``True`` this method will fail silently
|
||||
and return ``None``.
|
||||
:param cache: if set to ``True`` the parsed JSON data is remembered
|
||||
on the request.
|
||||
"""
|
||||
rv = getattr(self, '_cached_json', _missing)
|
||||
if rv is not _missing:
|
||||
return rv
|
||||
|
||||
if self.mimetype != 'application/json' and not force:
|
||||
if not (force or self.is_json):
|
||||
return None
|
||||
|
||||
# We accept a request charset against the specification as
|
||||
@@ -159,16 +175,20 @@ class Request(RequestBase):
|
||||
|
||||
.. versionadded:: 0.8
|
||||
"""
|
||||
ctx = _request_ctx_stack.top
|
||||
if ctx is not None and ctx.app.config.get('DEBUG', False):
|
||||
raise BadRequest('Failed to decode JSON object: {0}'.format(e))
|
||||
raise BadRequest()
|
||||
|
||||
def _load_form_data(self):
|
||||
RequestBase._load_form_data(self)
|
||||
|
||||
# in debug mode we're replacing the files multidict with an ad-hoc
|
||||
# In debug mode we're replacing the files multidict with an ad-hoc
|
||||
# subclass that raises a different error for key errors.
|
||||
ctx = _request_ctx_stack.top
|
||||
if ctx is not None and ctx.app.debug and \
|
||||
self.mimetype != 'multipart/form-data' and not self.files:
|
||||
from .debughelpers import attach_enctype_error_multidict
|
||||
attach_enctype_error_multidict(self)
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user