Error: object has no attribute 'META'
Hi! I got the following error 'GetExampleView' object has no attribute 'META' when i implement @tracing.trace() inside a class that inherits from any kind of APiView related model.
class GetExampleView(APIView):
@tracing.trace()
def get(self, request):
pass
I don't know if the fact that it was used inside a class and the attribute self (which is the GetExampleView) was sent before request caused this error.
There is any kind of support when this is implemented inside classes? i noticed that all examples where used directly in functions that received request as first param or maybe i'm doing something wrong with the implementation.
@julidr did you solve this?
@julidr the problem is that @tracing.trace() assumes that you are using functions as views, so the decorator expects that the first parameter is a request object, but instead, your approach here is classes as views, then the first parameter is self which is the GetExampleView instance object.
I had forked this project and created a new branch where I added a new decorator @tracing.another_trace('method_name', is_method=True), which allows you to trace commons functions and methods.
https://github.com/crosvera/python-django/tree/another_trace
I know this is super old, but just wrap in method_decorator, so @method_decorator(tracing.trace())