Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Config with zope product #86

Merged
merged 3 commits into from
Feb 10, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
39 changes: 39 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
# Generated from:
# https://github.com/zopefoundation/meta/tree/master/config/zope-product
#
# EditorConfig Configuration file, for more details see:
# http://EditorConfig.org
# EditorConfig is a convention description, that could be interpreted
# by multiple editors to enforce common coding conventions for specific
# file types

# top-most EditorConfig file:
# Will ignore other EditorConfig files in Home directory or upper tree level.
root = true


[*] # For All Files
# Unix-style newlines with a newline ending every file
end_of_line = lf
insert_final_newline = true
trim_trailing_whitespace = true
# Set default charset
charset = utf-8
# Indent style default
indent_style = space
# Max Line Length - a hard line wrap, should be disabled
max_line_length = off

[*.{py,cfg,ini}]
# 4 space indentation
indent_size = 4

[*.{yml,zpt,pt,dtml}]
# 2 space indentation
indent_size = 2

[{Makefile,.gitmodules}]
# Tab indentation (no size specified, but view as 4 spaces)
indent_style = tab
indent_size = unset
tab_width = unset
58 changes: 58 additions & 0 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
# Generated from:
# https://github.com/zopefoundation/meta/tree/master/config/zope-product
name: tests

on:
push:
branches: [ master ]
pull_request:
schedule:
- cron: '0 12 * * 0' # run once a week on Sunday

jobs:
build:
strategy:
matrix:
config:
# [Python version, tox env]
- ["3.8", "lint"]
- ["2.7", "py27"]
- ["3.5", "py35"]
- ["3.6", "py36"]
- ["3.7", "py37"]
- ["3.8", "py38"]
- ["3.9", "py39"]
- ["3.8", "docs"]
- ["3.8", "coverage"]
- ["2.7", "py27-zserver"]
- ["3.7", "py37-ip_range"]

runs-on: ubuntu-latest
name: ${{ matrix.config[1] }}
steps:
- uses: actions/checkout@v2
- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.config[0] }}
- name: Pip cache
uses: actions/cache@v2
with:
path: ~/.cache/pip
key: ${{ runner.os }}-pip-${{ matrix.config[0] }}-${{ hashFiles('setup.*', 'tox.ini') }}
restore-keys: |
${{ runner.os }}-pip-${{ matrix.config[0] }}-
${{ runner.os }}-pip-
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install tox
- name: Test
run: tox -e ${{ matrix.config[1] }}
- name: Coverage
if: matrix.config[1] == 'coverage'
run: |
pip install coveralls coverage-python-version
coveralls --service=github
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
19 changes: 12 additions & 7 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,23 +1,28 @@
*.egg-info
# Generated from:
# https://github.com/zopefoundation/meta/tree/master/config/zope-product
*.egg-info/
*.profraw
*.pyc
*.pyo
*.swp
.coverage*
.coverage
.coverage.*
.eggs/
.installed.cfg
.mr.developer.cfg
.tox/
__pycache__/
bin/
build/
coverage.xml
default.profraw
develop-eggs/
develop/
dist/
docs/_build/
docs/_build
eggs/
htmlcov/
etc/
lib/
lib64
log/
parts/
pyvenv.cfg
src/
var/
59 changes: 59 additions & 0 deletions .meta.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
# Generated from:
# https://github.com/zopefoundation/meta/tree/master/config/zope-product
[meta]
template = "zope-product"
commit-id = "211d612c86d6754ebe13fad9b7081533bb603ed9"

[python]
with-appveyor = false
with-pypy = false
with-legacy-python = true
with-docs = true
with-sphinx-doctests = false

[coverage]
fail-under = 89

[isort]
known_first_party = "Products.PluginRegistry, Products.StandardCacheManagers, Products.GenericSetup"

[check-manifest]
additional-ignores = [
"docs/_build/html/_sources/api/*",
]

[manifest]
additional-rules = [
"include buildout4.cfg",
"recursive-include src *.gif",
"recursive-include src *.objects",
"recursive-include src *.png",
"recursive-include src *.xml",
"recursive-include src *.zpt",
]

