diff --git a/docs/source/conf.py b/docs/source/conf.py index 7b82e07..874f539 100644 --- a/docs/source/conf.py +++ b/docs/source/conf.py @@ -14,20 +14,21 @@ # import os import sys -sys.path.insert(0, os.path.abspath('../error_tracker')) +import datetime +sys.path.insert(0, os.path.abspath('../..')) +import error_tracker # -- Project information ----------------------------------------------------- project = u'error-tracker' -copyright = u'2019, Sonu Kumar' -author = u'Sonu Kumar' +copyright = str(datetime.datetime.now().year) + u', Sonu Kumar' +author = error_tracker.__author__ # The short X.Y version version = u'' # The full version, including alpha/beta/rc tags -release = u'1.0' - +release = error_tracker.__version__ # -- General configuration --------------------------------------------------- @@ -74,7 +75,6 @@ # The name of the Pygments (syntax highlighting) style to use. pygments_style = 'sphinx' - # -- Options for HTML output ------------------------------------------------- # The theme to use for HTML and HTML Help pages. See the documentation for @@ -109,7 +109,6 @@ # Output file base name for HTML help builder. htmlhelp_basename = 'error-tracker-doc' - # -- Options for LaTeX output ------------------------------------------------ latex_elements = { @@ -138,7 +137,6 @@ u'Sonu Kumar', 'manual'), ] - # -- Options for manual page output ------------------------------------------ # One entry per manual page. List of tuples @@ -148,7 +146,6 @@ [author], 1) ] - # -- Options for Texinfo output ---------------------------------------------- # Grouping the document tree into Texinfo files. List of tuples @@ -160,10 +157,9 @@ 'Miscellaneous'), ] - # -- Extension configuration ------------------------------------------------- # -- Options for intersphinx extension --------------------------------------- # Example configuration for intersphinx: refer to the Python standard library. -intersphinx_mapping = {'https://docs.python.org/': None} \ No newline at end of file +intersphinx_mapping = {'https://docs.python.org/': None} diff --git a/error_tracker/__init__.py b/error_tracker/__init__.py index 373de3f..db3bdd4 100644 --- a/error_tracker/__init__.py +++ b/error_tracker/__init__.py @@ -6,7 +6,7 @@ # :license: BSD-3-Clause # -__version__ = '2.1.0' +__version__ = '3.0.0' __author__ = 'Sonu Kumar' __email__ = 'sonunitw12@gmail.com' @@ -31,7 +31,7 @@ djangoInstalled = True except ImportError as e: - raise e + pass if djangoInstalled: from error_tracker.django import * diff --git a/error_tracker/django/templates/error_tracker/base.html b/error_tracker/django/templates/error_tracker/base.html index b8186e5..c8c9d99 100755 --- a/error_tracker/django/templates/error_tracker/base.html +++ b/error_tracker/django/templates/error_tracker/base.html @@ -38,7 +38,7 @@
{% block header_block %}

- {% trans 'Errors Seen' %} + {% trans 'Errors Seen' %}

