Skip to content

Commit

Permalink
- Removed pytz dependency, closes tarak#47.
Browse files Browse the repository at this point in the history
- Reenabled importing of get_current_site(), closes tarak#50
- Removed unused imports.
- Cleaned up.
  • Loading branch information
tarak committed Jul 7, 2016
1 parent b5799f1 commit 1aa31f7
Show file tree
Hide file tree
Showing 15 changed files with 72 additions and 27 deletions.
6 changes: 3 additions & 3 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,14 @@ python:
- "3.3"
- "3.4"
env:
- DJANGO="1.7.10"
- DJANGO="1.8.6"
- DJANGO="1.7"
- DJANGO="1.8"
- DJANGO="1.9"
install:
- pip install -q Django==$DJANGO
- pip install pep8
- pip install coveralls
- pip install django-easysettings
- pip install pytz
- pip install -q -e .
before_script:
- "pep8 --ignore=E501,E225 password_policies"
Expand Down
1 change: 0 additions & 1 deletion README

This file was deleted.

48 changes: 48 additions & 0 deletions README
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
django-password-policies
========================

|travis| |coverage| |landscape| |requires| |latest-version| |downloads|

``django-password-policies`` is an application for the `Django`_ framework that
provides unicode-aware password policies on password changes and resets and a
mechanism to force password changes.

.. |travis| image:: https://travis-ci.org/tarak/django-password-policies.svg?branch=master
:target: https://travis-ci.org/tarak/django-password-policies
.. |coverage| image:: https://coveralls.io/repos/tarak/django-password-policies/badge.svg?branch=master
:target: https://coveralls.io/r/tarak/django-password-policies?branch=master
.. |landscape| image:: https://landscape.io/github/tarak/django-password-policies/master/landscape.svg?style=flat
:target: https://landscape.io/github/tarak/django-password-policies/master
:alt: Code Health
.. |requires| image:: https://requires.io/github/tarak/django-password-policies/requirements.svg?branch=master
:target: https://requires.io/github/tarak/django-password-policies/requirements/?branch=master
:alt: Requirements Status
.. |latest-version| image:: https://img.shields.io/pypi/v/django-password-policies.svg
:alt: Latest version on PyPI
:target: https://pypi.python.org/pypi/django-password-policies
.. |downloads| image:: https://img.shields.io/pypi/dm/django-password-policies.svg
:alt: Monthly downloads from PyPI
:target: https://pypi.python.org/pypi/django-password-policies

.. _requirements:

Requirements
=============

This application requires

* `Django`_ 1.7 or newer
* `django-easysettings`_
* `pytz`_

.. _documentation:

Documentation
=============

A detailled documentation is available on `the project's GitHub Pages`_.

.. _`the project's GitHub Pages`: http://tarak.github.com/django-password-policies
.. _`Django`: https://www.djangoproject.com/
.. _`django-easysettings`: https://github.com/SmileyChris/django-easysettings
.. _`pytz`: http://pythonhosted.org/pytz/
2 changes: 0 additions & 2 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@ This application requires

* `Django`_ 1.7 or newer
* `django-easysettings`_
* `pytz`_

.. _documentation:

Expand All @@ -45,4 +44,3 @@ A detailled documentation is available on `the project's GitHub Pages`_.
.. _`the project's GitHub Pages`: http://tarak.github.com/django-password-policies
.. _`Django`: https://www.djangoproject.com/
.. _`django-easysettings`: https://github.com/SmileyChris/django-easysettings
.. _`pytz`: http://pythonhosted.org/pytz/
11 changes: 7 additions & 4 deletions docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,17 @@
# All configuration values have a default; values that are commented out
# serve to show the default.

import sys, os, django
import sys
import os
import django

# If extensions (or modules to document with autodoc) are in another directory,
# add these directories to sys.path here. If the directory is relative to the
# documentation root, use os.path.abspath to make it absolute, like shown here.
#sys.path.insert(0, os.path.abspath('.'))
# sys.path.insert(0, os.path.abspath('.'))
sys.path.append(os.path.abspath(os.path.join(os.path.dirname(__file__), "_ext")))
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "password_policies.tests.settings")

from password_policies.tests import settings

django.setup()
Expand All @@ -28,7 +31,7 @@
# -- General configuration -----------------------------------------------------

