Skip to content

Commit

Permalink
Merge branch 'develop'
Browse files Browse the repository at this point in the history
* develop:
  Version bump to 0.2.7 and updating CHANGES.txt
  added missing VERSION file
  Renaming CHANGES -> CHANGES.txt (as required by seed)
  Updating version to be stored in VERSION file (as now done by seed)
  Clean up imports
  Don't expect request in templatetag context. Fixes #26
  • Loading branch information
bashu committed Apr 28, 2016
2 parents f6888d9 + ebc9082 commit e49c661
Show file tree
Hide file tree
Showing 7 changed files with 28 additions and 16 deletions.
10 changes: 10 additions & 0 deletions CHANGES → CHANGES.txt
Expand Up @@ -4,6 +4,16 @@ This file will be added to as part of each release

----

Version 0.2.7, Thu 28 Apr 2016
===============================

d52f8b99fe added missing VERSION file (bashu)
18bd7675c7 Renaming CHANGES -> CHANGES.txt (as required by seed) (bashu)
86485a3ad8 Updating version to be stored in VERSION file (as now done by seed) (bashu)
75c23022d9 Clean up imports (Filip Figiel)
9228317107 Don't expect request in templatetag context. Fixes #26 (Filip Figiel)


Version 0.2.6, Sat 13 Feb 2016
===============================

Expand Down
3 changes: 2 additions & 1 deletion MANIFEST.in
@@ -1,5 +1,6 @@
include CHANGES
include CHANGES.txt
include LICENSE
include README.rst
recursive-include tz_detect/static *
recursive-include tz_detect/templates *
include VERSION
1 change: 1 addition & 0 deletions VERSION
@@ -0,0 +1 @@
0.2.7
10 changes: 1 addition & 9 deletions setup.py
Expand Up @@ -22,17 +22,9 @@ def read(*parts):
return codecs.open(file_path, encoding='utf-8').read()


def find_version(*parts):
version_file = read(*parts)
version_match = re.search(r"^__version__ = ['\"]([^'\"]*)['\"]", version_file, re.M)
if version_match:
return str(version_match.group(1))
raise RuntimeError("Unable to find version string.")


setup(
name='django-tz-detect',
version=find_version('tz_detect', '__init__.py'),
version=read('VERSION'),
license='MIT License',

install_requires=[
Expand Down
1 change: 0 additions & 1 deletion tz_detect/__init__.py
@@ -1 +0,0 @@
__version__ = '0.2.6'
2 changes: 1 addition & 1 deletion tz_detect/templatetags/tz_detect.py
Expand Up @@ -9,6 +9,6 @@
@register.inclusion_tag('tz_detect/detector.html', takes_context=True)
def tz_detect(context):
return {
'show': not hasattr(context['request'], 'timezone_active'),
'show': not hasattr(context.get('request'), 'timezone_active'),
'debug': getattr(settings, 'DEBUG', False),
}
17 changes: 13 additions & 4 deletions tz_detect/tests.py
@@ -1,14 +1,15 @@
# -*- coding: utf-8 -*-

from datetime import datetime
from pytz.tzinfo import BaseTzInfo

from django.contrib.sessions.middleware import SessionMiddleware
from django.test import TestCase
from django.test.client import RequestFactory
from django.contrib.sessions.middleware import SessionMiddleware
from pytz.tzinfo import BaseTzInfo

from tz_detect.views import SetOffsetView
from tz_detect.templatetags.tz_detect import tz_detect
from tz_detect.utils import offset_to_timezone
from tz_detect.views import SetOffsetView


class ViewTestCase(TestCase):
Expand Down Expand Up @@ -83,5 +84,13 @@ def test_fuzzy(self):
self.assertEqual(str(tz), 'Europe/London')


class TemplatetagTestCase(TestCase):


def test_no_request_context(self):
try:
tz_detect({})
except KeyError as e:
if e.message == 'request':
self.fail("Templatetag shouldn't expect request in context.")
else:
raise

0 comments on commit e49c661

Please sign in to comment.