Skip to content
This repository has been archived by the owner on May 13, 2020. It is now read-only.

Commit

Permalink
Python 3.5, 3.6 and PyPy support.
Browse files Browse the repository at this point in the history
- Add a test for the configure.zcml and correct the errors exposed.
- Include zope.security when we test so the whole ZCML file gets included.
- Enable pip caching on Travis
- Enable coveralls on Travis.
- Fix long-description rendering error exposed by restview.
  • Loading branch information
jamadden committed May 6, 2017
1 parent 56c68b8 commit a8ebe05
Show file tree
Hide file tree
Showing 12 changed files with 93 additions and 32 deletions.
6 changes: 6 additions & 0 deletions .coveragerc
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
[run]
source = src

[report]
exclude_lines =
pragma: no cover
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -10,3 +10,5 @@ bin
build
develop-eggs
parts
.coverage
htmlcov/
14 changes: 12 additions & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,19 @@ sudo: false
python:
- 2.7
- 3.4
- 3.5
- 3.6
- pypy-5.4.1
install:
- pip install tox-travis
- pip install -U pip setuptools
- pip install -U coverage coveralls zope.testrunner
- pip install -U -e .[test]
script:
- tox
- coverage run -m zope.testrunner --test-path=src --auto-color --auto-progress
notifications:
email: false
after_success:
- coveralls
cache: pip
before_cache:
- rm -f $HOME/.cache/pip/log/debug.log
17 changes: 9 additions & 8 deletions CHANGES.rst
Original file line number Diff line number Diff line change
@@ -1,16 +1,17 @@
Changelog of z3c.bcrypt
=======================
=========================
Changelog of z3c.bcrypt
=========================

1.2.1 (unreleased)
----------------
1.3.0 (unreleased)
==================

- Standardize namespace __init__.

- Add support for Python 3.4.
- Add support for Python 3.4, 3.5, 3.6 and PyPy.


1.2 (2013-10-10)
----------------
================

- Only verify the first 4096 characters of a password to prevent
denial-of-service attacks through repeated submission of large
Expand All @@ -20,11 +21,11 @@ Changelog of z3c.bcrypt
See: https://www.djangoproject.com/weblog/2013/sep/15/security/

1.1 (2010-02-22)
----------------
================

- Fixes in the configure.zcml.

1.0 (2010-02-18)
----------------
================

- Initial public release.
2 changes: 2 additions & 0 deletions MANIFEST.in
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@ include *.rst
include *.py
include buildout.cfg
include tox.ini
include .travis.yml
include .coveragerc

recursive-include src *.rst *.zcml

Expand Down
5 changes: 3 additions & 2 deletions README.rst
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
z3c.bcrypt
==========
============
z3c.bcrypt
============

z3c.bcrypt provides `zope.password`_ compatible "password manager" utilities
that use bcrypt (or alternatively pbkdf2) encoding for storing passwords.
Expand Down
20 changes: 14 additions & 6 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
"Password manager utility using bcrypt or pbkdf2 encoding. "
"Useful in combination with zope.password"),
long_description=long_description,
classifiers = [
classifiers=[
'Development Status :: 5 - Production/Stable',
'Environment :: Web Environment',
'Intended Audience :: Developers',
Expand All @@ -26,13 +26,20 @@
'Operating System :: OS Independent',
'Topic :: Internet :: WWW/HTTP',
'Framework :: Zope3',
'Programming Language :: Python',
'Programming Language :: Python :: 2',
'Programming Language :: Python :: 2.7',
'Programming Language :: Python :: 3',
'Programming Language :: Python :: 3.4',
'Programming Language :: Python :: 3.5',
'Programming Language :: Python :: 3.6',
'Programming Language :: Python :: Implementation :: CPython',
'Programming Language :: Python :: Implementation :: PyPy',
],
keywords='zope authentication password bcrypy pbkdf2',
author = "The Health Agency and the Zope Community",
author_email = "zope3-dev@zope.org",
url='http://pypi.python.org/pypi/z3c.bcrypt',
author="The Health Agency and the Zope Community",
author_email="zope3-dev@zope.org",
url='http://github.com/zopefoundation/z3c.bcrypt',
license='ZPL 2.1',
package_dir={'': 'src'},
packages=find_packages('src'),
Expand All @@ -45,12 +52,13 @@
'zope.interface',
'zope.password',
],
extras_require = dict(
extras_require=dict(
test=[
'zope.security',
'zope.testing',
],
),
entry_points={
'console_scripts': [],
},
)
)
8 changes: 1 addition & 7 deletions src/z3c/__init__.py
Original file line number Diff line number Diff line change
@@ -1,7 +1 @@
# this is a namespace package
try:
import pkg_resources
pkg_resources.declare_namespace(__name__)
except ImportError:
import pkgutil
__path__ = pkgutil.extend_path(__path__, __name__)
__import__('pkg_resources').declare_namespace(__name__) # pragma: no cover
27 changes: 25 additions & 2 deletions src/z3c/bcrypt/USAGE.rst
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
z3c.bcrypt
===========
==================
Using z3c.bcrypt
==================

>>> from zope.interface.verify import verifyObject
>>> from zope.password.interfaces import IPasswordManager
Expand Down Expand Up @@ -55,3 +56,25 @@ not be in place. XXX how to test that reliably?
>>> incomming = '$p5k2$1000$' + 'a' * 1024 * 1024 * 100 # lot of data.
>>> manager.checkPassword(encoded, incomming)
False

Configuration
=============

This package provides a ``configure.zcml`` which installs
implementations of the ``IPasswordManager`` as utilities:

>>> from zope.configuration import xmlconfig
>>> _ = xmlconfig.string("""
... <configure
... xmlns="http://namespaces.zope.org/zope">
...
... <include package="z3c.bcrypt" />
... </configure>
... """)

>>> from zope import component
>>> from zope.password.interfaces import IPasswordManager
>>> component.getUtility(IPasswordManager, name='bcrypt')
<z3c.bcrypt.passwordmanager.BcryptPasswordManager object at ...>
>>> component.getUtility(IPasswordManager, name='pbkdf2')
<z3c.bcrypt.passwordmanager.PBKDF2PasswordManager object at ...>
6 changes: 5 additions & 1 deletion src/z3c/bcrypt/configure.zcml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@
xmlns="http://namespaces.zope.org/zope"
xmlns:zcml="http://namespaces.zope.org/zcml">

<include package="zope.component" file="meta.zcml" />
<configure zcml:condition="installed zope.security">
<include package="zope.security" file="meta.zcml" />
</configure>
<include package="zope.password" />

<utility
Expand All @@ -23,4 +27,4 @@
<allow interface="zope.password.interfaces.IPasswordManager" />
</class>
</configure>
</configure>
</configure>
16 changes: 13 additions & 3 deletions src/z3c/bcrypt/tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,21 @@
import re

from zope.testing.renormalizing import OutputChecker

from zope.testing import cleanup

def test_suite():
checker = OutputChecker([
(re.compile("u('.*')"), r'\1'),
])
return doctest.DocFileSuite('USAGE.rst', optionflags=doctest.ELLIPSIS,
checker=checker)

def setUp(_test):
cleanup.setUp()
tearDown = setUp

return doctest.DocFileSuite(
'USAGE.rst',
optionflags=doctest.ELLIPSIS,
checker=checker,
setUp=setUp,
tearDown=tearDown,
)
2 changes: 1 addition & 1 deletion tox.ini
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[tox]
envlist = py27,py34
envlist = py27,py34,py35,py36,pypy

[testenv]
deps =
Expand Down

0 comments on commit a8ebe05

Please sign in to comment.