[tox]
additional-envlist = [
"py27-zserver",
"py37-ip_range",
]
testenv-additional = [
"",
"[testenv:py27-zserver]",
"commands_pre =",
" {envbindir}/buildout -nc {toxinidir}/buildout4.cfg buildout:directory={envdir} buildout:develop={toxinidir} install test-zserver",
"commands =",
" {envbindir}/test-zserver {posargs:-cv}",
"",
"[testenv:py37-ip_range]",
"commands_pre =",
" {envbindir}/buildout -nc {toxinidir}/buildout.cfg buildout:directory={envdir} buildout:develop={toxinidir} install test-ip_range",
"commands =",
" {envbindir}/test-ip_range {posargs:-cv}",
]

[github-actions]
additional-config = [
"- [\"2.7\", \"py27-zserver\"]",
"- [\"3.7\", \"py37-ip_range\"]",
]
43 changes: 0 additions & 43 deletions .travis.yml

This file was deleted.

24 changes: 16 additions & 8 deletions MANIFEST.in
Original file line number Diff line number Diff line change
@@ -1,16 +1,24 @@
# Generated from:
# https://github.com/zopefoundation/meta/tree/master/config/zope-product
include *.rst
include *.txt
include buildout.cfg
include buildout4.cfg
include tox.ini

recursive-include Products *.gif
recursive-include Products *.objects
recursive-include Products *.png
recursive-include Products *.txt
recursive-include Products *.xml
recursive-include Products *.zcml
recursive-include Products *.zpt
recursive-include docs *.bat
recursive-include docs *.py
recursive-include docs *.rst
recursive-include docs *.txt
recursive-include docs Makefile

recursive-include src *.pt
recursive-include src *.py
recursive-include src *.rst
recursive-include src *.txt
recursive-include src *.zcml
include buildout4.cfg
recursive-include src *.gif
recursive-include src *.objects
recursive-include src *.png
recursive-include src *.xml
recursive-include src *.zpt
41 changes: 12 additions & 29 deletions setup.cfg
Original file line number Diff line number Diff line change
@@ -1,44 +1,27 @@
# Generated from:
# https://github.com/zopefoundation/meta/tree/master/config/zope-product
[bdist_wheel]
universal = 1

[zest.releaser]
create-wheel = yes
[flake8]
doctests = 1
no-accept-encodings = True
htmldir = parts/flake8

[check-manifest]
ignore =
coverage.xml
tox.ini
.travis.yml
.editorconfig
.meta.toml
docs/_build/html/_sources/*
docs/_build/html/_sources/api/*

[isort]
force_single_line = True
combine_as_imports = True
sections = FUTURE,STDLIB,THIRDPARTY,ZOPE,FIRSTPARTY,LOCALFOLDER
known_first_party = Products.PluginRegistry, Products.StandardCacheManagers, Products.GenericSetup
known_third_party = six
known_third_party = six, docutils, pkg_resources
known_zope =
known_first_party = Products.PluginRegistry, Products.StandardCacheManagers, Products.GenericSetup
default_section = ZOPE
line_length = 79
lines_after_imports = 2

[flake8]
no-accept-encodings = True
doctests = True
exclude =
bootstrap.py
htmldir = parts/flake8

[coverage:run]
branch = True
source = Products
omit =

[coverage:report]
fail_under = 85.00
ignore_errors = True
precision = 2
show_missing = False
sort = Name

[coverage:html]
directory = parts/coverage
3 changes: 2 additions & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,8 @@ def _package_doc(name):
'Products.PluggableAuthService'),
},
license='ZPL 2.1 (http://www.zope.org/Resources/License/ZPL-2.1)',
packages=find_packages(),
packages=find_packages('src'),
package_dir={'': 'src'},
include_package_data=True,
namespace_packages=['Products'],
zip_safe=False,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@


def extraction(self, request):

""" Fetch HTTP Basic Auth credentials from the request.
"""
creds = request._authUserPW()
Expand All @@ -30,7 +29,6 @@ def extraction(self, request):


def authentication(self, credentials):

""" Authenticate against nested acl_users.
"""
real_user_folder = self.simple_uf.acl_users
Expand All @@ -44,7 +42,6 @@ def authentication(self, credentials):


def authorize(self, user):

""" Fetch user roles from nested acl_users.
"""
real_user_folder = self.simple_uf.acl_users
Expand Down