-
Notifications
You must be signed in to change notification settings - Fork 18
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
TypeError: 'str' object is not callable #21
Comments
Hi, |
settings.py configuration for requestlogs MIDDLEWARE = [ REST_FRAMEWORK = { REQUESTLOGS = { and my custom serializers class code is below:- from requestlogs.storages import BaseEntrySerializer
class MyEntrySerializer(BaseEntrySerializer): |
I'm unable to reproduce the problem (couldn't get the exact same error), but seeing that the error is raised in Anyway, I'd recommend for now to not use a |
Hey @Raekkeri, first of all, I want to thank you for this package because it is exactly what we are looking for! I'm having the same issue as the original poster. Edit: I've placed the serializer in a separate file and the issue is resolved. Previously I placed it next to existing serializers and I think this messes with the imports and settings
leads to:
I've investigated a bit and |
Hi, thanks for looking into this issue. After a quick glance I still wasn't able to reproduce this issue in unit tests. So I'll leave this unresolved and get back to it later. |
I used custom MyEntrySerializer by extending BaseEntrySerializer bcz I was getting issue before (AttributeError: Got AttributeError when attempting to get a value for field
user
on serializerBaseEntrySerializer
.The serializer field might be named incorrectly and not match any attribute or key on the
RequestLogEntry
instance.Original exception text was: 'User' object has no attribute 'username'.), but now getting different issue "TypeError: 'str' object is not callable" , Details are below.
Traceback (most recent call last):
File "/home/algoscale/Desktop/projects/parspec/venv/lib/python3.8/site-packages/django/core/handlers/exception.py", line 34, in inner
response = get_response(request)
File "/home/algoscale/Desktop/projects/parspec/venv/lib/python3.8/site-packages/requestlogs/middleware.py", line 20, in call
get_requestlog_entry(request).finalize(response)
File "/home/algoscale/Desktop/projects/parspec/venv/lib/python3.8/site-packages/requestlogs/entries.py", line 96, in finalize
self.store()
File "/home/algoscale/Desktop/projects/parspec/venv/lib/python3.8/site-packages/requestlogs/entries.py", line 100, in store
storage.store(self)
File "/home/algoscale/Desktop/projects/parspec/venv/lib/python3.8/site-packages/requestlogs/storages.py", line 69, in store
logger.info(self.prepare(entry))
File "/home/algoscale/Desktop/projects/parspec/venv/lib/python3.8/site-packages/requestlogs/storages.py", line 64, in prepare
return self.get_serializer_class()(entry).data
TypeError: 'str' object is not callable
please help to solve this one
The text was updated successfully, but these errors were encountered: