Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/testing' into stable
Browse files Browse the repository at this point in the history
  • Loading branch information
Andreas Kaiser committed Nov 20, 2020
2 parents a576fe5 + 191f972 commit 886bc56
Show file tree
Hide file tree
Showing 7 changed files with 71 additions and 61 deletions.
6 changes: 6 additions & 0 deletions CHANGES.txt
@@ -1,6 +1,12 @@
Change History
==============

2.0.4 - 2020-11-20
------------------

- Replace deprecated ``bleach_whitelist`` with its successor ``bleach-allowlist``.
- Upgrade ``iso8601``.

2.0.3 - 2020-11-18
------------------

Expand Down
2 changes: 2 additions & 0 deletions README.rst
Expand Up @@ -118,6 +118,8 @@ We adhere to `high quality coding standards`_, have an extensive test suite with

Contributions are always welcome, read our `contribution guidelines`_ and visit our `Github repository`_.

.. _continuous integration: http://travis-ci.org/Kotti/Kotti

.. |build_status_master_postgresql| image:: https://github.com/Kotti/Kotti/workflows/PostgreSQL/badge.svg?branch=master
.. _build_status_master_postgresql: https://github.com/Kotti/Kotti/actions?query=workflow%3APostgreSQL+branch%3Amaster

Expand Down
12 changes: 6 additions & 6 deletions kotti/sanitizers.py
Expand Up @@ -5,12 +5,12 @@
from typing import Union

from bleach import clean
from bleach_whitelist.bleach_whitelist import all_styles
from bleach_whitelist.bleach_whitelist import generally_xss_safe
from bleach_whitelist.bleach_whitelist import markdown_attrs
from bleach_whitelist.bleach_whitelist import markdown_tags
from bleach_whitelist.bleach_whitelist import print_attrs
from bleach_whitelist.bleach_whitelist import print_tags
from bleach_allowlist import all_styles
from bleach_allowlist import generally_xss_safe
from bleach_allowlist import markdown_attrs
from bleach_allowlist import markdown_tags
from bleach_allowlist import print_attrs
from bleach_allowlist import print_tags
from pyramid.config import Configurator
from pyramid.util import DottedNameResolver

Expand Down
51 changes: 25 additions & 26 deletions kotti/tests/__init__.py
Expand Up @@ -77,7 +77,7 @@ def allwarnings(request):

@fixture(scope="session")
def custom_settings():
""" This is a dummy fixture meant to be overriden in add on package's
"""This is a dummy fixture meant to be overriden in add on package's
``conftest.py``. It can be used to inject arbitrary settings for third
party test suites. The default settings dictionary will be updated
with the dictionary returned by this fixture.
Expand Down Expand Up @@ -116,8 +116,8 @@ def settings(unresolved_settings):

@yield_fixture
def config(settings):
""" returns a Pyramid `Configurator` object initialized
with Kotti's default (test) settings.
"""returns a Pyramid `Configurator` object initialized
with Kotti's default (test) settings.
"""
from pyramid import testing
from kotti import security
Expand All @@ -132,7 +132,7 @@ def config(settings):

@fixture(scope="session")
def connection(custom_settings):
""" sets up a SQLAlchemy engine and returns a connection to the database.
"""sets up a SQLAlchemy engine and returns a connection to the database.
The connection string used for testing can be specified via the
``KOTTI_TEST_DB_STRING`` environment variable. The ``custom_settings``
fixture is needed to allow users to import their models easily instead of
Expand All @@ -159,8 +159,7 @@ def connection(custom_settings):

@fixture
def content(connection, settings):
""" sets up some default content using Kotti's testing populator.
"""
"""sets up some default content using Kotti's testing populator."""
import transaction
from kotti import DBSession
from kotti import metadata
Expand Down Expand Up @@ -193,8 +192,8 @@ def content(connection, settings):

@yield_fixture
def db_session(config, content, connection):
""" returns a db session object and sets up a db transaction
savepoint, which will be rolled back after the test.
"""returns a db session object and sets up a db transaction
savepoint, which will be rolled back after the test.
"""

import transaction
Expand All @@ -209,9 +208,9 @@ def db_session(config, content, connection):

@fixture
def dummy_request(config, request, monkeypatch):
""" returns a dummy request object after registering it as
the currently active request. This is needed when
`pyramid.threadlocal.get_current_request` is used.
"""returns a dummy request object after registering it as
the currently active request. This is needed when
`pyramid.threadlocal.get_current_request` is used.
"""

