Skip to content
This repository has been archived by the owner on Feb 21, 2023. It is now read-only.

Commit

Permalink
Merge eb8e868 into c8f785c
Browse files Browse the repository at this point in the history
  • Loading branch information
Michael Howitz committed Dec 15, 2018
2 parents c8f785c + eb8e868 commit 17255a1
Show file tree
Hide file tree
Showing 13 changed files with 160 additions and 44 deletions.
6 changes: 6 additions & 0 deletions .coveragerc
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
[run]
branch = True
source = z3c.preference

[report]
precision = 2
16 changes: 16 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
*.egg-info/
*.eggs
*.py[co]
.coverage
.coverage.*
.installed.cfg
.tox/
__pycache__/
bin/
build/
coverage.xml
develop-eggs/
dist/
eggs/
htmlcov/
parts/
19 changes: 19 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
language: python
python:
- 2.7
- 3.6
matrix:
include:
- python: 3.7
dist: xenial
install:
- pip install -U pip setuptools
- pip install -U coverage coveralls zope.testrunner
- pip install -U -e .[test]
script:
- coverage run -m zope.testrunner --test-path=src
after_success:
- coveralls
notifications:
email: false
cache: pip
6 changes: 4 additions & 2 deletions CHANGES.txt → CHANGES.rst
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,12 @@ Changes
=======


0.6 (unreleased)
1.0 (unreleased)
----------------

- Nothing changed yet.
- Update tests to `zope.testbrowser >= 5`.

- Add support for Python 3.6 and 3.7.


0.5 (2013-03-09)
Expand Down
17 changes: 17 additions & 0 deletions README.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
.. image:: https://travis-ci.com/zopefoundation/z3c.preference.svg?branch=master
:target: https://travis-ci.com/zopefoundation/z3c.preference

.. image:: https://coveralls.io/repos/github/zopefoundation/z3c.preference/badge.svg
:target: https://coveralls.io/github/zopefoundation/z3c.preference

.. image:: https://img.shields.io/pypi/v/z3c.preference.svg
:target: https://pypi.org/project/z3c.preference/
:alt: Current version on PyPI

.. image:: https://img.shields.io/pypi/pyversions/z3c.preference.svg
:target: https://pypi.org/project/z3c.preference/
:alt: Supported Python versions


This packages provides a user interface for `zope.preference` using
`z3c.pagelet` and `z3c.form`.
2 changes: 0 additions & 2 deletions README.txt

This file was deleted.

File renamed without changes.
77 changes: 44 additions & 33 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,61 +16,72 @@
import os
from setuptools import setup, find_packages


def read(path):
rnames = path.split('/')
return open(os.path.join(os.path.dirname(__file__), *rnames)).read()
with open(os.path.join(os.path.dirname(__file__), *rnames)) as f:
return f.read()


setup (
setup(
name='z3c.preference',
version='0.6.dev0',
author = "Michael Howitz",
author_email = "zope-dev@zope.org",
description = "UI for zope.preference using z3c.pagelet and z3c.form.",
version='1.0.dev0',
author="Michael Howitz",
author_email="zope-dev@zope.org",
description="UI for zope.preference using z3c.pagelet and z3c.form.",
long_description='\n\n'.join([
read('README.txt'),
read('README.rst'),
'.. contents::',
read('CHANGES.txt'),
read('src/z3c/preference/README.txt'),
read('src/z3c/preference/categories.txt'),
read('TODO.txt'),
]),
license = "ZPL 2.1",
keywords = "zope3 bluebream z3c preference ui",
classifiers = [
'Development Status :: 3 - Alpha',
read('CHANGES.rst'),
read('src/z3c/preference/README.rst'),
read('src/z3c/preference/categories.rst'),
read('TODO.rst'),
]),
license="ZPL 2.1",
keywords="zope3 bluebream z3c preference ui",
classifiers=[
'Development Status :: 3 - Beta',
'Environment :: Web Environment',
'Framework :: Zope :: 3'
'Intended Audience :: Developers',
'License :: OSI Approved',
'License :: OSI Approved :: Zope Public License',
'Programming Language :: Python',
'License :: OSI Approved',
'Natural Language :: English',
'Operating System :: OS Independent',
'Programming Language :: Python :: 2',
'Programming Language :: Python :: 2.7',
'Programming Language :: Python :: 3',
'Programming Language :: Python :: 3.6',
'Programming Language :: Python :: 3.7',
'Programming Language :: Python :: Implementation :: CPython',
'Programming Language :: Python :: Implementation',
'Programming Language :: Python',
'Programming Language :: Python',
'Topic :: Internet :: WWW/HTTP',
'Framework :: Zope :: 3'
],
url = 'http://pypi.python.org/pypi/z3c.preference',
packages = find_packages('src'),
include_package_data = True,
package_dir = {'':'src'},
namespace_packages = ['z3c'],
extras_require = dict(
test = [
],
url='https://github.com/zopefoundation/z3c.preference',
packages=find_packages('src'),
include_package_data=True,
package_dir={'': 'src'},
namespace_packages=['z3c'],
extras_require=dict(
test=[
'zope.app.wsgi >= 3.7',
'zope.browserresource',
'zope.login',
'zope.principalregistry',
'zope.app.principalannotation',
'zope.securitypolicy',
'zope.testbrowser',
'zope.testbrowser >= 5',
'zope.testing',
],
),
install_requires = [
],
),
install_requires=[
'setuptools',
'z3c.form',
'z3c.formui',
'z3c.pagelet',
'zope.preference',
],
zip_safe = False,
],
zip_safe=False,
)
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ The interface must be registered for preferences:
To access the forms a browser is needed, the user must be authorized as
the preferences are stored in the principal annotations:

