Add Ajax#17
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
add method to parse cookie
set APP_ERROR_XXX_ONCE to False
rename cookie_parse to parse_headers
…o sonus21-master
- add filters - start translation sinto templates
sonus21
left a comment
There was a problem hiding this comment.
Please add test cases as well.
| class Migration(migrations.Migration): | ||
|
|
||
| dependencies = [ | ||
| ('error_tracker', '0001_initial'), |
There was a problem hiding this comment.
this is not correct, can you please verify if this is working? For me it's failing.
There was a problem hiding this comment.
i open an issue on it : #16.
Not working for me too...
There was a problem hiding this comment.
How are you adding error_tracker in the INSTALLED_APPS list?
There was a problem hiding this comment.
yes...
But with django as name in django_migrations on a previous setup... :-).
I cleanup all, and rerun... no more result...
Note : i need to place error_tracker.django to INSTALLED_APPS to get error_tracker working... and not the documentation specs...
There was a problem hiding this comment.
Can you please use error_tracker.DjangoErrorTracker in the installed app and verify?
There was a problem hiding this comment.
I think in new way of declaring modules in django, this line should be présent into init.py of the module
default_app_config = 'error_tracker.apps.DjangoErrorTracker'
I wrote all my modules like this.
There was a problem hiding this comment.
Can you please share python and Django version, this error is very strange.
There was a problem hiding this comment.
local env (mac OS) :
python : 3.8.5
Django : 3.1.1
There was a problem hiding this comment.
Unfortunately this is working fine for me on My Mac and same Django/Python version.
Can you please take master pull and install it via python setup.py install and see if you're still getting similar error?
There was a problem hiding this comment.
i will git it a try
What test do you expect exactly ? I'm not a pro on test unit... :-) |
I expect at-least integration tests, see your last merge is failing. Merging and releasing such code is dangerous.. Please validate if your pull requests are at least passing existing tests. |
Oh! Flask optional commit has failed due to the fetch failure., https://travis-ci.org/github/sonus21/error-tracker/builds/732745931 I'm working on to get all test cases pass. |
|
@sonus21 regarding the pull request how could us manage this ? Cancel it and redo it ? |
|
@sonus21 for your eyes ;-) |
| @classmethod | ||
| def get_exceptions_per_page(cls, page_number=1): | ||
| records = cls.objects.all().order_by('last_seen') | ||
| def get_exceptions_per_page(cls, query): |
There was a problem hiding this comment.
Hello,
This is not a kwargs but a true dict i will reuse as filter:
if not query:
records = cls.objects.all().order_by('last_seen')
else:
records = cls.objects.filter(**query).order_by('last_seen')
I will submit a commit with a fix on the jquery in the template. Url parameter are not well formatted when multiple parameter, so this dict, is not well formatted too.
There was a problem hiding this comment.
This method is different from super class(ModelMixin), if someone has implemented via keyword argument page_number. It'll start throwing errors.
That's the reason I'm suggesting this method to take kwargs as parameter. We should not break backward compatibility.
There was a problem hiding this comment.
Ok let me see how i could manage this...
| import re | ||
| import json | ||
| from django.http import RawPostDataException | ||
| from http.cookies import SimpleCookie |
There was a problem hiding this comment.
oh ! yes. A bad copy/paste duplicate this on line 200. On next commit will be fix.
There was a problem hiding this comment.
just submit a fix, let me know.
There was a problem hiding this comment.
It seems http.cookies is not part of python 2.7 and it will fail there, that's the reason it's moved with try except
There was a problem hiding this comment.
ok, i would prefer this on headers
try:
from http.cookies import SimpleCookie
except:
pass
instead to see from http.cookies import SimpleCookie inside code.
ok for you ?
There was a problem hiding this comment.
But your code would down the line, When you're trying to use SimpleCookie module, you need to add some flag to say this is not available.
fix duplicate SimpleCookie line optimize jquery script for ajax
|
|
||
| error = False | ||
| errors = model.get_exceptions_per_page(page_number=page) | ||
| errors = model.get_exceptions_per_page(**query) |
There was a problem hiding this comment.
We need to set page_number if it's missing. And please add **kwargs in ModelMixin, for compatibility.
There was a problem hiding this comment.
Don't understand your meaning :
on page_number
def get_exceptions_per_page(cls, **query):
if 'page' in query:
page_number = query['page']
del query['page']
else:
page_number = 1
And please add **kwargs in ModelMixin, for compatibility.
You mean replace in ModelMixin :
@classmethod
@abc.abstractmethod
def get_exceptions_per_page(cls, page_number=1):
with
@classmethod
@abc.abstractmethod
def get_exceptions_per_page(cls, **kwargs):
There was a problem hiding this comment.
We need to update model mixin as
@classmethod
@abc.abstractmethod
def get_exceptions_per_page(cls, page_number=1, **kwargs):
Now when we send GET query parameter as dict than we should do something like this
model.get_exceptions_per_page(page_number=page, **query)
I know this will still break the compatibility, so we'll release 2.0.0 to make things fine.
There was a problem hiding this comment.
ok,
i set in Mixin :
@classmethod
@abc.abstractmethod
def get_exceptions_per_page(cls, page_number=1, **kwargs):
"""
An object having these properties,
has_next, next_num, has_prev, prev_num and items
on the returned object like SQLAlchemy's Pagination
:return: a paginated object
"""
raise NotImplementedError
In models.py
@classmethod
def get_exceptions_per_page(cls, page_number=1, **query):
if query and 'page' in query:
page_number = query['page']
del query['page']
if not query:
records = cls.objects.all().order_by('last_seen')
else:
records = cls.objects.filter(**query).order_by('last_seen')
Ok for you ?
There was a problem hiding this comment.
yes this works for me, but do you any downside of using **query in filter? For example how it will handle the case of partial match.
There was a problem hiding this comment.
step by step :-). We will start with a full search and study an easy way to make partial search later..
(this later could be there quickly :-) )
There was a problem hiding this comment.
and the time is there :-):
Could be manage like this:
query = {"{}__contains".format(k): v for k, v in query.items()}
add page_number to get_exceptions_per_page add partial text filter
change contains to icontains on query
|
@sonus21 are we ok on this ? |
|
|
||
| dependencies = [ | ||
| ('error_tracker', '0001_initial'), | ||
| ('django', '0001_initial'), |
There was a problem hiding this comment.
will need to add a mention for updating on README for makemigrations on existing installation.
| try: | ||
| from http.cookies import SimpleCookie | ||
| try: | ||
| from http.cookies import SimpleCookie |
There was a problem hiding this comment.
does not seem to be at correct place
There was a problem hiding this comment.
in a previous conversation you talk about moving this... misunderstanding from my side. Now on headers.
There was a problem hiding this comment.
It seems you need to see try/except statement.
try:
from http.cookies import SimpleCookie
// do something with SimpleCookie
except ImportError:
pass
There was a problem hiding this comment.
Don't understand your meaning here. Could you explain more here to avoid another misunderstanding please before any change here ?
There was a problem hiding this comment.
Sure, when you don't have http.cookies module then you can store cookie data as it as, otherwise we can try to parse cookie data using SimpleCookie module. You can compare this file data with the last commit made by me.
Move Simplecookie to head
| @@ -1,23 +0,0 @@ | |||
| # Generated by Django 3.1.2 on 2020-10-18 11:11 | |||
|
|
|||
There was a problem hiding this comment.
As you ask previously if we really need it... Will be restored on next commit.
There was a problem hiding this comment.
We need this file but app name is not correct, we can connect over zoom/goole hangout to see what's not working you but same is working for me.
try/except SimpleCookie
|
Please fix test issues. See https://travis-ci.org/github/sonus21/error-tracker/jobs/738936246 |
Running pytest on my side, don't have same errors. Note : on the CI, lots of errors from flask... |
You should run |
|
@sonus21 fix test. No errors on django part on my side. But my fix seems to conflict. Don't know how to solve this. |


Hello,
I'm back with a new contribution :-) :
Regards