# If your documentation needs a minimal Sphinx version, state it here.
#needs_sphinx = '1.0'
# needs_sphinx = '1.0'

# Add any Sphinx extension module names here, as strings. They can be extensions
# coming with Sphinx (named 'sphinx.ext.*') or your custom ones.
Expand All @@ -41,7 +44,7 @@
source_suffix = '.rst'

# The encoding of source files.
#source_encoding = 'utf-8-sig'
# source_encoding = 'utf-8-sig'

# The master toctree document.
master_doc = 'contents'
Expand Down
2 changes: 1 addition & 1 deletion docs/contents.rst
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ Table of contents
:hidden:

index

.. toctree::
:maxdepth: 3

Expand Down
4 changes: 2 additions & 2 deletions docs/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ For bugfixing and feature requests please read:

* **Support:**
:doc:`Getting help <topics/support>`

To participate in the development of this application please read:

* **Development:**
Expand All @@ -38,5 +38,5 @@ To participate in the development of this application please read:
:doc:`Contributing <topics/contributing>` |
:doc:`Internationalization <topics/internationalization>` |
:doc:`License <license>`

.. _`Django`: https://www.djangoproject.com/
2 changes: 0 additions & 2 deletions docs/topics/install.rst
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ This application requires

* `Django`_ 1.7 or newer
* `django-easysettings`_
* `pytz`_

.. _install-cracklib:

Expand Down Expand Up @@ -100,6 +99,5 @@ inside the Python path::

.. _`Django`: https://www.djangoproject.com/
.. _`django-easysettings`: https://github.com/SmileyChris/django-easysettings
.. _`pytz`: http://pythonhosted.org/pytz/
.. _`Python bindings for cracklib`: http://www.nongnu.org/python-crack/
.. _`Levenshtein Python C extension module`: https://github.com/miohtama/python-Levenshtein
8 changes: 6 additions & 2 deletions password_policies/forms/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,7 @@
from django import forms
from django.contrib.auth.hashers import is_password_usable
from django.contrib.auth.hashers import make_password
from django.contrib.auth.forms import AdminPasswordChangeForm
from django.contrib.auth import get_user_model
from django.contrib.sites.shortcuts import get_current_site
from django.core import signing
from django.core.exceptions import ObjectDoesNotExist
from django.template import loader
Expand All @@ -17,6 +15,12 @@
except ImportError:
from django.utils.datastructures import SortedDict


try:
from django.contrib.sites.models import get_current_site
except ImportError:
from django.contrib.sites.shortcuts import get_current_site

from django.utils.http import urlsafe_base64_encode
from django.utils.encoding import force_bytes
from django.utils.translation import ugettext_lazy as _
Expand Down
1 change: 0 additions & 1 deletion password_policies/managers.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
from datetime import datetime
from datetime import timedelta

from django.db import models
Expand Down
1 change: 0 additions & 1 deletion password_policies/middleware.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
# from datetime import datetime
import re
from datetime import timedelta
from django.core.urlresolvers import resolve, reverse, NoReverseMatch, \
Expand Down
6 changes: 3 additions & 3 deletions password_policies/tests/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,13 @@

DEBUG = False

LANGUAGES=(
LANGUAGES = (
('en', 'English'),
)

LANGUAGE_CODE='en'
LANGUAGE_CODE = 'en'

USE_TZ=False
USE_TZ = False
# If you set this to False, Django will make some optimizations so as not
# to load the internationalization machinery.
USE_I18N = True
Expand Down
1 change: 0 additions & 1 deletion password_policies/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
from django.views.generic.edit import FormView
from django.views.decorators.cache import never_cache
from django.views.decorators.csrf import csrf_protect
from django.views.decorators.debug import sensitive_post_parameters

from password_policies.conf import settings
from password_policies.forms import PasswordPoliciesForm
Expand Down
3 changes: 1 addition & 2 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,2 @@
django>=1.7,<1.9
django>=1.7,<1.10
django-easysettings>=1.0
pytz
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
from setuptools import setup, find_packages


install_requires=['django>1.6', 'django-easysettings', 'pytz']
install_requires = ['django>1.6', 'django-easysettings']

setup(
name='django-password-policies',
Expand Down
1 change: 0 additions & 1 deletion tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@

import django
from django.conf import settings
from django.utils.termcolors import colorize


def runtests(*test_args):
Expand Down

0 comments on commit 1aa31f7

Please sign in to comment.