from kotti.testing import DummyRequest
Expand All @@ -236,8 +235,7 @@ def dummy_mailer(monkeypatch):

@yield_fixture
def events(config):
""" sets up Kotti's default event handlers.
"""
"""sets up Kotti's default event handlers."""
from kotti.events import clear

config.include("kotti.events")
Expand All @@ -260,9 +258,9 @@ def app(workflow, db_session, dummy_mailer, events, setup_app):

@fixture
def browser(db_session, request, setup_app):
""" returns an instance of `zope.testbrowser`. The `kotti.testing.user`
pytest marker (or `pytest.mark.user`) can be used to pre-authenticate
the browser with the given login name: `@user('admin')`.
"""returns an instance of `zope.testbrowser`. The `kotti.testing.user`
pytest marker (or `pytest.mark.user`) can be used to pre-authenticate
the browser with the given login name: `@user('admin')`.
"""
from zope.testbrowser.wsgi import Browser
from kotti.testing import BASE_URL
Expand All @@ -288,8 +286,7 @@ def browser(db_session, request, setup_app):

@fixture
def root(db_session):
""" returns Kotti's 'root' node.
"""
"""returns Kotti's 'root' node."""
from kotti.resources import get_root

return get_root()
Expand All @@ -312,15 +309,18 @@ def webtest(app, monkeypatch, request, filedepot, dummy_mailer):

@fixture
def workflow(config):
""" loads and activates Kotti's default workflow rules.
"""
"""loads and activates Kotti's default workflow rules."""
from zope.configuration import xmlconfig
import kotti

xmlconfig.file("workflow.zcml", kotti, execute=True)


class TestStorage(MemoryFileStorage):
def __bool__(self):
# required for test mocking
return True

def get(self, file_or_id):
f = super().get(file_or_id)
f.last_modified = datetime(2012, 12, 30)
Expand All @@ -329,8 +329,8 @@ def get(self, file_or_id):

@yield_fixture
def depot_tween(config, dummy_request):
""" Sets up the Depot tween and patches Depot's ``set_middleware`` to
suppress exceptions on subsequent calls. Yields the ``DepotManager``. """
"""Sets up the Depot tween and patches Depot's ``set_middleware`` to
suppress exceptions on subsequent calls. Yields the ``DepotManager``."""

from depot.manager import DepotManager
from kotti.filedepot import TweenFactory
Expand All @@ -357,7 +357,7 @@ def set_middleware_patched(cls, mw):

@yield_fixture
def mock_filedepot(depot_tween):
""" Configures a mock depot store for :class:`depot.manager.DepotManager`
"""Configures a mock depot store for :class:`depot.manager.DepotManager`
This filedepot is not integrated with dbsession.
Can be used in simple, standalone unit tests.
Expand All @@ -374,7 +374,7 @@ def mock_filedepot(depot_tween):

