[Checkins] SVN: zope.dublincore/tags/3.5.0/ Tag 3.5.0
Dan Korostelev
nadako at gmail.com
Tue Sep 15 06:34:04 EDT 2009
Log message for revision 104032:
Tag 3.5.0
Changed:
A zope.dublincore/tags/3.5.0/
D zope.dublincore/tags/3.5.0/CHANGES.txt
A zope.dublincore/tags/3.5.0/CHANGES.txt
D zope.dublincore/tags/3.5.0/buildout.cfg
A zope.dublincore/tags/3.5.0/buildout.cfg
D zope.dublincore/tags/3.5.0/setup.py
A zope.dublincore/tags/3.5.0/setup.py
D zope.dublincore/tags/3.5.0/src/zope/dublincore/browser/configure.zcml
A zope.dublincore/tags/3.5.0/src/zope/dublincore/browser/configure.zcml
D zope.dublincore/tags/3.5.0/src/zope/dublincore/configure.zcml
A zope.dublincore/tags/3.5.0/src/zope/dublincore/configure.zcml
D zope.dublincore/tags/3.5.0/src/zope/dublincore/property.py
A zope.dublincore/tags/3.5.0/src/zope/dublincore/property.py
D zope.dublincore/tags/3.5.0/src/zope/dublincore/tests/test_annotatableadapter.py
A zope.dublincore/tags/3.5.0/src/zope/dublincore/tests/test_annotatableadapter.py
D zope.dublincore/tags/3.5.0/src/zope/dublincore/tests/test_creatorannotator.py
A zope.dublincore/tags/3.5.0/src/zope/dublincore/tests/test_creatorannotator.py
D zope.dublincore/tags/3.5.0/src/zope/dublincore/tests/test_property.py
A zope.dublincore/tags/3.5.0/src/zope/dublincore/tests/test_property.py
-=-
Deleted: zope.dublincore/tags/3.5.0/CHANGES.txt
===================================================================
--- zope.dublincore/trunk/CHANGES.txt 2009-09-15 09:54:27 UTC (rev 104025)
+++ zope.dublincore/tags/3.5.0/CHANGES.txt 2009-09-15 10:34:03 UTC (rev 104032)
@@ -1,32 +0,0 @@
-Changes
-=======
-
-3.4.3 (unreleased)
-------------------
-
-- Removed use of zope.app.component in testing.
-
-- Include browser configuration only if zope.app.publisher is installed.
-
-3.4.2 (2009-01-31)
-------------------
-
-- Declare dependency on zope.datetime.
-
-3.4.1 (2009-01-26)
-------------------
-
-- Test dependencies are declared in a `test` extra now.
-
-- Fix: Make CreatorAnnotator not to fail if participation principal is None
-
-3.4.0 (2007-09-28)
-------------------
-
-No further changes since 3.4.0a1.
-
-3.4.0a1 (2007-04-22)
---------------------
-
-Initial release as a separate project, corresponds to zope.dublincore
-from Zope 3.4.0a1
Copied: zope.dublincore/tags/3.5.0/CHANGES.txt (from rev 104029, zope.dublincore/trunk/CHANGES.txt)
===================================================================
--- zope.dublincore/tags/3.5.0/CHANGES.txt (rev 0)
+++ zope.dublincore/tags/3.5.0/CHANGES.txt 2009-09-15 10:34:03 UTC (rev 104032)
@@ -0,0 +1,40 @@
+Changes
+=======
+
+3.5.0 (2009-09-15)
+------------------
+
+- Add missing dependencies.
+
+- Get rid of any testing dependencies beyond zope.testing.
+
+- Include browser ZCML configuration only if zope.browserpage is installed.
+
+- Specify i18n domain in package's ``configure.zcml``, because we use message
+ IDs for permission titles.
+
+- Remove unused imports, fix one test that was inactive because of being
+ overriden by another one by a mistake.
+
+3.4.2 (2009-01-31)
+------------------
+
+- Declare dependency on zope.datetime.
+
+3.4.1 (2009-01-26)
+------------------
+
+- Test dependencies are declared in a `test` extra now.
+
+- Fix: Make CreatorAnnotator not to fail if participation principal is None
+
+3.4.0 (2007-09-28)
+------------------
+
+No further changes since 3.4.0a1.
+
+3.4.0a1 (2007-04-22)
+--------------------
+
+Initial release as a separate project, corresponds to zope.dublincore
+from Zope 3.4.0a1
Deleted: zope.dublincore/tags/3.5.0/buildout.cfg
===================================================================
--- zope.dublincore/trunk/buildout.cfg 2009-09-15 09:54:27 UTC (rev 104025)
+++ zope.dublincore/tags/3.5.0/buildout.cfg 2009-09-15 10:34:03 UTC (rev 104032)
@@ -1,7 +0,0 @@
-[buildout]
-develop = .
-parts = test
-
-[test]
-recipe = zc.recipe.testrunner
-eggs = zope.dublincore [test]
Copied: zope.dublincore/tags/3.5.0/buildout.cfg (from rev 104029, zope.dublincore/trunk/buildout.cfg)
===================================================================
--- zope.dublincore/tags/3.5.0/buildout.cfg (rev 0)
+++ zope.dublincore/tags/3.5.0/buildout.cfg 2009-09-15 10:34:03 UTC (rev 104032)
@@ -0,0 +1,11 @@
+[buildout]
+develop = .
+parts = test pydev
+
+[test]
+recipe = zc.recipe.testrunner
+eggs = zope.dublincore [test]
+
+[pydev]
+recipe = pb.recipes.pydev
+eggs = zope.dublincore
Deleted: zope.dublincore/tags/3.5.0/setup.py
===================================================================
--- zope.dublincore/trunk/setup.py 2009-09-15 09:54:27 UTC (rev 104025)
+++ zope.dublincore/tags/3.5.0/setup.py 2009-09-15 10:34:03 UTC (rev 104032)
@@ -1,57 +0,0 @@
-##############################################################################
-#
-# Copyright (c) 2007 Zope Corporation and Contributors.
-# All Rights Reserved.
-#
-# This software is subject to the provisions of the Zope Public License,
-# Version 2.1 (ZPL). A copy of the ZPL should accompany this distribution.
-# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
-# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
-# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
-# FOR A PARTICULAR PURPOSE.
-#
-##############################################################################
-# This package is developed by the Zope Toolkit project, documented here:
-# http://docs.zope.org/zopetoolkit
-# When developing and releasing this package, please follow the documented
-# Zope Toolkit policies as described by this documentation.
-##############################################################################
-"""Setup for zope.dublincore package
-
-$Id$
-"""
-from setuptools import setup, find_packages
-
-long_description = (open('README.txt').read() +
- '\n\n' +
- open('CHANGES.txt').read())
-
-setup(
- name="zope.dublincore",
- version = '3.4.3dev',
- url='http://pypi.python.org/pypi/zope.dublincore',
- license='ZPL 2.1',
- description='Zope Dublin Core implementation',
- long_description=long_description,
- author='Zope Corporation and Contributors',
- author_email='zope-dev at zope.org',
-
- packages=find_packages('src'),
- package_dir={'':'src'},
- namespace_packages=['zope'],
- include_package_data=True,
- extras_require=dict(
- test=[
- 'zope.testing',
- 'zope.security',
- 'zope.app.testing',
- ]
- ),
- install_requires = ['setuptools',
- 'zope.annotation',
- 'zope.component',
- 'zope.datetime',
- 'zope.interface',
- ],
- zip_safe = False
- )
Copied: zope.dublincore/tags/3.5.0/setup.py (from rev 104029, zope.dublincore/trunk/setup.py)
===================================================================
--- zope.dublincore/tags/3.5.0/setup.py (rev 0)
+++ zope.dublincore/tags/3.5.0/setup.py 2009-09-15 10:34:03 UTC (rev 104032)
@@ -0,0 +1,57 @@
+##############################################################################
+#
+# Copyright (c) 2007 Zope Corporation and Contributors.
+# All Rights Reserved.
+#
+# This software is subject to the provisions of the Zope Public License,
+# Version 2.1 (ZPL). A copy of the ZPL should accompany this distribution.
+# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
+# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
+# FOR A PARTICULAR PURPOSE.
+#
+##############################################################################
+# This package is developed by the Zope Toolkit project, documented here:
+# http://docs.zope.org/zopetoolkit
+# When developing and releasing this package, please follow the documented
+# Zope Toolkit policies as described by this documentation.
+##############################################################################
+"""Setup for zope.dublincore package
+
+$Id$
+"""
+from setuptools import setup, find_packages
+
+long_description = (open('README.txt').read() +
+ '\n\n' +
+ open('CHANGES.txt').read())
+
+setup(
+ name="zope.dublincore",
+ version = '3.5.0',
+ url='http://pypi.python.org/pypi/zope.dublincore',
+ license='ZPL 2.1',
+ description='Zope Dublin Core implementation',
+ long_description=long_description,
+ author='Zope Corporation and Contributors',
+ author_email='zope-dev at zope.org',
+
+ packages=find_packages('src'),
+ package_dir={'':'src'},
+ namespace_packages=['zope'],
+ include_package_data=True,
+ extras_require=dict(
+ test=['zope.testing',]
+ ),
+ install_requires = ['setuptools',
+ 'pytz',
+ 'zope.annotation',
+ 'zope.component',
+ 'zope.datetime',
+ 'zope.interface',
+ 'zope.location',
+ 'zope.schema',
+ 'zope.security',
+ ],
+ zip_safe = False
+ )
Deleted: zope.dublincore/tags/3.5.0/src/zope/dublincore/browser/configure.zcml
===================================================================
--- zope.dublincore/trunk/src/zope/dublincore/browser/configure.zcml 2009-09-15 09:54:27 UTC (rev 104025)
+++ zope.dublincore/tags/3.5.0/src/zope/dublincore/browser/configure.zcml 2009-09-15 10:34:03 UTC (rev 104032)
@@ -1,29 +0,0 @@
-<configure
- xmlns="http://namespaces.zope.org/zope"
- xmlns:browser="http://namespaces.zope.org/browser"
- xmlns:zcml="http://namespaces.zope.org/zcml"
- zcml:condition="installed zope.app.publisher"
- i18n_domain="zope"
- >
-
- <browser:pages
- for="zope.annotation.interfaces.IAnnotatable"
- permission="zope.app.dublincore.change"
- class=".metadataedit.MetaDataEdit"
- >
-
- <browser:page
- name="EditMetaData.html"
- template="edit.pt"
- menu="zmi_views"
- title="Metadata"
- />
-
- <browser:page
- name="MetaDataBox"
- template="box.pt"
- />
-
- </browser:pages>
-
-</configure>
Copied: zope.dublincore/tags/3.5.0/src/zope/dublincore/browser/configure.zcml (from rev 104029, zope.dublincore/trunk/src/zope/dublincore/browser/configure.zcml)
===================================================================
--- zope.dublincore/tags/3.5.0/src/zope/dublincore/browser/configure.zcml (rev 0)
+++ zope.dublincore/tags/3.5.0/src/zope/dublincore/browser/configure.zcml 2009-09-15 10:34:03 UTC (rev 104032)
@@ -0,0 +1,29 @@
+<configure
+ xmlns="http://namespaces.zope.org/zope"
+ xmlns:browser="http://namespaces.zope.org/browser"
+ xmlns:zcml="http://namespaces.zope.org/zcml"
+ zcml:condition="installed zope.browserpage"
+ i18n_domain="zope"
+ >
+
+ <browser:pages
+ for="zope.annotation.interfaces.IAnnotatable"
+ permission="zope.app.dublincore.change"
+ class=".metadataedit.MetaDataEdit"
+ >
+
+ <browser:page
+ name="EditMetaData.html"
+ template="edit.pt"
+ menu="zmi_views"
+ title="Metadata"
+ />
+
+ <browser:page
+ name="MetaDataBox"
+ template="box.pt"
+ />
+
+ </browser:pages>
+
+</configure>
Deleted: zope.dublincore/tags/3.5.0/src/zope/dublincore/configure.zcml
===================================================================
--- zope.dublincore/trunk/src/zope/dublincore/configure.zcml 2009-09-15 09:54:27 UTC (rev 104025)
+++ zope.dublincore/tags/3.5.0/src/zope/dublincore/configure.zcml 2009-09-15 10:34:03 UTC (rev 104032)
@@ -1,48 +0,0 @@
-<configure xmlns="http://namespaces.zope.org/zope">
-
- <permission
- id="zope.app.dublincore.view"
- title="[zope.app.dublincore.view-permission]
- View Dublin-Core Meta Data "
- />
-
- <permission
- id="zope.app.dublincore.change"
- title="[zope.app.dublincore.change-permission]
- Change Dublin-Core Meta Data "
- />
-
- <include file="security.zcml" />
-
- <adapter
- factory=".annotatableadapter.ZDCAnnotatableAdapter"
- provides="zope.dublincore.interfaces.IWriteZopeDublinCore"
- trusted="true"
- />
-
- <subscriber
- handler=".timeannotators.ModifiedAnnotator"
- for="zope.lifecycleevent.interfaces.IObjectModifiedEvent"
- />
-
- <subscriber
- handler=".timeannotators.CreatedAnnotator"
- for="zope.lifecycleevent.interfaces.IObjectCreatedEvent"
- />
-
- <subscriber
- handler=".creatorannotator.CreatorAnnotator"
- for="zope.lifecycleevent.interfaces.IObjectModifiedEvent"
- />
-
- <subscriber
- handler=".creatorannotator.CreatorAnnotator"
- for="zope.lifecycleevent.interfaces.IObjectCreatedEvent"
- />
-
-
- <!-- Include browser package -->
-
- <include package=".browser" />
-
-</configure>
Copied: zope.dublincore/tags/3.5.0/src/zope/dublincore/configure.zcml (from rev 104029, zope.dublincore/trunk/src/zope/dublincore/configure.zcml)
===================================================================
--- zope.dublincore/tags/3.5.0/src/zope/dublincore/configure.zcml (rev 0)
+++ zope.dublincore/tags/3.5.0/src/zope/dublincore/configure.zcml 2009-09-15 10:34:03 UTC (rev 104032)
@@ -0,0 +1,51 @@
+<configure
+ xmlns="http://namespaces.zope.org/zope"
+ i18n_domain="zope"
+ >
+
+ <permission
+ id="zope.app.dublincore.view"
+ title="[zope.app.dublincore.view-permission]
+ View Dublin-Core Meta Data "
+ />
+
+ <permission
+ id="zope.app.dublincore.change"
+ title="[zope.app.dublincore.change-permission]
+ Change Dublin-Core Meta Data "
+ />
+
+ <include file="security.zcml" />
+
+ <adapter
+ factory=".annotatableadapter.ZDCAnnotatableAdapter"
+ provides="zope.dublincore.interfaces.IWriteZopeDublinCore"
+ trusted="true"
+ />
+
+ <subscriber
+ handler=".timeannotators.ModifiedAnnotator"
+ for="zope.lifecycleevent.interfaces.IObjectModifiedEvent"
+ />
+
+ <subscriber
+ handler=".timeannotators.CreatedAnnotator"
+ for="zope.lifecycleevent.interfaces.IObjectCreatedEvent"
+ />
+
+ <subscriber
+ handler=".creatorannotator.CreatorAnnotator"
+ for="zope.lifecycleevent.interfaces.IObjectModifiedEvent"
+ />
+
+ <subscriber
+ handler=".creatorannotator.CreatorAnnotator"
+ for="zope.lifecycleevent.interfaces.IObjectCreatedEvent"
+ />
+
+
+ <!-- Include browser package -->
+
+ <include package=".browser" />
+
+</configure>
Deleted: zope.dublincore/tags/3.5.0/src/zope/dublincore/property.py
===================================================================
--- zope.dublincore/trunk/src/zope/dublincore/property.py 2009-09-15 09:54:27 UTC (rev 104025)
+++ zope.dublincore/tags/3.5.0/src/zope/dublincore/property.py 2009-09-15 10:34:03 UTC (rev 104032)
@@ -1,109 +0,0 @@
-##############################################################################
-#
-# Copyright (c) 2005 Zope Foundation and Contributors.
-# All Rights Reserved.
-#
-# This software is subject to the provisions of the Zope Public License,
-# Version 2.1 (ZPL). A copy of the ZPL should accompany this distribution.
-# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
-# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
-# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
-# FOR A PARTICULAR PURPOSE.
-#
-##############################################################################
-"""
-$Id: $
-"""
-__docformat__ = 'restructuredtext'
-
-import re,os
-
-from zope import schema
-from zope import interface
-
-from zope.dublincore.interfaces import IZopeDublinCore
-from zope.dublincore.zopedublincore import SequenceProperty
-
-_marker = object()
-
-
-class DCProperty(object):
- """Adapt to a dublin core property
-
- Handles DC list properties as scalar property.
- """
-
- def __init__(self, name):
- self.__name = name
-
- def __get__(self, inst, klass):
- if inst is None:
- return self
- name = self.__name
- inst = IZopeDublinCore(inst)
- value = getattr(inst, name, _marker)
- if value is _marker:
- field = IZopeDublinCore[name].bind(inst)
- value = getattr(field, 'default', _marker)
- if value is _marker:
- raise AttributeError(name)
- if isinstance(value, (list, tuple)):
- value = value[0]
- return value
-
- def __set__(self, inst, value):
- name = self.__name
- inst = IZopeDublinCore(inst)
- field = IZopeDublinCore[name].bind(inst)
- if isinstance(field, schema.List):
- if isinstance(value, tuple):
- value = list(value)
- else:
- value = [value]
- elif isinstance(field, schema.Tuple):
- if isinstance(value, list):
- value = tuple(value)
- else:
- value = (value,)
- field.validate(value)
- if field.readonly and inst.__dict__.has_key(name):
- raise ValueError(name, 'field is readonly')
- setattr(inst, name, value)
-
- def __getattr__(self, name):
- return getattr(IZopeDublinCore[self.__name], name)
-
-
-class DCListProperty(DCProperty):
- """Adapt to a dublin core list property
-
- Returns the DC property unchanged.
- """
-
- def __init__(self, name):
- self.__name = name
-
- def __get__(self, inst, klass):
- if inst is None:
- return self
- name = self.__name
- inst = IZopeDublinCore(inst)
- value = getattr(inst, name, _marker)
- if value is _marker:
- field = IZopeDublinCore[name].bind(inst)
- value = getattr(field, 'default', _marker)
- if value is _marker:
- raise AttributeError(name)
- return value
-
- def __set__(self, inst, value):
- name = self.__name
- inst = IZopeDublinCore(inst)
- field = IZopeDublinCore[name].bind(inst)
- if isinstance(field, schema.Tuple):
- value = tuple(value)
- field.validate(value)
- if field.readonly and inst.__dict__.has_key(name):
- raise ValueError(name, 'field is readonly')
- setattr(inst, name, value)
-
Copied: zope.dublincore/tags/3.5.0/src/zope/dublincore/property.py (from rev 104029, zope.dublincore/trunk/src/zope/dublincore/property.py)
===================================================================
--- zope.dublincore/tags/3.5.0/src/zope/dublincore/property.py (rev 0)
+++ zope.dublincore/tags/3.5.0/src/zope/dublincore/property.py 2009-09-15 10:34:03 UTC (rev 104032)
@@ -0,0 +1,105 @@
+##############################################################################
+#
+# Copyright (c) 2005 Zope Foundation and Contributors.
+# All Rights Reserved.
+#
+# This software is subject to the provisions of the Zope Public License,
+# Version 2.1 (ZPL). A copy of the ZPL should accompany this distribution.
+# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
+# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
+# FOR A PARTICULAR PURPOSE.
+#
+##############################################################################
+"""
+$Id$
+"""
+__docformat__ = 'restructuredtext'
+from zope import schema
+
+from zope.dublincore.interfaces import IZopeDublinCore
+from zope.dublincore.zopedublincore import SequenceProperty
+
+_marker = object()
+
+
+class DCProperty(object):
+ """Adapt to a dublin core property
+
+ Handles DC list properties as scalar property.
+ """
+
+ def __init__(self, name):
+ self.__name = name
+
+ def __get__(self, inst, klass):
+ if inst is None:
+ return self
+ name = self.__name
+ inst = IZopeDublinCore(inst)
+ value = getattr(inst, name, _marker)
+ if value is _marker:
+ field = IZopeDublinCore[name].bind(inst)
+ value = getattr(field, 'default', _marker)
+ if value is _marker:
+ raise AttributeError(name)
+ if isinstance(value, (list, tuple)):
+ value = value[0]
+ return value
+
+ def __set__(self, inst, value):
+ name = self.__name
+ inst = IZopeDublinCore(inst)
+ field = IZopeDublinCore[name].bind(inst)
+ if isinstance(field, schema.List):
+ if isinstance(value, tuple):
+ value = list(value)
+ else:
+ value = [value]
+ elif isinstance(field, schema.Tuple):
+ if isinstance(value, list):
+ value = tuple(value)
+ else:
+ value = (value,)
+ field.validate(value)
+ if field.readonly and inst.__dict__.has_key(name):
+ raise ValueError(name, 'field is readonly')
+ setattr(inst, name, value)
+
+ def __getattr__(self, name):
+ return getattr(IZopeDublinCore[self.__name], name)
+
+
+class DCListProperty(DCProperty):
+ """Adapt to a dublin core list property
+
+ Returns the DC property unchanged.
+ """
+
+ def __init__(self, name):
+ self.__name = name
+
+ def __get__(self, inst, klass):
+ if inst is None:
+ return self
+ name = self.__name
+ inst = IZopeDublinCore(inst)
+ value = getattr(inst, name, _marker)
+ if value is _marker:
+ field = IZopeDublinCore[name].bind(inst)
+ value = getattr(field, 'default', _marker)
+ if value is _marker:
+ raise AttributeError(name)
+ return value
+
+ def __set__(self, inst, value):
+ name = self.__name
+ inst = IZopeDublinCore(inst)
+ field = IZopeDublinCore[name].bind(inst)
+ if isinstance(field, schema.Tuple):
+ value = tuple(value)
+ field.validate(value)
+ if field.readonly and inst.__dict__.has_key(name):
+ raise ValueError(name, 'field is readonly')
+ setattr(inst, name, value)
+
Deleted: zope.dublincore/tags/3.5.0/src/zope/dublincore/tests/test_annotatableadapter.py
===================================================================
--- zope.dublincore/trunk/src/zope/dublincore/tests/test_annotatableadapter.py 2009-09-15 09:54:27 UTC (rev 104025)
+++ zope.dublincore/tags/3.5.0/src/zope/dublincore/tests/test_annotatableadapter.py 2009-09-15 10:34:03 UTC (rev 104032)
@@ -1,230 +0,0 @@
-##############################################################################
-#
-# Copyright (c) 2009 Zope Corporation and Contributors.
-# All Rights Reserved.
-#
-# This software is subject to the provisions of the Zope Public License,
-# Version 2.1 (ZPL). A copy of the ZPL should accompany this distribution.
-# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
-# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
-# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
-# FOR A PARTICULAR PURPOSE.
-#
-##############################################################################
-"""Tests annotatableadapter.
-
-$Id: test_creatorannotator.py 101331 2009-06-29 20:58:01Z tseaver $
-"""
-import unittest
-
-_marker = object()
-
-class ZDCAnnotatableAdapterTests(unittest.TestCase):
-
- _registered = False
-
- def setUp(self):
- from zope.testing.cleanup import cleanUp
- cleanUp()
-
- def tearDown(self):
- from zope.testing.cleanup import cleanUp
- cleanUp()
-
- def _getTargetClass(self):
- from zope.dublincore.annotatableadapter import ZDCAnnotatableAdapter
- return ZDCAnnotatableAdapter
-
- def _registerAnnotations(self, dcdata=None):
- from zope.component import provideAdapter
- from zope.interface import Interface
- from zope.annotation.interfaces import IAnnotations
- from zope.dublincore.annotatableadapter import DCkey
- class _Annotations(dict):
- pass
- instance = _Annotations({DCkey: dcdata})
- def _factory(context):
- return instance
- if not self._registered:
- provideAdapter(_factory, (Interface, ), IAnnotations)
- self._registered = True
- return instance
-
- def _makeOne(self, context=_marker):
- if context is _marker:
- context = self._makeContext()
- return self._getTargetClass()(context)
-
- def _makeContext(self):
- class DummyContext(object):
- pass
- return DummyContext()
-
- def test_class_conforms_to_IWriteZopeDublinCore(self):
- from zope.interface.verify import verifyClass
- from zope.dublincore.interfaces import IWriteZopeDublinCore
- verifyClass(IWriteZopeDublinCore, self._getTargetClass())
-
- def test_instance_conforms_to_IWriteZopeDublinCore(self):
- from zope.interface.verify import verifyObject
- from zope.dublincore.interfaces import IWriteZopeDublinCore
- self._registerAnnotations()
- verifyObject(IWriteZopeDublinCore, self._makeOne())
-
- def test_ctor_wo_existing_DC_annotations(self):
- from zope.dublincore.annotatableadapter import DCkey
- self._registerAnnotations()
- context = self._makeContext()
- adapter = self._makeOne(context)
- self.assertEqual(adapter.annotations[DCkey], None)
- self.assertEqual(adapter._mapping, {})
-
- def test_ctor_w_existing_DC_annotations(self):
- from zope.dublincore.annotatableadapter import DCkey
- DCDATA = {'title': 'TITLE'}
- self._registerAnnotations(DCDATA)
- context = self._makeContext()
- adapter = self._makeOne(context)
- self.assertEqual(adapter.annotations, None)
- self.assertEqual(adapter._mapping, DCDATA)
-
- def test__changed_wo_existing_DC_annotations(self):
- from zope.dublincore.annotatableadapter import DCkey
- annotations = self._registerAnnotations()
- context = self._makeContext()
- adapter = self._makeOne(context)
- adapter._mapping['title'] = 'NEW TITLE'
- adapter._changed()
- self.assertEqual(annotations[DCkey]['title'], 'NEW TITLE')
-
- def test__changed_w_existing_DC_annotations(self):
- from zope.dublincore.annotatableadapter import DCkey
- DCDATA = {'title': 'TITLE'}
- annotations = self._registerAnnotations(DCDATA)
- context = self._makeContext()
- adapter = self._makeOne(context)
- adapter._changed()
- self.assertEqual(annotations[DCkey]['title'], 'TITLE') #unchanged
-
-class DirectPropertyTests(unittest.TestCase):
-
- def _getTargetClass(self):
- from zope.dublincore.annotatableadapter import DirectProperty
- return DirectProperty
-
- def _makeOne(self, name, attrname):
- return self._getTargetClass()(name, attrname)
-
- def test___get___via_klass(self):
- prop = self._makeOne('title', 'headline')
- class Testing(object):
- title = prop
- self.failUnless(Testing.title is prop)
-
- def test___get___via_instance(self):
- prop = self._makeOne('title', 'headline')
- class Context(object):
- headline = u'HEADLINE'
- class ZDCPartialAnnotatableAdapter(object):
- title = prop
- def __init__(self, context):
- self.__context = context
- context = Context()
- testing = ZDCPartialAnnotatableAdapter(context)
- self.assertEqual(testing.title, u'HEADLINE')
-
- def test___set___non_unicode_raises(self):
- prop = self._makeOne('title', 'headline')
- class Context(object):
- headline = u'HEADLINE'
- class ZDCPartialAnnotatableAdapter(object):
- title = prop
- def __init__(self, context):
- self.__context = context
- context = Context()
- testing = ZDCPartialAnnotatableAdapter(context)
- try:
- testing.title = 123
- except TypeError:
- pass
- else:
- self.fail("Didn't raise TypeError")
-
- def test___set___unchanged_doesnt_mutate(self):
- prop = self._makeOne('title', 'headline')
- class Context(object):
- headline = u'HEADLINE'
- def __setattr__(self, name, value):
- assert 0
- class ZDCPartialAnnotatableAdapter(object):
- title = prop
- def __init__(self, context):
- self.__context = context
- context = Context()
- testing = ZDCPartialAnnotatableAdapter(context)
- testing.title = u'HEADLINE' # doesn't raise
-
- def test___set___changed_mutates(self):
- prop = self._makeOne('title', 'headline')
- class Context(object):
- headline = u'HEADLINE1'
- class ZDCPartialAnnotatableAdapter(object):
- title = prop
- def __init__(self, context):
- self.__context = context
- context = Context()
- testing = ZDCPartialAnnotatableAdapter(context)
- testing.title = u'HEADLINE2'
- self.assertEqual(context.headline, u'HEADLINE2')
-
-class Test_partialAnnotatableAdapterFactory(unittest.TestCase):
-
- def _callFUT(self, direct_fields):
- from zope.dublincore.annotatableadapter \
- import partialAnnotatableAdapterFactory
- return partialAnnotatableAdapterFactory(direct_fields)
-
- def test_w_empty_list_raises(self):
- self.assertRaises(ValueError, self._callFUT, [])
-
- def test_w_empty_dict_raises(self):
- self.assertRaises(ValueError, self._callFUT, {})
-
- def test_w_unknown_field_raises(self):
- self.assertRaises(ValueError, self._callFUT, ['nonesuch'])
-
- def test_w_date_fields_raises(self):
- self.assertRaises(ValueError, self._callFUT, ['created'])
- self.assertRaises(ValueError, self._callFUT, ['modified'])
- self.assertRaises(ValueError, self._callFUT, ['effective'])
- self.assertRaises(ValueError, self._callFUT, ['expires'])
-
- def test_w_sequence_fields_raises(self):
- self.assertRaises(ValueError, self._callFUT, ['creators'])
- self.assertRaises(ValueError, self._callFUT, ['subjects'])
- self.assertRaises(ValueError, self._callFUT, ['contributors'])
-
- def test_w_scalar_prop_samename(self):
- from zope.dublincore.annotatableadapter import DirectProperty
- klass = self._callFUT(['title'])
- prop = klass.title
- self.failUnless(isinstance(prop, DirectProperty))
- self.assertEqual(prop.__name__, 'title')
- self.assertEqual(prop._DirectProperty__attrname, 'title') # XXX
-
- def test_w_scalar_prop_mapped(self):
- from zope.dublincore.annotatableadapter import DirectProperty
- klass = self._callFUT({'title': 'headline'})
- prop = klass.title
- self.failUnless(isinstance(prop, DirectProperty))
- self.assertEqual(prop.__name__, 'title')
- self.assertEqual(prop._DirectProperty__attrname, 'headline') # XXX
-
-
-def test_suite():
- return unittest.TestSuite((
- unittest.makeSuite(ZDCAnnotatableAdapterTests),
- unittest.makeSuite(DirectPropertyTests),
- unittest.makeSuite(Test_partialAnnotatableAdapterFactory),
- ))
-
Copied: zope.dublincore/tags/3.5.0/src/zope/dublincore/tests/test_annotatableadapter.py (from rev 104029, zope.dublincore/trunk/src/zope/dublincore/tests/test_annotatableadapter.py)
===================================================================
--- zope.dublincore/tags/3.5.0/src/zope/dublincore/tests/test_annotatableadapter.py (rev 0)
+++ zope.dublincore/tags/3.5.0/src/zope/dublincore/tests/test_annotatableadapter.py 2009-09-15 10:34:03 UTC (rev 104032)
@@ -0,0 +1,229 @@
+##############################################################################
+#
+# Copyright (c) 2009 Zope Corporation and Contributors.
+# All Rights Reserved.
+#
+# This software is subject to the provisions of the Zope Public License,
+# Version 2.1 (ZPL). A copy of the ZPL should accompany this distribution.
+# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
+# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
+# FOR A PARTICULAR PURPOSE.
+#
+##############################################################################
+"""Tests annotatableadapter.
+
+$Id: test_creatorannotator.py 101331 2009-06-29 20:58:01Z tseaver $
+"""
+import unittest
+
+_marker = object()
+
+class ZDCAnnotatableAdapterTests(unittest.TestCase):
+
+ _registered = False
+
+ def setUp(self):
+ from zope.testing.cleanup import cleanUp
+ cleanUp()
+
+ def tearDown(self):
+ from zope.testing.cleanup import cleanUp
+ cleanUp()
+
+ def _getTargetClass(self):
+ from zope.dublincore.annotatableadapter import ZDCAnnotatableAdapter
+ return ZDCAnnotatableAdapter
+
+ def _registerAnnotations(self, dcdata=None):
+ from zope.component import provideAdapter
+ from zope.interface import Interface
+ from zope.annotation.interfaces import IAnnotations
+ from zope.dublincore.annotatableadapter import DCkey
+ class _Annotations(dict):
+ pass
+ instance = _Annotations({DCkey: dcdata})
+ def _factory(context):
+ return instance
+ if not self._registered:
+ provideAdapter(_factory, (Interface, ), IAnnotations)
+ self._registered = True
+ return instance
+
+ def _makeOne(self, context=_marker):
+ if context is _marker:
+ context = self._makeContext()
+ return self._getTargetClass()(context)
+
+ def _makeContext(self):
+ class DummyContext(object):
+ pass
+ return DummyContext()
+
+ def test_class_conforms_to_IWriteZopeDublinCore(self):
+ from zope.interface.verify import verifyClass
+ from zope.dublincore.interfaces import IWriteZopeDublinCore
+ verifyClass(IWriteZopeDublinCore, self._getTargetClass())
+
+ def test_instance_conforms_to_IWriteZopeDublinCore(self):
+ from zope.interface.verify import verifyObject
+ from zope.dublincore.interfaces import IWriteZopeDublinCore
+ self._registerAnnotations()
+ verifyObject(IWriteZopeDublinCore, self._makeOne())
+
+ def test_ctor_wo_existing_DC_annotations(self):
+ from zope.dublincore.annotatableadapter import DCkey
+ self._registerAnnotations()
+ context = self._makeContext()
+ adapter = self._makeOne(context)
+ self.assertEqual(adapter.annotations[DCkey], None)
+ self.assertEqual(adapter._mapping, {})
+
+ def test_ctor_w_existing_DC_annotations(self):
+ DCDATA = {'title': 'TITLE'}
+ self._registerAnnotations(DCDATA)
+ context = self._makeContext()
+ adapter = self._makeOne(context)
+ self.assertEqual(adapter.annotations, None)
+ self.assertEqual(adapter._mapping, DCDATA)
+
+ def test__changed_wo_existing_DC_annotations(self):
+ from zope.dublincore.annotatableadapter import DCkey
+ annotations = self._registerAnnotations()
+ context = self._makeContext()
+ adapter = self._makeOne(context)
+ adapter._mapping['title'] = 'NEW TITLE'
+ adapter._changed()
+ self.assertEqual(annotations[DCkey]['title'], 'NEW TITLE')
+
+ def test__changed_w_existing_DC_annotations(self):
+ from zope.dublincore.annotatableadapter import DCkey
+ DCDATA = {'title': 'TITLE'}
+ annotations = self._registerAnnotations(DCDATA)
+ context = self._makeContext()
+ adapter = self._makeOne(context)
+ adapter._changed()
+ self.assertEqual(annotations[DCkey]['title'], 'TITLE') #unchanged
+
+class DirectPropertyTests(unittest.TestCase):
+
+ def _getTargetClass(self):
+ from zope.dublincore.annotatableadapter import DirectProperty
+ return DirectProperty
+
+ def _makeOne(self, name, attrname):
+ return self._getTargetClass()(name, attrname)
+
+ def test___get___via_klass(self):
+ prop = self._makeOne('title', 'headline')
+ class Testing(object):
+ title = prop
+ self.failUnless(Testing.title is prop)
+
+ def test___get___via_instance(self):
+ prop = self._makeOne('title', 'headline')
+ class Context(object):
+ headline = u'HEADLINE'
+ class ZDCPartialAnnotatableAdapter(object):
+ title = prop
+ def __init__(self, context):
+ self.__context = context
+ context = Context()
+ testing = ZDCPartialAnnotatableAdapter(context)
+ self.assertEqual(testing.title, u'HEADLINE')
+
+ def test___set___non_unicode_raises(self):
+ prop = self._makeOne('title', 'headline')
+ class Context(object):
+ headline = u'HEADLINE'
+ class ZDCPartialAnnotatableAdapter(object):
+ title = prop
+ def __init__(self, context):
+ self.__context = context
+ context = Context()
+ testing = ZDCPartialAnnotatableAdapter(context)
+ try:
+ testing.title = 123
+ except TypeError:
+ pass
+ else:
+ self.fail("Didn't raise TypeError")
+
+ def test___set___unchanged_doesnt_mutate(self):
+ prop = self._makeOne('title', 'headline')
+ class Context(object):
+ headline = u'HEADLINE'
+ def __setattr__(self, name, value):
+ assert 0
+ class ZDCPartialAnnotatableAdapter(object):
+ title = prop
+ def __init__(self, context):
+ self.__context = context
+ context = Context()
+ testing = ZDCPartialAnnotatableAdapter(context)
+ testing.title = u'HEADLINE' # doesn't raise
+
+ def test___set___changed_mutates(self):
+ prop = self._makeOne('title', 'headline')
+ class Context(object):
+ headline = u'HEADLINE1'
+ class ZDCPartialAnnotatableAdapter(object):
+ title = prop
+ def __init__(self, context):
+ self.__context = context
+ context = Context()
+ testing = ZDCPartialAnnotatableAdapter(context)
+ testing.title = u'HEADLINE2'
+ self.assertEqual(context.headline, u'HEADLINE2')
+
+class Test_partialAnnotatableAdapterFactory(unittest.TestCase):
+
+ def _callFUT(self, direct_fields):
+ from zope.dublincore.annotatableadapter \
+ import partialAnnotatableAdapterFactory
+ return partialAnnotatableAdapterFactory(direct_fields)
+
+ def test_w_empty_list_raises(self):
+ self.assertRaises(ValueError, self._callFUT, [])
+
+ def test_w_empty_dict_raises(self):
+ self.assertRaises(ValueError, self._callFUT, {})
+
+ def test_w_unknown_field_raises(self):
+ self.assertRaises(ValueError, self._callFUT, ['nonesuch'])
+
+ def test_w_date_fields_raises(self):
+ self.assertRaises(ValueError, self._callFUT, ['created'])
+ self.assertRaises(ValueError, self._callFUT, ['modified'])
+ self.assertRaises(ValueError, self._callFUT, ['effective'])
+ self.assertRaises(ValueError, self._callFUT, ['expires'])
+
+ def test_w_sequence_fields_raises(self):
+ self.assertRaises(ValueError, self._callFUT, ['creators'])
+ self.assertRaises(ValueError, self._callFUT, ['subjects'])
+ self.assertRaises(ValueError, self._callFUT, ['contributors'])
+
+ def test_w_scalar_prop_samename(self):
+ from zope.dublincore.annotatableadapter import DirectProperty
+ klass = self._callFUT(['title'])
+ prop = klass.title
+ self.failUnless(isinstance(prop, DirectProperty))
+ self.assertEqual(prop.__name__, 'title')
+ self.assertEqual(prop._DirectProperty__attrname, 'title') # XXX
+
+ def test_w_scalar_prop_mapped(self):
+ from zope.dublincore.annotatableadapter import DirectProperty
+ klass = self._callFUT({'title': 'headline'})
+ prop = klass.title
+ self.failUnless(isinstance(prop, DirectProperty))
+ self.assertEqual(prop.__name__, 'title')
+ self.assertEqual(prop._DirectProperty__attrname, 'headline') # XXX
+
+
+def test_suite():
+ return unittest.TestSuite((
+ unittest.makeSuite(ZDCAnnotatableAdapterTests),
+ unittest.makeSuite(DirectPropertyTests),
+ unittest.makeSuite(Test_partialAnnotatableAdapterFactory),
+ ))
+
Deleted: zope.dublincore/tags/3.5.0/src/zope/dublincore/tests/test_creatorannotator.py
===================================================================
--- zope.dublincore/trunk/src/zope/dublincore/tests/test_creatorannotator.py 2009-09-15 09:54:27 UTC (rev 104025)
+++ zope.dublincore/tags/3.5.0/src/zope/dublincore/tests/test_creatorannotator.py 2009-09-15 10:34:03 UTC (rev 104032)
@@ -1,133 +0,0 @@
-##############################################################################
-#
-# Copyright (c) 2001, 2002 Zope Corporation and Contributors.
-# All Rights Reserved.
-#
-# This software is subject to the provisions of the Zope Public License,
-# Version 2.1 (ZPL). A copy of the ZPL should accompany this distribution.
-# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
-# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
-# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
-# FOR A PARTICULAR PURPOSE.
-#
-##############################################################################
-"""Tests creator annotation.
-
-$Id$
-"""
-import unittest
-
-class CreatorAnnotatorTests(unittest.TestCase):
-
- def setUp(self):
- from zope.testing.cleanup import cleanUp
- cleanUp()
- self._makeInterface()
- self._registerAdapter()
-
- def tearDown(self):
- from zope.testing.cleanup import cleanUp
- from zope.security.management import endInteraction
- endInteraction()
- cleanUp()
-
- def _callFUT(self, event):
- from zope.dublincore.creatorannotator import CreatorAnnotator
- return CreatorAnnotator(event)
-
- def _makeInterface(self):
- from zope.interface import Interface
-
- class IDummyContent(Interface):
- pass
-
- self._iface = IDummyContent
-
- def _registerAdapter(self):
- from zope.component import provideAdapter
- from zope.dublincore.interfaces import IZopeDublinCore
- provideAdapter(DummyDCAdapter, (self._iface, ), IZopeDublinCore)
-
- def _makeContextAndEvent(self):
-
- from zope.interface import implements
-
- class DummyDublinCore(object):
- implements(self._iface)
- creators = ()
-
- class DummyEvent(object):
- def __init__(self, object):
- self.object = object
-
- context = DummyDublinCore()
- event = DummyEvent(context)
- return context, event
-
- def _setPrincipal(self, id):
- from zope.security.management import newInteraction
- class DummyPrincipal(object):
- title = 'TITLE'
- description = 'DESCRIPTION'
- def __init__(self, id):
- self.id = id
- if id is None:
- newInteraction(DummyRequest(None))
- else:
- newInteraction(DummyRequest(DummyPrincipal(id)))
-
- def test_w_no_request(self):
- context, event = self._makeContextAndEvent()
- self._callFUT(event)
- self.assertEqual(context.creators, ())
-
- def test_w_request_no_existing_creators(self):
- context, event = self._makeContextAndEvent()
- self._setPrincipal('phred')
- self._callFUT(event)
- self.assertEqual(context.creators, ('phred',))
-
- def test_w_request_w_existing_creator_nomatch(self):
- context, event = self._makeContextAndEvent()
- context.creators = ('bharney',)
- self._setPrincipal('phred')
- self._callFUT(event)
- self.assertEqual(context.creators, ('bharney', 'phred',))
-
- def test_w_request_w_existing_creator_nomatch(self):
- context, event = self._makeContextAndEvent()
- context.creators = ('bharney', 'phred')
- self._setPrincipal('phred')
- self._callFUT(event)
- self.assertEqual(context.creators, ('bharney', 'phred',))
-
- def test_w_request_no_principal(self):
- context, event = self._makeContextAndEvent()
- context.creators = ('bharney', 'phred')
- self._setPrincipal(None)
- self._callFUT(event)
- self.assertEqual(context.creators, ('bharney', 'phred',))
-
-class DummyDCAdapter(object):
-
- def _getcreator(self):
- return self.context.creators
- def _setcreator(self, value):
- self.context.creators = value
- creators = property(_getcreator, _setcreator, None, "Adapted Creators")
-
- def __init__(self, context):
- self.context = context
-
-
-class DummyRequest(object):
-
- def __init__(self, principal):
- self.principal = principal
- self.interaction = None
-
-
-def test_suite():
- return unittest.TestSuite((
- unittest.makeSuite(CreatorAnnotatorTests),
- ))
Copied: zope.dublincore/tags/3.5.0/src/zope/dublincore/tests/test_creatorannotator.py (from rev 104029, zope.dublincore/trunk/src/zope/dublincore/tests/test_creatorannotator.py)
===================================================================
--- zope.dublincore/tags/3.5.0/src/zope/dublincore/tests/test_creatorannotator.py (rev 0)
+++ zope.dublincore/tags/3.5.0/src/zope/dublincore/tests/test_creatorannotator.py 2009-09-15 10:34:03 UTC (rev 104032)
@@ -0,0 +1,133 @@
+##############################################################################
+#
+# Copyright (c) 2001, 2002 Zope Corporation and Contributors.
+# All Rights Reserved.
+#
+# This software is subject to the provisions of the Zope Public License,
+# Version 2.1 (ZPL). A copy of the ZPL should accompany this distribution.
+# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
+# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
+# FOR A PARTICULAR PURPOSE.
+#
+##############################################################################
+"""Tests creator annotation.
+
+$Id$
+"""
+import unittest
+
+class CreatorAnnotatorTests(unittest.TestCase):
+
+ def setUp(self):
+ from zope.testing.cleanup import cleanUp
+ cleanUp()
+ self._makeInterface()
+ self._registerAdapter()
+
+ def tearDown(self):
+ from zope.testing.cleanup import cleanUp
+ from zope.security.management import endInteraction
+ endInteraction()
+ cleanUp()
+
+ def _callFUT(self, event):
+ from zope.dublincore.creatorannotator import CreatorAnnotator
+ return CreatorAnnotator(event)
+
+ def _makeInterface(self):
+ from zope.interface import Interface
+
+ class IDummyContent(Interface):
+ pass
+
+ self._iface = IDummyContent
+
+ def _registerAdapter(self):
+ from zope.component import provideAdapter
+ from zope.dublincore.interfaces import IZopeDublinCore
+ provideAdapter(DummyDCAdapter, (self._iface, ), IZopeDublinCore)
+
+ def _makeContextAndEvent(self):
+
+ from zope.interface import implements
+
+ class DummyDublinCore(object):
+ implements(self._iface)
+ creators = ()
+
+ class DummyEvent(object):
+ def __init__(self, object):
+ self.object = object
+
+ context = DummyDublinCore()
+ event = DummyEvent(context)
+ return context, event
+
+ def _setPrincipal(self, id):
+ from zope.security.management import newInteraction
+ class DummyPrincipal(object):
+ title = 'TITLE'
+ description = 'DESCRIPTION'
+ def __init__(self, id):
+ self.id = id
+ if id is None:
+ newInteraction(DummyRequest(None))
+ else:
+ newInteraction(DummyRequest(DummyPrincipal(id)))
+
+ def test_w_no_request(self):
+ context, event = self._makeContextAndEvent()
+ self._callFUT(event)
+ self.assertEqual(context.creators, ())
+
+ def test_w_request_no_existing_creators(self):
+ context, event = self._makeContextAndEvent()
+ self._setPrincipal('phred')
+ self._callFUT(event)
+ self.assertEqual(context.creators, ('phred',))
+
+ def test_w_request_w_existing_creator_nomatch(self):
+ context, event = self._makeContextAndEvent()
+ context.creators = ('bharney',)
+ self._setPrincipal('phred')
+ self._callFUT(event)
+ self.assertEqual(context.creators, ('bharney', 'phred',))
+
+ def test_w_request_w_existing_creator_match(self):
+ context, event = self._makeContextAndEvent()
+ context.creators = ('bharney', 'phred')
+ self._setPrincipal('phred')
+ self._callFUT(event)
+ self.assertEqual(context.creators, ('bharney', 'phred',))
+
+ def test_w_request_no_principal(self):
+ context, event = self._makeContextAndEvent()
+ context.creators = ('bharney', 'phred')
+ self._setPrincipal(None)
+ self._callFUT(event)
+ self.assertEqual(context.creators, ('bharney', 'phred',))
+
+class DummyDCAdapter(object):
+
+ def _getcreator(self):
+ return self.context.creators
+ def _setcreator(self, value):
+ self.context.creators = value
+ creators = property(_getcreator, _setcreator, None, "Adapted Creators")
+
+ def __init__(self, context):
+ self.context = context
+
+
+class DummyRequest(object):
+
+ def __init__(self, principal):
+ self.principal = principal
+ self.interaction = None
+
+
+def test_suite():
+ return unittest.TestSuite((
+ unittest.makeSuite(CreatorAnnotatorTests),
+ ))
Deleted: zope.dublincore/tags/3.5.0/src/zope/dublincore/tests/test_property.py
===================================================================
--- zope.dublincore/trunk/src/zope/dublincore/tests/test_property.py 2009-09-15 09:54:27 UTC (rev 104025)
+++ zope.dublincore/tags/3.5.0/src/zope/dublincore/tests/test_property.py 2009-09-15 10:34:03 UTC (rev 104032)
@@ -1,54 +0,0 @@
-##############################################################################
-#
-# Copyright (c) 2006 Lovely Systems and Contributors.
-# All Rights Reserved.
-#
-# This software is subject to the provisions of the Zope Public License,
-# Version 2.1 (ZPL). A copy of the ZPL should accompany this distribution.
-# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
-# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
-# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
-# FOR A PARTICULAR PURPOSE.
-#
-##############################################################################
-"""Test the Dublin Core Property implementation
-
-$Id: $
-"""
-__docformat__ = "reStructuredText"
-
-import doctest
-import unittest
-
-from zope import component
-
-from zope.testing.doctestunit import DocFileSuite
-
-from zope.app.testing import setup, placelesssetup
-from zope.dublincore import annotatableadapter
-from zope.dublincore import testing
-from zope.dublincore.interfaces import IWriteZopeDublinCore
-
-
-def setUp(test):
- setup.placefulSetUp()
- setup.setUpAnnotations()
- testing.setUpDublinCore()
-
-def tearDown(test):
- setup.placefulTearDown()
-
-
-def test_suite():
-
- return unittest.TestSuite(
- (
- DocFileSuite('../property.txt',
- setUp=setUp,
- tearDown=tearDown,
- optionflags=doctest.NORMALIZE_WHITESPACE|doctest.ELLIPSIS,
- ),
- ))
-
-if __name__ == '__main__':
- unittest.main(defaultTest='test_suite')
Copied: zope.dublincore/tags/3.5.0/src/zope/dublincore/tests/test_property.py (from rev 104029, zope.dublincore/trunk/src/zope/dublincore/tests/test_property.py)
===================================================================
--- zope.dublincore/tags/3.5.0/src/zope/dublincore/tests/test_property.py (rev 0)
+++ zope.dublincore/tags/3.5.0/src/zope/dublincore/tests/test_property.py 2009-09-15 10:34:03 UTC (rev 104032)
@@ -0,0 +1,48 @@
+##############################################################################
+#
+# Copyright (c) 2006 Lovely Systems and Contributors.
+# All Rights Reserved.
+#
+# This software is subject to the provisions of the Zope Public License,
+# Version 2.1 (ZPL). A copy of the ZPL should accompany this distribution.
+# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
+# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
+# FOR A PARTICULAR PURPOSE.
+#
+##############################################################################
+"""Test the Dublin Core Property implementation
+
+$Id$
+"""
+__docformat__ = "reStructuredText"
+
+import doctest
+import unittest
+
+from zope import component
+
+from zope.testing.doctestunit import DocFileSuite
+from zope.testing import cleanup
+
+from zope.annotation.attribute import AttributeAnnotations
+from zope.dublincore import testing
+
+
+def setUp(test):
+ cleanup.setUp()
+ component.provideAdapter(AttributeAnnotations)
+ testing.setUpDublinCore()
+
+def tearDown(test):
+ cleanup.tearDown()
+
+def test_suite():
+ return unittest.TestSuite(
+ (
+ DocFileSuite('../property.txt',
+ setUp=setUp,
+ tearDown=tearDown,
+ optionflags=doctest.NORMALIZE_WHITESPACE|doctest.ELLIPSIS,
+ ),
+ ))
More information about the checkins
mailing list