Rendering and notification field#14
Conversation
notification_send > for notification ticket_raise > for ticket creation
Check if a ticket already raised or notification send before sending
- add head_script block for extending script and css - add header_block - refactor detail template - refactor list template - ad pre tag to prettify request_data and exception detail view
|
Just a high level comment from me, Even when we're not sending notifications, we should consider the time difference between two consecutive failures. If we're seeing time difference is greater than some delta than we should send notification, reason for this is we keep overriding the failure, that does not mean yesterday failure is same as today's failure, it could be as well but we're not sure only developer has the right knowledge about such things. |
|
Hello
I will modify this and resend request ;-)
Thierry BOULOGNE
06 43 18 31 19
… Le 19 oct. 2020 à 04:58, Sonu Kumar ***@***.***> a écrit :
Just a high level comment from me,
We should take notification send as an additional configuration, some users might want to send notifications for subsequent failures as well but other might not be like you.
Even when we're not sending notifications, we should consider the time difference between two consecutive failures. If we're seeing time difference is greater than some delta than we should send notification, reason for this is we keep overriding the failure, that does not mean yesterday failure is same as today's failure, it could be as well but we're not sure only developer has the right knowledge about such things.
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub, or unsubscribe.
|
|
@sonus21 add parameter for notification and ticket. |
| @@ -0,0 +1,28 @@ | |||
| # Generated by Django 3.1.2 on 2020-10-18 11:17 | |||
| ] | ||
|
|
||
| operations = [ | ||
| # migrations.AddField( |
There was a problem hiding this comment.
We would need to add migrations for exceptions table. And please remove alter for request_data field.
|
@sonus21 let me know if better now. |
| try: | ||
| headers = request.headers.dict() | ||
| except AttributeError: | ||
| headers = request.headers |
There was a problem hiding this comment.
maybe you can pull this to another method to pull cookie.
There was a problem hiding this comment.
@sonus21 don't understand your meaning, could you explain a little bit please ?
There was a problem hiding this comment.
You can add a function that will get cookie from request object.
| notification_send = None | ||
| ticket_raised = None |
add method to parse cookie
|
@sonus21 let me know if better now please. |
sonus21
left a comment
There was a problem hiding this comment.
Overall looks good, there're just few nitpicks, once addressed I'll approve and release a new version.
| created_on = models.DateTimeField(auto_now=True) | ||
| last_seen = models.DateTimeField(auto_now=True, db_index=True) | ||
|
|
||
| notification_send = models.BooleanField(default=False) |
There was a problem hiding this comment.
Please rename this to notification_sent
| operations = [ | ||
| migrations.AddField( | ||
| model_name='errormodel', | ||
| name='notification_send', |
There was a problem hiding this comment.
notification_sent as column name
| # Check error views are visible to others or not | ||
| APP_ERROR_VIEW_PERMISSION = get('APP_ERROR_VIEW_PERMISSION', None) | ||
| # Send email notification once | ||
| APP_ERROR_NOTIFICATION_ONCE = get('APP_ERROR_NOTIFICATION_ONCE', None) |
| # Send email notification once | ||
| APP_ERROR_NOTIFICATION_ONCE = get('APP_ERROR_NOTIFICATION_ONCE', None) | ||
| # Raise ticket once | ||
| APP_ERROR_TICKET_ONCE = get('APP_ERROR_NOTIFICATION_ONCE', None) |
| for key, value in headers.items(): | ||
| try: | ||
| # Test if value could be json loaded, parse if needed as for cookie. | ||
| json.loads('{"%s":"%s"}' % (key, value)) |
There was a problem hiding this comment.
Emulate json.loads to detect problematic values and set them to value=""
There was a problem hiding this comment.
Can you please provide some more details how it helps you and on what value? As you're encoding value in string something like this
{
"foo" : "<value>"
}
As your code, any value could be parsed.
set APP_ERROR_XXX_ONCE to False
| return x | ||
|
|
||
|
|
||
| def cookie_parse(headers): |
There was a problem hiding this comment.
One last change request, this method does not seem to parse only cookie, it's parsing header. Can we rename this method to parse_headers
| for key, value in headers.items(): | ||
| try: | ||
| # Test if value could be json loaded, parse if needed as for cookie. | ||
| json.loads('{"%s":"%s"}' % (key, value)) |
There was a problem hiding this comment.
Can you please provide some more details how it helps you and on what value? As you're encoding value in string something like this
{
"foo" : "<value>"
}
As your code, any value could be parsed.
rename cookie_parse to parse_headers
|
Parse each key, value from headers items and Test if could be "json loaded". If not, we set the correspondant value to empty except for cookie key. because, if could not load a key, value with json, pretty display will not works... hope it help you to understand... Regards |
How are we going to handle form data? I'm still not convinced this will be able to catch the json load error. Can you please share some example request data? |
|
@sonus21 could you trust me on this point :-) ? I faced the problem to provide this tortuous solution :-). |
|
Approved still I need to see. |
Hello,
Thanks for your works. With this pull, i'd like to contribute with :
Feel free to accept what you want.
Regards
Thierry