Skip to content

Commit

Permalink
Add Py36, Drop Py33.
Browse files Browse the repository at this point in the history
- Coverage tox environment and coveralls (not 100% covered).
- Badges.
- Fix tests with zope.component 4.4.0.
  • Loading branch information
jamadden committed Jul 28, 2017
1 parent bfcfdca commit b15461f
Show file tree
Hide file tree
Showing 9 changed files with 200 additions and 132 deletions.
11 changes: 11 additions & 0 deletions .coveragerc
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
[run]
source = zope.browserresource

[report]
precision = 2
exclude_lines =
pragma: no cover
if __name__ == '__main__':
raise NotImplementedError
self.fail
raise AssertionError
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
*.egg-info
*.pyc
.tox
.coverage
htmlcov/
21 changes: 13 additions & 8 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,15 +1,20 @@
language: python
sudo: false
python:
- 2.7
- 3.3
- 3.4
- 3.5
- pypy
- pypy3
- 2.7
- 3.4
- 3.5
- 3.6
- pypy
- pypy3.5-5.8.0
install:
- pip install tox-travis
- pip install -U pip setuptools
- pip install -U coverage coveralls
- pip install -U -e .[test]
script:
- tox
- coverage run -m zope.testrunner --test-path=src
after_success:
- coveralls
notifications:
email: false
cache: pip
39 changes: 20 additions & 19 deletions CHANGES.rst
Original file line number Diff line number Diff line change
@@ -1,16 +1,17 @@
Changes
=======
=========
Changes
=========

4.2.0 (unreleased)
------------------
==================

- Add support for Python 3.5.
- Add support for Python 3.5 and 3.6.

- Drop support for Python 2.6.
- Drop support for Python 2.6 and 3.3.


4.1.0 (2014-12-26)
------------------
==================

- Add support for PyPy. PyPy3 support awaits release of fix for:
https://bitbucket.org/pypy/pypy/issue/1946
Expand All @@ -21,20 +22,20 @@ Changes


4.0.2 (2014-11-04)
------------------
==================

