Skip to content

Commit

Permalink
Merge 1a0702e into a0d1cd4
Browse files Browse the repository at this point in the history
  • Loading branch information
dmpayton committed Apr 30, 2020
2 parents a0d1cd4 + 1a0702e commit 67a586e
Show file tree
Hide file tree
Showing 9 changed files with 26 additions and 43 deletions.
15 changes: 4 additions & 11 deletions .travis.yml
@@ -1,19 +1,12 @@
language: python
python:
- "3.7"

matrix:
include:

- env: TOXENV=django111-py27
python: '2.7'
- env: TOXENV=django111-py36
python: '3.6'
- env: TOXENV=django20-py36
python: '3.6'
- env: TOXENV=django30-py36
python: '3.6'

- env: TOXENV=django-2.2
- env: TOXENV=django-3.0
- env: TOXENV=coverage
python: '3.6'

install:
- pip install tox
Expand Down
3 changes: 0 additions & 3 deletions admin_honeypot/admin.py
Expand Up @@ -20,17 +20,14 @@ def get_actions(self, request):
def get_session_key(self, instance):
return mark_safe('<a href="?session_key=%(key)s">%(key)s</a>' % {'key': instance.session_key})
get_session_key.short_description = _('Session')
get_session_key.allow_tags = True

def get_ip_address(self, instance):
return mark_safe('<a href="?ip_address=%(ip)s">%(ip)s</a>' % {'ip': instance.ip_address})
get_ip_address.short_description = _('IP Address')
get_ip_address.allow_tags = True

def get_path(self, instance):
return mark_safe('<a href="?path=%(path)s">%(path)s</a>' % {'path': instance.path})
get_path.short_description = _('URL')
get_path.allow_tags = True

def has_add_permission(self, request, obj=None):
return False
Expand Down
6 changes: 3 additions & 3 deletions admin_honeypot/urls.py
@@ -1,9 +1,9 @@
from admin_honeypot import views
from django.conf.urls import url
from django.urls import path, re_path

app_name = 'admin_honeypot'

urlpatterns = [
url(r'^login/$', views.AdminHoneypot.as_view(), name='login'),
url(r'^.*$', views.AdminHoneypot.as_view(), name='index'),
path('login/', views.AdminHoneypot.as_view(), name='login'),
re_path(r'^.*$', views.AdminHoneypot.as_view(), name='index'),
]
2 changes: 1 addition & 1 deletion admin_honeypot/views.py
Expand Up @@ -6,7 +6,7 @@
from django.contrib.auth.views import redirect_to_login
from django.shortcuts import redirect
from django.urls import reverse
from django.utils.translation import ugettext as _
from django.utils.translation import gettext as _
from django.views import generic


Expand Down
4 changes: 2 additions & 2 deletions docs/manual/install.rst
Expand Up @@ -5,8 +5,8 @@ Installation
Requirements
============

* Python 2.6+ or Python 3.3+
* Django 1.3+
* Python 3.5+
* Django 2.2+

Install
=======
Expand Down
4 changes: 2 additions & 2 deletions docs/manual/testing.rst
Expand Up @@ -45,8 +45,8 @@ that this only tests against the latest Django release.
...

_______________ summary _______________
py27: commands succeeded
py33: commands succeeded
django-2x: commands succeeded
django-3x: commands succeeded
congratulations :)


Expand Down
11 changes: 4 additions & 7 deletions setup.py
Expand Up @@ -15,21 +15,18 @@
classifiers=[
'Development Status :: 5 - Production/Stable',
'Framework :: Django',
'Framework :: Django :: 1.11',
'Framework :: Django :: 2.0',
'Framework :: Django :: 2.2',
'Framework :: Django :: 3.0',
'Intended Audience :: Developers',
'License :: OSI Approved :: MIT License',
'Natural Language :: English',
'Operating System :: OS Independent',
'Programming Language :: Python',
'Programming Language :: Python :: 2',
'Programming Language :: Python :: 2.7',
'Programming Language :: Python :: 3',
'Programming Language :: Python :: 3.2',
'Programming Language :: Python :: 3.3',
'Programming Language :: Python :: 3.4',
'Programming Language :: Python :: 3.5',
'Programming Language :: Python :: 3.6',
'Programming Language :: Python :: 3.7',
'Programming Language :: Python :: 3.8',
'Topic :: Internet :: WWW/HTTP :: Dynamic Content',
],
keywords='django admin honeypot trap',
Expand Down
12 changes: 5 additions & 7 deletions tests/test_suite.py
@@ -1,19 +1,17 @@
import re

from urllib.parse import quote_plus

import django
import pytest
from admin_honeypot.models import LoginAttempt

from django.conf import settings
from django.core import mail
from django.test import TestCase
from django.urls import reverse

try:
# Python 2.7
from urllib import quote_plus
except ImportError:
# Python 3+
from urllib.parse import quote_plus
from admin_honeypot.models import LoginAttempt


class AdminHoneypotTest(TestCase):
maxDiff = None
Expand Down
12 changes: 5 additions & 7 deletions tox.ini
Expand Up @@ -5,9 +5,8 @@

[tox]
envlist =
django111-py{27,36}
django20-py36
django30-py36
django-2.2
django-3.0

[testenvbase]
deps =
Expand All @@ -16,15 +15,14 @@ deps =
pytest-pythonpath

[testenv]
basepython = python3.7
commands = py.test tests/
deps =
django111: Django>=1.11,<2
django20: Django>=2,<2.1
django30: Django>=3,<4
django-2.2: Django>=2.2,<3.0
django-3.0: Django>=3.0,<3.1
{[testenvbase]deps}

[testenv:coverage]
basepython = python3.6
passenv = TRAVIS TRAVIS_JOB_ID TRAVIS_BRANCH
commands =
py.test tests/ --cov admin_honeypot --cov-config .coveragerc --cov-report term-missing --pep8 admin_honeypot
Expand Down

0 comments on commit 67a586e

Please sign in to comment.