-
Notifications
You must be signed in to change notification settings - Fork 57
Closed
Labels
api: loggingIssues related to the googleapis/python-logging API.Issues related to the googleapis/python-logging API.triage meI really want to be triaged.I really want to be triaged.
Description
Environment details
- OS type and version: macOS version 11.0.1
- Python version: Python 3.8.2
- pip version: pip 20.2.4
google-cloud-loggingversion: 2.0.1 and 2.0.0
Steps to reproduce
- Add
google.cloud.logging_v2.handlers.middleware.RequestMiddlewareto aMIDDLEWARElist in django app settings - Make an API request, e.g. during a test
Stack trace
self = <django.test.client.ClientHandler object at 0x124a5f850>
def load_middleware(self):
"""
Populate middleware lists from settings.MIDDLEWARE.
Must be called after the environment is fixed (see __call__ in subclasses).
"""
self._view_middleware = []
self._template_response_middleware = []
self._exception_middleware = []
handler = convert_exception_to_response(self._get_response)
for middleware_path in reversed(settings.MIDDLEWARE):
middleware = import_string(middleware_path)
try:
> mw_instance = middleware(handler)
E TypeError: __init__() takes 1 positional argument but 2 were given
Extra Info
It looks like django doesn't support keyword only arguments when loading middleware (the link is pointing to master, but it's the same for old versions). If I locally do the following, I can subclass the RequestMiddleware and remove the keyword only args and the whole issue goes away
dhendry, kluo-draper and patrick-perpetua
Metadata
Metadata
Assignees
Labels
api: loggingIssues related to the googleapis/python-logging API.Issues related to the googleapis/python-logging API.triage meI really want to be triaged.I really want to be triaged.