@yield_fixture
def filedepot(db_session, depot_tween):
""" Configures a dbsession integrated mock depot store for
"""Configures a dbsession integrated mock depot store for
:class:`depot.manager.DepotManager`
"""
from depot.manager import DepotManager
Expand All @@ -390,8 +390,7 @@ def filedepot(db_session, depot_tween):

@yield_fixture
def no_filedepots(db_session, depot_tween):
""" A filedepot fixture to empty and then restore DepotManager configuration
"""
"""A filedepot fixture to empty and then restore DepotManager configuration"""
from depot.manager import DepotManager

DepotManager._depots = {}
Expand Down
6 changes: 3 additions & 3 deletions kotti/tests/test_sanitizers.py
Expand Up @@ -29,9 +29,9 @@ def test_no_html():

def _verify_minimal_html(sanitized):

from bleach_whitelist.bleach_whitelist import all_tags
from bleach_whitelist.bleach_whitelist import markdown_tags
from bleach_whitelist.bleach_whitelist import print_tags
from bleach_allowlist import all_tags
from bleach_allowlist import markdown_tags
from bleach_allowlist import print_tags

for tag in set(all_tags) - set(markdown_tags) - set(print_tags):
assert f"<{tag}" not in sanitized
Expand Down
45 changes: 23 additions & 22 deletions requirements.txt
@@ -1,23 +1,24 @@
alembic==1.4.2
alembic==1.4.3
anyascii==0.1.7
appdirs==1.4.4
Babel==2.8.0
Babel==2.9.0
Beaker==1.11.0
bleach==3.1.5
bleach-whitelist==0.0.10
Chameleon==3.7.4
bleach==3.2.1
bleach-allowlist==1.0.3
Chameleon==3.8.1
click==7.1.2
colander==1.7.0
deform==2.0.8
colander==1.8.2
deform==2.0.14
docopt==0.6.2
fanstatic==1.1
filedepot==0.7.1
FormEncode==2.0.0a1
filedepot==0.8.0
FormEncode==2.0.0
html2text==2020.1.16
hupper==1.10.2
iso8601==0.1.11
iso8601==0.1.13
js.angular==1.1.4
js.bootstrap==3.3.4
js.deform==2.0.3
js.deform==2.0.14
js.fineuploader==5.14.0
js.html5shiv==3.7.3
js.jquery==1.9.1
Expand All @@ -36,14 +37,14 @@ lingua==4.14
Mako==1.1.3
MarkupSafe==1.1.1
packaging==20.4
PasteDeploy==2.1.0
PasteDeploy==2.1.1
peppercorn==0.6
plaster==1.0
plaster-pastedeploy==0.7
polib==1.1.0
py-bcrypt==0.4
pyparsing==2.4.7
pyramid==1.10.4
pyramid==1.10.5
pyramid-beaker==0.8
pyramid-chameleon==0.3
pyramid-deform==0.2
Expand All @@ -52,31 +53,31 @@ pyramid-tm==2.4
pyramid-zcml==1.2.0
python-dateutil==2.8.1
python-editor==1.0.4
pytz==2020.1
pytz==2020.4
repoze.lru==0.7
repoze.sendmail==4.4.1
repoze.workflow==1.0b1
repoze.zcml==1.0b1
repoze.workflow==1.1
repoze.zcml==1.1
shutilwhich==1.1.0
six==1.15.0
SQLAlchemy==1.3.17
SQLAlchemy-Utils==0.36.6
SQLAlchemy==1.3.20
SQLAlchemy-Utils==0.36.8
transaction==3.0.0
translationstring==1.3
translationstring==1.4
Unidecode==1.1.1
usersettings==1.0.7
venusian==3.0.0
waitress==1.4.4
webencodings==0.5.1
WebOb==1.8.6
zope.component==4.6.1
zope.component==4.6.2
zope.configuration==4.4.0
zope.deferredimport==4.3.1
zope.deprecation==4.4.0
zope.event==4.4
zope.event==4.5.0
zope.hookable==5.0.1
zope.i18nmessageid==5.0.1
zope.interface==5.1.0
zope.interface==5.2.0
zope.proxy==4.3.5
zope.schema==6.0.0
zope.sqlalchemy==1.3
10 changes: 6 additions & 4 deletions setup.py
Expand Up @@ -4,7 +4,7 @@
from setuptools import find_packages
from setuptools import setup

version = '2.0.3'
version = '2.0.4'
description = "A high-level, Pythonic web application framework based on " \
"Pyramid and SQLAlchemy. It includes an extensible Content " \
"Management System called the Kotti CMS."
Expand All @@ -20,15 +20,15 @@
'Chameleon>=2.7.4', # Fixes error when raising HTTPFound
'alembic>=0.8.0',
'bleach>=3.1.4',
'bleach-whitelist',
'bleach-allowlist',
'colander>=1.3.2',
'deform>=2.0.5', # fixes file upload on py3 - uncomment after 2.0.5 is released # noqa
'docopt',
'fanstatic>=1.0.0',
'filedepot',
'formencode>=2.0.0a',
'html2text',
'iso8601==0.1.11', # rq.filter: !=0.1.12
'iso8601>=0.1.13',
'js.angular',
'js.bootstrap>=3.0.0',
'js.deform>=2.0.3',
Expand Down Expand Up @@ -118,7 +118,9 @@ def read(*parts):
long_description='\n\n'.join([read('README.rst'),
read('AUTHORS.txt'),
read('CHANGES.txt'), ]),
classifiers=[
long_description_content_type="text/x-rst",

classifiers=[
'Development Status :: 5 - Production/Stable',
'Environment :: Web Environment',
'Framework :: Pylons',
Expand Down

0 comments on commit 886bc56

Please sign in to comment.