[Checkins] SVN: zope.dublincore/trunk/ - made ReST headlines consistent
Michael Howitz
mh at gocept.com
Sat Feb 13 14:45:38 EST 2010
Log message for revision 109019:
- made ReST headlines consistent
- added doctest to longdescription
- added missing dependency on zope.lifecycleevent
- wrote tests for timeannotators module
Changed:
U zope.dublincore/trunk/CHANGES.txt
U zope.dublincore/trunk/setup.py
U zope.dublincore/trunk/src/zope/dublincore/tests/partial.txt
A zope.dublincore/trunk/src/zope/dublincore/tests/test_timeannotators.py
A zope.dublincore/trunk/src/zope/dublincore/tests/timeannotators.txt
-=-
Modified: zope.dublincore/trunk/CHANGES.txt
===================================================================
--- zope.dublincore/trunk/CHANGES.txt 2010-02-13 19:43:05 UTC (rev 109018)
+++ zope.dublincore/trunk/CHANGES.txt 2010-02-13 19:45:38 UTC (rev 109019)
@@ -1,3 +1,4 @@
+=======
Changes
=======
@@ -2,9 +3,11 @@
3.6.1 (unreleased)
-------------------
+==================
-- Nothing changed yet.
+- Added tests for ``zope.dublincore.timeannotators``.
+- Added not declared dependency on ``zope.lifecycleevent``.
+
3.6.0 (2009-12-02)
-------------------
+==================
@@ -18,7 +21,7 @@
dependency.
3.5.0 (2009-09-15)
-------------------
+==================
- Add missing dependencies.
@@ -33,24 +36,24 @@
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
Modified: zope.dublincore/trunk/setup.py
===================================================================
--- zope.dublincore/trunk/setup.py 2010-02-13 19:43:05 UTC (rev 109018)
+++ zope.dublincore/trunk/setup.py 2010-02-13 19:45:38 UTC (rev 109019)
@@ -21,14 +21,28 @@
$Id$
"""
from setuptools import setup, find_packages
+import os.path
-long_description = (open('README.txt').read() +
- '\n\n' +
- open('CHANGES.txt').read())
+def read(*path):
+ return open(os.path.join(*path)).read() + '\n\n'
+version = '3.6.1dev'
+
+long_description = (
+ '.. contents::\n\n' +
+ '========\n' +
+ 'Overview\n' +
+ '========\n' +
+ read('README.txt') +
+ read('src', 'zope', 'dublincore', 'property.txt') +
+ read('src', 'zope', 'dublincore', 'tests', 'partial.txt') +
+ read('src', 'zope', 'dublincore', 'tests', 'timeannotators.txt') +
+ read('CHANGES.txt')
+ )
+
setup(
name="zope.dublincore",
- version = '3.6.1dev',
+ version=version,
url='http://pypi.python.org/pypi/zope.dublincore',
license='ZPL 2.1',
description='Zope Dublin Core implementation',
@@ -50,6 +64,7 @@
'zope.component',
'zope.datetime',
'zope.interface',
+ 'zope.lifecycleevent',
'zope.location',
'zope.schema',
'zope.security',
Modified: zope.dublincore/trunk/src/zope/dublincore/tests/partial.txt
===================================================================
--- zope.dublincore/trunk/src/zope/dublincore/tests/partial.txt 2010-02-13 19:43:05 UTC (rev 109018)
+++ zope.dublincore/trunk/src/zope/dublincore/tests/partial.txt 2010-02-13 19:45:38 UTC (rev 109019)
@@ -77,7 +77,7 @@
Using arbitrary field names
----------------------------
+===========================
We've seen the simple approach, allowing a Dublin Core field to be
stored on the content object using an attribute of the same name as
@@ -123,7 +123,7 @@
Limitations
------------
+===========
The current implementation has a number of limitations to be aware of;
hopefully these can be removed in the future.
Added: zope.dublincore/trunk/src/zope/dublincore/tests/test_timeannotators.py
===================================================================
--- zope.dublincore/trunk/src/zope/dublincore/tests/test_timeannotators.py (rev 0)
+++ zope.dublincore/trunk/src/zope/dublincore/tests/test_timeannotators.py 2010-02-13 19:45:38 UTC (rev 109019)
@@ -0,0 +1,31 @@
+##############################################################################
+#
+# Copyright (c) 2010 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.
+#
+##############################################################################
+"""Test time annotator.
+
+"""
+
+import doctest
+import zope.testing.renormalizing
+import re
+
+datetime_re = (
+ '[0-9]{4}, [0-9]{1,2}, [0-9]{1,2}, [0-9]{1,2}, [0-9]{1,2}, [0-9]{1,2}, '
+ '[0-9]{1,6}')
+
+def test_suite():
+ return doctest.DocFileSuite(
+ 'timeannotators.txt',
+ checker=zope.testing.renormalizing.RENormalizing(
+ [(re.compile(datetime_re), '<DATETIME>')])
+ )
\ No newline at end of file
Property changes on: zope.dublincore/trunk/src/zope/dublincore/tests/test_timeannotators.py
___________________________________________________________________
Added: svn:keywords
+ Id Rev Date
Added: svn:eol-style
+ native
Added: zope.dublincore/trunk/src/zope/dublincore/tests/timeannotators.txt
===================================================================
--- zope.dublincore/trunk/src/zope/dublincore/tests/timeannotators.txt (rev 0)
+++ zope.dublincore/trunk/src/zope/dublincore/tests/timeannotators.txt 2010-02-13 19:45:38 UTC (rev 109019)
@@ -0,0 +1,80 @@
+===============
+Time annotators
+===============
+
+Time annotators store the creation resp. last modification time of an object.
+
+Set up
+======
+
+>>> class Content(object):
+... created = None
+... modified = None
+
+The annotations are stored on the ``IZopeDublinCore`` adapter. This dummy adapter
+reads and writes from/to the context object.
+
+>>> import zope.component
+>>> import zope.dublincore.interfaces
+>>> class DummyDublinCore(object):
+... def __init__(self, context):
+... self.__dict__['context'] = context
+...
+... def __getattr__(self, name):
+... return getattr(self.context, name)
+...
+... def __setattr__(self, name, value):
+... setattr(self.context, name, value)
+
+>>> zope.component.provideAdapter(
+... DummyDublinCore, (Content,), zope.dublincore.interfaces.IZopeDublinCore)
+
+Created annotator
+=================
+
+The created annotator sets creation and modification time to current time.
+
+>>> content = Content()
+
+It is registered for the ``ObjectCreatedEvent``:
+
+>>> import zope.dublincore.timeannotators
+>>> import zope.lifecycleevent.interfaces
+>>> zope.component.provideHandler(
+... zope.dublincore.timeannotators.CreatedAnnotator,
+... (zope.lifecycleevent.interfaces.IObjectCreatedEvent,))
+
+>>> import zope.event
+>>> import zope.lifecycleevent
+>>> zope.event.notify(zope.lifecycleevent.ObjectCreatedEvent(content))
+
+Both ``created`` and ``modified`` get set:
+
+>>> content.created
+datetime.datetime(<DATETIME>, tzinfo=<UTC>)
+>>> content.modified
+datetime.datetime(<DATETIME>, tzinfo=<UTC>)
+
+Modified annotator
+==================
+
+The modified annotator only sets the modification time to current time.
+
+>>> content = Content()
+
+It is registered for the ``ObjectModifiedEvent``:
+
+>>> zope.component.provideHandler(
+... zope.dublincore.timeannotators.ModifiedAnnotator,
+... (zope.lifecycleevent.interfaces.IObjectModifiedEvent,))
+>>> zope.event.notify(zope.lifecycleevent.ObjectModifiedEvent(content))
+
+Only ``modified`` gets set:
+
+>>> print content.created
+None
+>>> content.modified
+datetime.datetime(<DATETIME>, tzinfo=<UTC>)
+
+
+
Property changes on: zope.dublincore/trunk/src/zope/dublincore/tests/timeannotators.txt
___________________________________________________________________
Added: svn:keywords
+ Id Rev Date
Added: svn:eol-style
+ native
More information about the checkins
mailing list