>>> from zope.app.wsgi.testlayer import Browser
>>> from zope.testbrowser.wsgi import Browser
>>> browser = Browser()
>>> browser.addHeader('Authorization', 'Basic mgr:mgrpw')

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -86,14 +86,14 @@ The interfaces must be registered for preferences:
To access the forms a browser is needed, the user must be authorized as
the preferences are stored in the principal annotations:

>>> from zope.app.wsgi.testlayer import Browser
>>> from zope.testbrowser.wsgi import Browser
>>> browser = Browser()
>>> browser.addHeader('Authorization', 'Basic mgr:mgrpw')

The form displays the titles and descriptions of the categories:

>>> browser.open('http://localhost/++preferences++/app')
>>> print browser.contents
>>> print(browser.contents)
<!DOCTYPE ...
...General Settings...
...Settings for the whole app...
Expand Down
19 changes: 18 additions & 1 deletion src/z3c/preference/testing.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,5 +14,22 @@

import z3c.preference
import zope.app.wsgi.testlayer
import zope.testbrowser.wsgi

Layer = zope.app.wsgi.testlayer.BrowserLayer(z3c.preference)

class BrowserLayer(zope.testbrowser.wsgi.Layer,
zope.app.wsgi.testlayer.BrowserLayer):
"""BrowserLayer which is compatible with zope.testbrowser."""

def testSetUp(self):
super(BrowserLayer, self).testSetUp()
self._application.requestFactory._db = self.db

def testTearDown(self):
self._application.requestFactory._publication_cache.clear()
super(BrowserLayer, self).testTearDown()

make_wsgi_app = zope.app.wsgi.testlayer.BrowserLayer.make_wsgi_app


Layer = BrowserLayer(z3c.preference)
6 changes: 3 additions & 3 deletions src/z3c/preference/tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,10 +29,10 @@ def tearDown(test):

def test_suite():
suite = doctest.DocFileSuite(
'README.txt',
'categories.txt',
'README.rst',
'categories.rst',
setUp=setUp,
tearDown=tearDown,
optionflags=doctest.NORMALIZE_WHITESPACE|doctest.ELLIPSIS)
optionflags=doctest.NORMALIZE_WHITESPACE | doctest.ELLIPSIS)
suite.layer = z3c.preference.testing.Layer
return suite
30 changes: 30 additions & 0 deletions tox.ini
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
[tox]
envlist =
flake8,
py27,
py36,
py37,
coverage,

[testenv]
usedevelop = true
commands =
zope-testrunner --test-path=src []
extras = test
deps =
zope.testrunner

[testenv:coverage]
basepython = python3.7
commands =
coverage run -m zope.testrunner --test-path=src []
coverage report --fail-under=93
deps =
zope.testrunner
coverage

[testenv:flake8]
basepython = python3.6
skip_install = true
deps = flake8
commands = flake8 --doctests src setup.py

0 comments on commit 17255a1

Please sign in to comment.