- Return no ETag if no adapter is registered, disabling the
requirement for applications that was introduced in 3.11.0 (GitHub #1)


4.0.1 (2013-04-03)
------------------
==================

- Fix some Python 3 string vs bytes issues.


4.0.0 (2013-02-20)
------------------
==================

- Replace deprecated ``zope.component.adapts`` usage with equivalent
``zope.component.adapter`` decorator.
Expand All @@ -54,32 +55,32 @@ Changes


3.12.0 (2010-12-14)
-------------------
===================

- Add ``zcml`` extra dependencies and fixed dependencies of
``configure.zcml`` on other packages' ``meta.zcml``.

- Add a test for including our own ``configure.zcml``.

3.11.0 (2010-08-13)
-------------------
===================

- Support the HTTP ETag header for file resources. ETag generation can be
customized or disabled by providing an IETag multi-adapter on
(IFileResource, your-application-skin).

3.10.3 (2010-04-30)
-------------------
===================

- Prefer the standard libraries doctest module to the one from zope.testing.

3.10.2 (2009-11-25)
-------------------
===================

- The previous release had a broken egg, sorry.

3.10.1 (2009-11-24)
-------------------
===================

- Import hooks functionality from zope.component after it was moved there from
zope.site. This lifts the dependency on zope.site and thereby, ZODB.
Expand All @@ -88,16 +89,16 @@ Changes
there from zope.location.

3.10.0 (2009-09-25)
-------------------
===================

- Add an ability to forbid publishing of some files in the resource directory,
this is done by fnmatch'ing the wildcards in the ``forbidden_names``class
attribute of ``DirectoryResource``. By default, the ``.svn`` is in that
attribute, so directories won't publish subversion system directory that can
contain private information.
contain private information.

3.9.0 (2009-08-27)
------------------
==================

Initial release. This package was splitted off zope.app.publisher as a part
of refactoring process.
Expand All @@ -110,7 +111,7 @@ Additional changes that are made during refactoring:
file extension, so it's now possible to add new resource types without
introducing new ZCML directives and they will work inside resource
directories as well.

NOTE: the "resource_factories" attribute from the DirectoryResource
was removed, so if you were using this attribute for changing resource
classes for some file extensions, you need to migrate your code to new
Expand All @@ -122,7 +123,7 @@ Additional changes that are made during refactoring:
To migrate, simply rename the "image" argument in browser:resource and
browser:i18n-resource directives to "file", if you don't do this, resouces
will work, but you'll get deprecation warnings.

If you need custom behaviour for images, you can register a resource
factory utility for needed file extensions.

Expand Down
31 changes: 21 additions & 10 deletions README.rst
Original file line number Diff line number Diff line change
@@ -1,9 +1,20 @@
``zope.browserresource`` Overview
=================================

.. image:: https://img.shields.io/pypi/v/zope.browserresource.svg
:target: https://pypi.python.org/pypi/zope.browserresource/
:alt: Latest release

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

.. image:: https://travis-ci.org/zopefoundation/zope.browserresource.png?branch=master
:target: https://travis-ci.org/zopefoundation/zope.browserresource

.. image:: https://coveralls.io/repos/github/zopefoundation/zope.browserresource/badge.svg?branch=master
:target: https://coveralls.io/github/zopefoundation/zope.browserresource?branch=master

.. note::
This package is at present not reusable without depending on a large
chunk of the Zope Toolkit and its assumptions. It is maintained by the
Expand All @@ -19,8 +30,8 @@ sheets, or JavaScript files.
Resources are be registered under a symbolic name and can later be referred to
by that name, so their usage is independent from their physical location.

You can register a single file with the `<browser:resource>` directive, and a
whole directory with the `<browser:resourceDirectory>` directive, for example
You can register a single file with the ``<browser:resource>`` directive, and a
whole directory with the ``<browser:resourceDirectory>`` directive, for example

<browser:resource
file="/path/to/static.file"
Expand All @@ -35,18 +46,18 @@ whole directory with the `<browser:resourceDirectory>` directive, for example
This causes a named adapter to be registered that adapts the request to
zope.interface.Interface (XXX why do we not use an explicit interface?),
so to later retrieve a resource, use
`zope.component.getAdapter(request, name='myfile')`.
``zope.component.getAdapter(request, name='myfile')``.

There are two ways to traverse to a resource,

1. with the 'empty' view on a site, e. g. `http://localhost/@@/myfile`
1. with the 'empty' view on a site, e. g. ``http://localhost/@@/myfile``
(This is declared by zope.browserresource)

2. with the `++resource++` namespace, e. g. `http://localhost/++resource++myfile`
2. with the ``++resource++`` namespace, e. g. ``http://localhost/++resource++myfile``
(This is declared by zope.traversing.namespace)

In case of resource-directories traversal simply continues through its contents,
e. g. `http://localhost/@@/main-images/subdir/sample.jpg`
e. g. ``http://localhost/@@/main-images/subdir/sample.jpg``

Rather than putting together the URL to a resource manually, you should use
zope.traversing.browser.interfaces.IAbsoluteURL to get the URL, or for a
Expand All @@ -57,7 +68,7 @@ because you want to use a web server specialized in serving static files instead
of the appserver, you can register an IAbsoluteURL adapter for the site under
the name 'resource' that will be used to compute the base URLs for resources.

For example, if you register 'http://static.example.com/' as the base 'resource'
URL, the resources from the above example would yield the following absolute
URLs: http://static.example.com/@@/myfile and
http://static.example.com/@@/main-images
For example, if you register ``http://static.example.com/`` as the
base 'resource' URL, the resources from the above example would yield
the following absolute URLs: ``http://static.example.com/@@/myfile``
and ``http://static.example.com/@@/main-images``.
5 changes: 5 additions & 0 deletions setup.cfg
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
[bdist_wheel]
universal = 1

[zest.releaser]
create-wheel = yes
83 changes: 46 additions & 37 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,53 +39,62 @@ def test_suite():

long_description = read('README.rst') + '\n\n' + read('CHANGES.rst')

ZCML_REQUIRES = [
'zope.component[zcml]',
'zope.securitypolicy[zcml] >= 3.8',
]

TESTS_REQUIRE = ZCML_REQUIRES + [
'zope.testing',
'zope.testrunner',
]

setup(name='zope.browserresource',
version='4.2.0.dev0',
url='http://pypi.python.org/pypi/zope.browserresource/',
url='http://github.com/zopefoundation/zope.browserresource/',
author='Zope Foundation and Contributors',
author_email='zope-dev@zope.org',
classifiers = [
'Environment :: Web Environment',
'Intended Audience :: Developers',
'License :: OSI Approved :: Zope Public License',
'Programming Language :: Python',
'Programming Language :: Python :: 2',
'Programming Language :: Python :: 2.7',
'Programming Language :: Python :: 3',
'Programming Language :: Python :: 3.3',
'Programming Language :: Python :: 3.4',
'Programming Language :: Python :: 3.5',
'Programming Language :: Python :: Implementation :: CPython',
'Programming Language :: Python :: Implementation :: PyPy',
'Operating System :: OS Independent',
'Topic :: Internet :: WWW/HTTP',
'Framework :: Zope3',
],
classifiers=[
'Environment :: Web Environment',
'Intended Audience :: Developers',
'License :: OSI Approved :: Zope Public License',
'Programming Language :: Python',
'Programming Language :: Python :: 2',
'Programming Language :: Python :: 2.7',
'Programming Language :: Python :: 3',
'Programming Language :: Python :: 3.3',
'Programming Language :: Python :: 3.4',
'Programming Language :: Python :: 3.5',
'Programming Language :: Python :: Implementation :: CPython',
'Programming Language :: Python :: Implementation :: PyPy',
'Operating System :: OS Independent',
'Topic :: Internet :: WWW/HTTP',
'Framework :: Zope3',
],
description='Browser resources implementation for Zope.',
long_description=long_description,
license='ZPL 2.1',
packages=find_packages('src'),
package_dir={'': 'src'},
test_suite='__main__.test_suite',

tests_require=TESTS_REQUIRE,
namespace_packages=['zope'],
include_package_data=True,
install_requires=['setuptools',
'zope.component>=3.8.0',
'zope.configuration',
'zope.contenttype>=4.0.1',
'zope.i18n',
'zope.interface',
'zope.location',
'zope.publisher>=3.8',
'zope.schema',
'zope.traversing>3.7',
],
install_requires=[
'setuptools',
'zope.component>=3.8.0',
'zope.configuration',
'zope.contenttype>=4.0.1',
'zope.i18n',
'zope.interface',
'zope.location',
'zope.publisher>=3.8',
'zope.schema',
'zope.traversing>3.7',
],
extras_require={
'test': ['zope.testing'],
'zcml': ['zope.component[zcml]',
'zope.security[zcml]>=3.8'],
},

zip_safe = False,
)
'test': TESTS_REQUIRE,
'zcml': ZCML_REQUIRES,
},
zip_safe=False,
)
Loading

0 comments on commit b15461f

Please sign in to comment.