Skip to content

Commit

Permalink
Merge branch 'master' into lint
Browse files Browse the repository at this point in the history
  • Loading branch information
Michael Howitz committed Oct 12, 2020
2 parents 87b851e + 20331fe commit e799064
Show file tree
Hide file tree
Showing 6 changed files with 56 additions and 5 deletions.
2 changes: 2 additions & 0 deletions CHANGES.rst
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ Changes
4.3.0 (unreleased)
------------------

- Port ``.browser`` sub-package to Python 3.

- Drop support for running the tests using ``python setup.py test``.

- Drop support for Python 3.4 and 3.5.
Expand Down
10 changes: 8 additions & 2 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,13 +32,19 @@ def read(*path):
read('CHANGES.rst')
])

tests_require = [
testing_require = [
'zope.testing >= 3.8',
'zope.testrunner',
'zope.configuration',
'BTrees',
]

tests_require = testing_require + [
# 'zope.annotation',
'zope.publisher',
]


setup(
name="zope.dublincore",
version='4.3.0.dev0',
Expand Down Expand Up @@ -84,7 +90,7 @@ def read(*path):
'zope.security[zcml]>=3.8',
],
extras_require={
'testing': tests_require,
'testing': testing_require,
'test': tests_require,
'docs': ['Sphinx', 'repoze.sphinx.autointerface'],
},
Expand Down
7 changes: 5 additions & 2 deletions src/zope/dublincore/browser/metadataedit.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,9 @@
unicode = str # PY3


text_type = type(u'') #PY3


class MetaDataEdit(object):
"""Provide view for editing basic dublin-core meta-data."""

Expand All @@ -38,8 +41,8 @@ def edit(self):
message = ''

if 'dctitle' in request:
dc.title = unicode(request['dctitle'])
dc.description = unicode(request['dcdescription'])
dc.title = text_type(request['dctitle'])
dc.description = text_type(request['dcdescription'])
description = Attributes(IZopeDublinCore, 'title', 'description')
notify(ObjectModifiedEvent(self.context, description))
message = _(
Expand Down
Empty file.
41 changes: 41 additions & 0 deletions src/zope/dublincore/browser/tests/test_metadataedit.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
from zope.component.testing import PlacelessSetup
from zope.dublincore.browser.metadataedit import MetaDataEdit
from zope.publisher.browser import TestRequest
import unittest
import zope.annotation.interfaces
import zope.dublincore.testing


@zope.interface.implementer(zope.annotation.interfaces.IAnnotations)
class DummyContext(dict):
"""A dummy class which can store annotations."""


class MetaDataEditTests(PlacelessSetup, unittest.TestCase):
"""Testing ..metadataedit.MetaDataEdit."""

def setUp(self):
super(MetaDataEditTests, self).setUp()
zope.dublincore.testing.setUpDublinCore()

def test_metadataedit__MetaDataEdit__edit__1(self):
"""It stores DC request values on the context."""
view = MetaDataEdit()
request = TestRequest(
form={'dctitle': 'Test', 'dcdescription': 'Testing'})
view.context = DummyContext()
view.request = request
result = view.edit()
self.assertEqual({
'message': 'Changed data ${datetime}',
'dctitle': 'Test',
'dcdescription': 'Testing',
'modified': '',
'created': '',
'creators': ()
}, result)

self.assertEqual({
'zope.app.dublincore.ZopeDublinCore': {
'Title': ('Test',),
'Description': ('Testing',)}}, view.context)
1 change: 0 additions & 1 deletion tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,6 @@ commands =
coverage run -a -m sphinx -b doctest -d {envdir}/.cache/doctrees docs {envdir}/.cache/doctest
coverage report
deps =
{[testenv]deps}
coverage


Expand Down

0 comments on commit e799064

Please sign in to comment.