{% endblock %} {% block content_block %} diff --git a/error_tracker/django/templates/error_tracker/partials/partial_table.html b/error_tracker/django/templates/error_tracker/partials/partial_table.html index 720c29a..3388f9b 100644 --- a/error_tracker/django/templates/error_tracker/partials/partial_table.html +++ b/error_tracker/django/templates/error_tracker/partials/partial_table.html @@ -4,7 +4,7 @@ {{ error.host }} {{ error.method }} - + {{ error.path|truncatechars:30 }} @@ -12,7 +12,7 @@ {{ error.last_seen }} {{ error.count }} - {%trans 'Delete' %} diff --git a/error_tracker/django/urls.py b/error_tracker/django/urls.py index 85bc7be..e1b3047 100755 --- a/error_tracker/django/urls.py +++ b/error_tracker/django/urls.py @@ -6,11 +6,12 @@ # :license: BSD-3-Clause # -from django.conf.urls import url +from django.urls import path from .views import detail, view_list, delete_exception +app_name = 'error_tracker' urlpatterns = [ - url(r'^$', view_list, name="view_errors"), - url(r'^(?P[\w-]+)/delete$', delete_exception, name='delete_error'), - url(r'^(?P[\w-]+)$', detail, name='view_error'), + path('', view_list, name="view_errors"), + path('/delete', delete_exception, name='delete_error'), + path('', detail, name='view_error'), ] diff --git a/error_tracker/django/views.py b/error_tracker/django/views.py index e83076a..df35a27 100644 --- a/error_tracker/django/views.py +++ b/error_tracker/django/views.py @@ -42,13 +42,14 @@ def view_list(request): error = False errors = model.get_exceptions_per_page(**query) - next_url = reverse('view_errors') + "?page=" + str(errors.next_num) \ + next_url = reverse('error_tracker:view_errors') + "?page=" + str(errors.next_num) \ if errors.has_next else None - prev_url = reverse('view_errors') + "?page=" + str(errors.prev_num) \ + prev_url = reverse('error_tracker:view_errors') + "?page=" + str(errors.prev_num) \ if errors.has_prev else None - if request.is_ajax() or request.GET.get('ajax_partial'): + is_ajax = request.META.get('HTTP_X_REQUESTED_WITH') == 'XMLHttpRequest' + if is_ajax or request.GET.get('ajax_partial'): table = render_to_string('error_tracker/partials/partial_table.html', { 'errors': errors, }) @@ -75,7 +76,7 @@ def delete_exception(request, rhash): :return: redirect back to home page """ model.delete_entity(rhash) - return redirect(reverse('view_errors')) + return redirect(reverse('error_tracker:view_errors')) @require_GET diff --git a/setup.py b/setup.py index 4b290ab..42744ab 100755 --- a/setup.py +++ b/setup.py @@ -69,6 +69,8 @@ def grep(attrname): 'Programming Language :: Python :: 3.6', 'Programming Language :: Python :: 3.7', 'Programming Language :: Python :: 3.8', + 'Programming Language :: Python :: 3.9', + 'Programming Language :: Python :: 3.10', 'Topic :: Software Development :: Libraries :: Python Modules', ] ) diff --git a/tests/DjangoTest/DjangoTest/drf_urls.py b/tests/DjangoTest/DjangoTest/drf_urls.py index 939c976..2542732 100644 --- a/tests/DjangoTest/DjangoTest/drf_urls.py +++ b/tests/DjangoTest/DjangoTest/drf_urls.py @@ -1,4 +1,4 @@ -from django.conf.urls import url, include +from django.urls import path, include from django.contrib import admin from rest_framework import routers from error_tracker.django import urls @@ -9,11 +9,11 @@ router.register(r'users', UserViewSet) urlpatterns = [ - url('admin/', admin.site.urls), - url("dev/", include(urls)), - url(r'^$', views.index), - url(r'^value-error$', views.value_error), - url(r'^post-view$', views.post_view), - url(r'^', include(router.urls)), - url(r'^api-auth/', include('rest_framework.urls')) + path('admin/', admin.site.urls), + path('dev/', include(urls)), + path('', views.index), + path('value-error', views.value_error), + path('post-view', views.post_view), + path('', include(router.urls)), + path('api-auth/', include('rest_framework.urls')) ] diff --git a/tests/DjangoTest/DjangoTest/urls.py b/tests/DjangoTest/DjangoTest/urls.py index e22991c..b85bf2a 100644 --- a/tests/DjangoTest/DjangoTest/urls.py +++ b/tests/DjangoTest/DjangoTest/urls.py @@ -13,15 +13,15 @@ 1. Import the include() function: from django.urls import include, path 2. Add a URL to urlpatterns: path('blog/', include('blog.urls')) """ -from django.conf.urls import url, include +from django.urls import path, include from django.contrib import admin from error_tracker.django import urls from core import views urlpatterns = [ - url('admin/', admin.site.urls), - url("dev/", include(urls)), - url(r'^$', views.index), - url(r'^value-error$', views.value_error), - url(r'^post-view$', views.post_view), + path('admin/', admin.site.urls), + path('dev/', include(urls)), + path('', views.index), + path('value-error', views.value_error), + path('post-view', views.post_view), ]