-
Notifications
You must be signed in to change notification settings - Fork 134
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
[Django] Can't have model classes as whitelisted_types in settings.py #126
Comments
Sorry for the delay there. Some of us were at a conference last week. Taking a look a this today. |
@arthurio, we're going to add supporting type names as a feature request to pyrollbar. I'll be filing a story internally for us to work on this. If you want to take a crack at it yourself though, let me know. Cheers! |
@ezarowny Thanks for the update! I probably won't have time to work on it in the coming weeks but will let you know if I do. Feel free to reach out if you have questions. |
Hi there, I’m closing out all issues opened before 2018 that haven’t had any activity on them since the start of this year. If this is still an issue for you, please comment here and we can reopen this. Thanks! |
Hi! Wanted to re-open this issue if there was a chance this could be implemented by Rollbar. Right now I have |
Because the
whitelisted_types
is expected to be a list ofType
s, we currently can't have model classes whitelisted in Django. The configuration is insettings.py
and at this point it's not possible to import model classes.My current solution is to list them as strings and have a singleton class that when instantiated will read those strings and convert them to types before calling the
rollbar.init
function. I instantiate this singleton in the wsgi.py file so that it's done before therollbar.contrib.django.middleware.RollbarNotifierMiddleware
can be called, otherwise the middleware would callrollback.init
first without thewhitelisted_types
list being converted.settings.py
rollbar_singleton.py
wsgi.py
This solution works fine but I'd rather have something less complicated where SerializableTransform would be the one taking care of transforming strings into types when being instantiated.
I'm open for comments and suggestions if you have a better solution.
The text was updated successfully, but these errors were encountered: