Skip to content

Commit

Permalink
Adds support for python 3
Browse files Browse the repository at this point in the history
  • Loading branch information
GermanoGuerrini committed Jan 27, 2015
1 parent 59ba12e commit 6b1a783
Show file tree
Hide file tree
Showing 9 changed files with 60 additions and 29 deletions.
5 changes: 4 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -54,4 +54,7 @@ docs/_build/
target/

# Mac OSX
.DS_Store
.DS_Store

# Pyenv
.python-version
10 changes: 8 additions & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,12 @@ script:
- tox

env:
- TOXENV=django_1.6.X
- TOXENV=django_1.7.X
- TOXENV=py27-django16
- TOXENV=py27-django17
- TOXENV=py32-django16
- TOXENV=py32-django17
- TOXENV=py33-django16
- TOXENV=py33-django17
- TOXENV=py34-django16
- TOXENV=py34-django17
- TOXENV=coverage
2 changes: 1 addition & 1 deletion django_featurette/__init__.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
VERSION = (0, 1)
VERSION = (0, 2)
2 changes: 1 addition & 1 deletion django_featurette/decorators.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,4 @@ def wrapped_view(*args):
else:
return HttpResponseForbidden('<h1>Access Denied</h1>')
return wrapped_view
return wrap
return wrap
18 changes: 11 additions & 7 deletions django_featurette/models.py
Original file line number Diff line number Diff line change
@@ -1,18 +1,22 @@
from __future__ import unicode_literals

from django.db import models
from django.contrib.auth.models import Group
from django.utils.encoding import python_2_unicode_compatible

@python_2_unicode_compatible
class Feature(models.Model):
"""The feature model.
A feature is identified by a unique string and is associated to a group
of users.
"""
key = models.CharField(u"Key", unique=True, max_length=128,
help_text=u"A unique key for this feature.")
key = models.CharField("Key", unique=True, max_length=128,
help_text="A unique key for this feature.")
group = models.ForeignKey(Group)
start_date = models.DateTimeField(u"Start date")
end_date = models.DateTimeField(u"End date")
is_active = models.BooleanField(u"Activation", default=False)
start_date = models.DateTimeField("Start date")
end_date = models.DateTimeField("End date")
is_active = models.BooleanField("Activation", default=False)

def __unicode__(self):
return self.key
def __str__(self):
return self.key
6 changes: 3 additions & 3 deletions django_featurette/tests/tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,16 +52,16 @@ def tearDown(self):
self.feature_b.delete()

def test_anonymous_get_enabled_features_for_user(self):
self.assertItemsEqual(get_enabled_features_for_user(self.user_a), [])
self.assertEqual(list(get_enabled_features_for_user(self.user_a)), [])

def test_logged_1_get_enabled_features_for_user(self):
self.client.login(username='walter', password='pwd')
self.assertItemsEqual(get_enabled_features_for_user(self.user_a), [])
self.assertEqual(list(get_enabled_features_for_user(self.user_a)), [])
self.client.logout()

def test_logged_2_get_enabled_features_for_user(self):
self.client.login(username='jesse', password='pwd')
self.assertItemsEqual(get_enabled_features_for_user(self.user_b), [self.feature_b])
self.assertEqual(list(get_enabled_features_for_user(self.user_b)), [self.feature_b])
self.client.logout()

def test_is_feature_enabled_for_user(self):
Expand Down
13 changes: 13 additions & 0 deletions docs/changelog.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
=========
Changelog
=========


Version 0.2
===========
* Supports for Python 3


Version 0.1
===========
* First stable version
13 changes: 12 additions & 1 deletion docs/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -21,14 +21,25 @@ There are three ways to achieve that goals with Featurette:

We are going to show all these methods in the :doc:`usage` guide.

Contents:
Requirements
============

======== ======
Python 2 >= 2.7
Python 3 >= 3.2
Django >= 1.6
======== ======

Contents
========

.. toctree::
:maxdepth: 2

quickstart
usage
api
changelog

Indices and tables
==================
Expand Down
20 changes: 7 additions & 13 deletions tox.ini
Original file line number Diff line number Diff line change
@@ -1,30 +1,24 @@
[tox]
envlist =
django_1.6.X,
django_1.7.X,
{py27,py32,py33,py34}-django{16,17},
coverage

[testenv]
usedevelop = True
basepython = python2.7
deps =
django16: Django>=1.6,<1.7
django17: Django>=1.7,<1.8
commands =
django-admin.py test django_featurette
setenv =
DJANGO_SETTINGS_MODULE = settings
PYTHONPATH = {toxinidir}/tests
changedir = {toxinidir}/tests/
commands =
pip install --editable ..
django-admin.py test django_featurette

[testenv:django_1.6.X]
deps = Django>=1.6, <1.7

[testenv:django_1.7.X]
deps = Django>=1.7, <1.8

[testenv:coverage]
commands =
coverage run --branch --include={toxinidir}/django_featurette/* --omit={toxinidir}/django_featurette/tests* {envbindir}/django-admin.py test django_featurette
coveralls
deps =
coveralls
{[testenv:django_1.6.X]deps}
Django>=1.7,<1.8

0 comments on commit 6b1a783

Please sign in to comment.