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

Commit

Permalink
Merge pull request #1 from zopefoundation/resurrection-python3
Browse files Browse the repository at this point in the history
Resurrection python3.
  • Loading branch information
janwijbrand committed Jan 10, 2018
2 parents fed421f + 74e50ef commit 3a3c520
Show file tree
Hide file tree
Showing 14 changed files with 264 additions and 130 deletions.
12 changes: 8 additions & 4 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,7 +1,11 @@
src/*.egg-info
parts
develop-eggs
dev
bin
*.pyc
.tox
.mr.developer.cfg
.installed.cfg
.coverage
__pycache__
bin
develop-eggs
parts
src/*.egg-info
15 changes: 12 additions & 3 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,10 +1,19 @@
language: python
python:
- 2.7
- 3.4
- 3.5
- 3.6
- pypy
- pypy3
install:
- python bootstrap.py
- bin/buildout
- pip install -U pip setuptools
- pip install -U zope.testrunner coverage coveralls
- pip install -U -e .[test]
script:
- bin/test -v1
- coverage run -m zope.testrunner --test-path=src
after_success:
- coveralls
notifications:
email: false
cache: pip
4 changes: 1 addition & 3 deletions CHANGES.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,7 @@ Changes
1.4 (unreleased)
================

- Nothing changed yet.

- Python 3 compatibility.

1.3 (2012-05-02)
================
Expand All @@ -28,4 +27,3 @@ Changes
================

- Factor out form grok base package

6 changes: 6 additions & 0 deletions MANIFEST.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
include *.txt
include *.rst
include bootstrap.py
include buildout.cfg
include .travis.yml
recursive-include src *.py *.zcml
10 changes: 9 additions & 1 deletion buildout.cfg
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
[buildout]
extends = https://raw.github.com/zopefoundation/groktoolkit/master/grok.cfg
extends =
https://raw.githubusercontent.com/zopefoundation/groktoolkit/resurrection-python3/grok.cfg
develop = .
parts =
omelette
test

[versions]
Expand All @@ -13,3 +15,9 @@ eggs =
grokcore.rest
grokcore.rest[test]
defaults = ['--tests-pattern', '^f?tests$', '-v', '--auto-color']

[omelette]
recipe = collective.recipe.omelette
eggs =
grokcore.rest
grokcore.rest[test]
26 changes: 20 additions & 6 deletions setup.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
from setuptools import setup, find_packages
import os


def read(*rnames):
return open(os.path.join(os.path.dirname(__file__), *rnames)).read()


long_description = (
read('README.txt')
+ '\n' +
Expand All @@ -13,16 +15,19 @@ def read(*rnames):
'********\n'
)


tests_require = [
'grokcore.content',
'grokcore.view [security_publication]',
'grokcore.view [test]',
'grokcore.view[security_publication]',
'grokcore.view[test]',
'six',
'zope.app.appsetup',
'zope.app.wsgi',
'zope.errorview',
'zope.testing',
]


setup(
name='grokcore.rest',
version='1.4.dev0',
Expand All @@ -38,20 +43,29 @@ def read(*rnames):
'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.4',
'Programming Language :: Python :: 3.5',
'Programming Language :: Python :: 3.6',
'Programming Language :: Python :: Implementation',
'Programming Language :: Python :: Implementation :: CPython',
'Programming Language :: Python :: Implementation :: PyPy',
'Framework :: Zope3',
],
packages=find_packages('src'),
package_dir = {'': 'src'},
package_dir={'': 'src'},
namespace_packages=['grokcore'],
include_package_data = True,
include_package_data=True,
zip_safe=False,
install_requires=[
'setuptools',
'grokcore.component >= 2.5dev',
'grokcore.security',
'grokcore.traverser >= 3.0.0',
'grokcore.view',
'grokcore.traverser',
'martian',
'setuptools',
'zope.component',
'zope.interface',
'zope.publisher >= 4.2.2',
Expand Down
2 changes: 1 addition & 1 deletion src/grokcore/rest/components.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,9 @@
from grokcore.rest.interfaces import IREST


@interface.implementer(IREST)
class REST(zope.location.Location, ViewSupport):
"""Base class for REST views in Grok applications."""
interface.implements(IREST)

def __init__(self, context, request):
self.context = self.__parent__ = context
Expand Down
10 changes: 6 additions & 4 deletions src/grokcore/rest/ftests/rest/localgrants.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,12 @@
For this model we have registered a REST GET view that's protected
with a permission. Therefore we can't access it as anonymous:
>>> print http_call('GET', '/++rest++mammoth/manfred')
>>> print(http_call(wsgi_app(), 'GET', '/++rest++mammoth/manfred HTTP/1.1'))
Traceback (most recent call last):
...
Unauthorized: (<grokcore.rest.meta.MammothRest object at 0...>, '__call__', 'mammoth.Touch')
zope.security.interfaces.Unauthorized: \
(<grokcore.rest.meta.MammothRest object at 0...>, \
'__call__', 'mammoth.Touch')
However, if we make a (local!) grant, e.g. on the root object, we can
access the view just fine:
Expand All @@ -23,10 +25,10 @@
With the grant in place we can access it as anonymous:
>>> print http('GET /++rest++mammoth/manfred HTTP/1.1')
>>> print(http(wsgi_app(), b'GET /++rest++mammoth/manfred HTTP/1.1'))
HTTP/1.0 200 Ok
Content-Length: 7
Content-Type: text/plain
Content-Type: text/plain;charset=utf-8
<BLANKLINE>
manfred
Expand Down
Loading

0 comments on commit 3a3c520

Please sign in to comment.