Skip to content

Commit

Permalink
updated to django 1.11 and django 2.0
Browse files Browse the repository at this point in the history
  • Loading branch information
wolph committed Apr 5, 2018
1 parent d96a4b1 commit 1452032
Show file tree
Hide file tree
Showing 21 changed files with 248 additions and 235 deletions.
29 changes: 15 additions & 14 deletions .travis.yml
@@ -1,20 +1,21 @@
sudo: false
cache: pip
language: python
python:
- "2.6"
- "2.7"
- "3.3"
- "3.4"
- "pypy"
- "pypy3"
python: 3.6

# command to install dependencies
install:
- pip install .
- pip install -r tests/requirements.txt
env:
- TOX_ENV=pypy-django11
- TOX_ENV=py27-django11
- TOX_ENV=py35-django11
- TOX_ENV=py35-django20
- TOX_ENV=py36-django11
- TOX_ENV=py36-django20
- TOX_ENV=flake8
- TOX_ENV=docs

before_script: flake8 --ignore=W391 django_statsd tests
install:
- pip install tox

# command to run tests
script: python setup.py test
script:
tox -e $TOX_ENV

10 changes: 10 additions & 0 deletions django_statsd/__about__.py
@@ -0,0 +1,10 @@
__package_name__ = 'django-statsd'
__version__ = '2.1.1'
__author__ = 'Rick van Hattem'
__author_email__ = 'Rick.van.Hattem@Fawo.nl'
__description__ = (
'''django-statsd is a Django app that submits query and view durations '''
'''to Etsy's statsd.'''
)
__url__ = 'https://github.com/WoLpH/django-statsd'

21 changes: 5 additions & 16 deletions django_statsd/middleware.py
Expand Up @@ -7,6 +7,7 @@
import collections
import statsd

from django.utils import deprecation
from django.core import exceptions

from . import utils
Expand Down Expand Up @@ -121,10 +122,11 @@ def __call__(self, key):
return WithTimer(self, key)


class StatsdMiddleware(object):
class StatsdMiddleware(deprecation.MiddlewareMixin):
scope = threading.local()

def __init__(self):
def __init__(self, get_response):
deprecation.MiddlewareMixin.__init__(self, get_response)
self.scope.timings = None
self.scope.counter = None

Expand Down Expand Up @@ -217,7 +219,7 @@ def cleanup(self, request):
request.statsd = None


class StatsdMiddlewareTimer(object):
class StatsdMiddlewareTimer(deprecation.MiddlewareMixin):

def process_request(self, request):
if settings.STATSD_TRACK_MIDDLEWARE:
Expand All @@ -242,19 +244,6 @@ def process_template_response(self, request, response):
return response


class TimingMiddleware(StatsdMiddleware):

@classmethod
def deprecated(cls, *args, **kwargs):
warnings.warn(
'The `TimingMiddleware` has been deprecated in favour of '
'the `StatsdMiddleware`. Please update your middleware settings',
DeprecationWarning
)

__init__ = deprecated


class DummyWith(object):

def __enter__(self):
Expand Down
File renamed without changes.
File renamed without changes.
13 changes: 1 addition & 12 deletions docs/_themes/wolph/layout.html → docs/_theme/wolph/layout.html
Expand Up @@ -9,19 +9,8 @@
{% endblock %}
{%- block relbar2 %}{% endblock %}
{%- block footer %}
<script type="text/javascript">
/* <![CDATA[ */
(function() {
var s = document.createElement('script'), t = document.getElementsByTagName('script')[0];
s.type = 'text/javascript';
s.async = true;
s.src = 'http://api.flattr.com/js/0.6/load.js?mode=auto';
t.parentNode.insertBefore(s, t);
})();
/* ]]> */</script>

<div class="footer">
&copy; Copyright {{ copyright }}.
&copy; Copyright {{ copyright }}.
Created using <a href="http://sphinx.pocoo.org/">Sphinx</a>.
</div>
{%- endblock %}
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

0 comments on commit 1452032

Please sign in to comment.