[Checkins] SVN: lovely.persistent/trunk/ moved from lovely systems
private repository to zope.org
Jodok Batlogg
jodok.batlogg at lovelysystems.com
Mon Dec 10 10:14:22 EST 2007
Log message for revision 82239:
moved from lovely systems private repository to zope.org
Changed:
A lovely.persistent/trunk/CHANGES.txt
A lovely.persistent/trunk/LICENSE.txt
A lovely.persistent/trunk/bootstrap.py
A lovely.persistent/trunk/buildout.cfg
A lovely.persistent/trunk/setup.py
A lovely.persistent/trunk/src/
A lovely.persistent/trunk/src/lovely/
A lovely.persistent/trunk/src/lovely/__init__.py
A lovely.persistent/trunk/src/lovely/persistent/
A lovely.persistent/trunk/src/lovely/persistent/LICENSE.txt
A lovely.persistent/trunk/src/lovely/persistent/README.txt
A lovely.persistent/trunk/src/lovely/persistent/__init__.py
A lovely.persistent/trunk/src/lovely/persistent/app.py
A lovely.persistent/trunk/src/lovely/persistent/tests.py
-=-
Added: lovely.persistent/trunk/CHANGES.txt
===================================================================
--- lovely.persistent/trunk/CHANGES.txt (rev 0)
+++ lovely.persistent/trunk/CHANGES.txt 2007-12-10 15:14:21 UTC (rev 82239)
@@ -0,0 +1,16 @@
+============================
+Changes in lovely.persistent
+============================
+
+2007/12/10 0.1.1
+================
+
+- moved to zope.org
+
+2007/06/19 0.1.0a1
+==================
+
+- added zodb to dependencies
+
+- added support for fieldproperties
+
Property changes on: lovely.persistent/trunk/CHANGES.txt
___________________________________________________________________
Name: svn:eol-style
+ native
Added: lovely.persistent/trunk/LICENSE.txt
===================================================================
--- lovely.persistent/trunk/LICENSE.txt (rev 0)
+++ lovely.persistent/trunk/LICENSE.txt 2007-12-10 15:14:21 UTC (rev 82239)
@@ -0,0 +1,42 @@
+ZPL 2.1
+Zope Public License (ZPL) Version 2.1
+
+A copyright notice accompanies this license document that identifies
+the copyright holders.
+
+This license has been certified as open source. It has also been
+designated as GPL compatible by the Free Software Foundation (FSF).
+
+Redistribution and use in source and binary forms,
+with or without modification, are permitted provided that the following
+conditions are met:
+
+Redistributions in source code must retain the accompanying copyright
+notice, this list of conditions, and the following disclaimer.
+Redistributions in binary form must reproduce the accompanying
+copyright notice, this list of conditions, and the following
+disclaimer in the documentation and/or other materials provided
+with the distribution.
+Names of the copyright holders must not be used to endorse or
+promote products derived from this software without prior written
+permission from the copyright holders.
+The right to distribute this software or to use it for any purpose
+does not give you the right to use Servicemarks (sm) or Trademarks (tm)
+of the copyright holders. Use of them is covered by separate
+agreement with the copyright holders.
+If any files are modified, you must cause the modified files to
+carry prominent notices stating that you changed the files and
+the date of any change.
+
+Disclaimer
+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ``AS IS'' AND ANY
+EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS BE
+LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
Property changes on: lovely.persistent/trunk/LICENSE.txt
___________________________________________________________________
Name: svn:eol-style
+ native
Added: lovely.persistent/trunk/bootstrap.py
===================================================================
--- lovely.persistent/trunk/bootstrap.py (rev 0)
+++ lovely.persistent/trunk/bootstrap.py 2007-12-10 15:14:21 UTC (rev 82239)
@@ -0,0 +1,52 @@
+##############################################################################
+#
+# Copyright (c) 2007 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.
+#
+##############################################################################
+"""Bootstrap a buildout-based project
+
+Simply run this script in a directory containing a buildout.cfg.
+The script accepts buildout command-line options, so you can
+use the -c option to specify an alternate configuration file.
+
+$Id$
+"""
+
+import os, shutil, sys, tempfile, urllib2
+
+tmpeggs = tempfile.mkdtemp()
+
+ez = {}
+exec urllib2.urlopen('http://peak.telecommunity.com/dist/ez_setup.py'
+ ).read() in ez
+ez['use_setuptools'](to_dir=tmpeggs, download_delay=0)
+
+import pkg_resources
+
+cmd = 'from setuptools.command.easy_install import main; main()'
+if sys.platform == 'win32':
+ cmd = '"%s"' % cmd # work around spawn lamosity on windows
+
+ws = pkg_resources.working_set
+assert os.spawnle(
+ os.P_WAIT, sys.executable, sys.executable,
+ '-c', cmd, '-mqNxd', tmpeggs, 'zc.buildout',
+ dict(os.environ,
+ PYTHONPATH=
+ ws.find(pkg_resources.Requirement.parse('setuptools')).location
+ ),
+ ) == 0
+
+ws.add_entry(tmpeggs)
+ws.require('zc.buildout')
+import zc.buildout.buildout
+zc.buildout.buildout.main(sys.argv[1:] + ['bootstrap'])
+shutil.rmtree(tmpeggs)
Property changes on: lovely.persistent/trunk/bootstrap.py
___________________________________________________________________
Name: svn:keywords
+ Id
Name: svn:eol-style
+ native
Added: lovely.persistent/trunk/buildout.cfg
===================================================================
--- lovely.persistent/trunk/buildout.cfg (rev 0)
+++ lovely.persistent/trunk/buildout.cfg 2007-12-10 15:14:21 UTC (rev 82239)
@@ -0,0 +1,10 @@
+[buildout]
+develop = .
+parts = test
+find-links = http://download.lovelysystems.com/eggs/mirror/zope
+
+[test]
+recipe = zc.recipe.testrunner
+eggs = lovely.persistent [test]
+
+
Added: lovely.persistent/trunk/setup.py
===================================================================
--- lovely.persistent/trunk/setup.py (rev 0)
+++ lovely.persistent/trunk/setup.py 2007-12-10 15:14:21 UTC (rev 82239)
@@ -0,0 +1,46 @@
+import os
+from setuptools import setup, find_packages
+
+def read(*rnames):
+ return open(os.path.join(os.path.dirname(__file__), *rnames)).read()
+
+long_description=(
+ read('src', 'lovely', 'persistent', 'README.txt'))
+ + '\n' +
+ read('CHANGES.txt')
+ + '\n' +
+ 'Download\n'
+ '**********************\n'
+ )
+
+name='lovely.persistent'
+setup(
+ name = name,
+ version = '0.1.1',
+ author = "Lovely Systems GmbH",
+ author_email = "office at lovelysystems.com",
+ description = "improved ZODB persistence",
+ long_description = long_description,
+ license = "ZPL 2.1",
+ keywords = "persistent zope zope3",
+ url = 'http://launchpad.net/lovely.persistent',
+ zip_safe = False,
+ packages = find_packages('src'),
+ include_package_data = True,
+ package_dir = {'':'src'},
+ namespace_packages = ['lovely',],
+ install_requires = ['setuptools',
+ 'ZODB3',
+ ],
+ extras_require = dict(
+ test = ['zope.app.testing',
+ 'zope.testing',]),
+
+ classifiers = [
+ 'Development Status :: 4 - Beta',
+ 'Intended Audience :: Developers',
+ 'License :: OSI Approved :: Zope Public License',
+ 'Topic :: Software Development :: Libraries :: Python Modules',
+ ],
+ )
+
Property changes on: lovely.persistent/trunk/setup.py
___________________________________________________________________
Name: svn:keywords
+ Id
Name: svn:eol-style
+ native
Added: lovely.persistent/trunk/src/lovely/__init__.py
===================================================================
--- lovely.persistent/trunk/src/lovely/__init__.py (rev 0)
+++ lovely.persistent/trunk/src/lovely/__init__.py 2007-12-10 15:14:21 UTC (rev 82239)
@@ -0,0 +1,24 @@
+##############################################################################
+#
+# Copyright (c) 2007 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.
+#
+##############################################################################
+"""
+$Id$
+"""
+
+__docformat__ = "reStructuredText"
+
+
+try:
+ __import__('pkg_resources').declare_namespace(__name__)
+except ImportError:
+ pass
Property changes on: lovely.persistent/trunk/src/lovely/__init__.py
___________________________________________________________________
Name: svn:keywords
+ Id
Name: svn:eol-style
+ native
Added: lovely.persistent/trunk/src/lovely/persistent/LICENSE.txt
===================================================================
--- lovely.persistent/trunk/src/lovely/persistent/LICENSE.txt (rev 0)
+++ lovely.persistent/trunk/src/lovely/persistent/LICENSE.txt 2007-12-10 15:14:21 UTC (rev 82239)
@@ -0,0 +1,42 @@
+ZPL 2.1
+Zope Public License (ZPL) Version 2.1
+
+A copyright notice accompanies this license document that identifies
+the copyright holders.
+
+This license has been certified as open source. It has also been
+designated as GPL compatible by the Free Software Foundation (FSF).
+
+Redistribution and use in source and binary forms,
+with or without modification, are permitted provided that the following
+conditions are met:
+
+Redistributions in source code must retain the accompanying copyright
+notice, this list of conditions, and the following disclaimer.
+Redistributions in binary form must reproduce the accompanying
+copyright notice, this list of conditions, and the following
+disclaimer in the documentation and/or other materials provided
+with the distribution.
+Names of the copyright holders must not be used to endorse or
+promote products derived from this software without prior written
+permission from the copyright holders.
+The right to distribute this software or to use it for any purpose
+does not give you the right to use Servicemarks (sm) or Trademarks (tm)
+of the copyright holders. Use of them is covered by separate
+agreement with the copyright holders.
+If any files are modified, you must cause the modified files to
+carry prominent notices stating that you changed the files and
+the date of any change.
+
+Disclaimer
+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ``AS IS'' AND ANY
+EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS BE
+LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
Property changes on: lovely.persistent/trunk/src/lovely/persistent/LICENSE.txt
___________________________________________________________________
Name: svn:eol-style
+ native
Added: lovely.persistent/trunk/src/lovely/persistent/README.txt
===================================================================
--- lovely.persistent/trunk/src/lovely/persistent/README.txt (rev 0)
+++ lovely.persistent/trunk/src/lovely/persistent/README.txt 2007-12-10 15:14:21 UTC (rev 82239)
@@ -0,0 +1,96 @@
+==========
+Persistent
+==========
+
+This package provides a base class for persistent objects with the advantage
+that the object is only marked as changed if an attribute has really changed.
+
+ >>> import transaction
+ >>> from ZODB.tests.util import DB
+
+ >>> from lovely import persistent
+
+ >>> p = LovelyPersistent()
+ >>> p._p_changed
+ False
+
+ >>> p.a = 1
+ >>> db = DB()
+ >>> conn = db.open()
+ >>> conn.root()['p'] = p
+ >>> transaction.commit()
+
+After commiting the changes the object is no longer in changed state.
+
+ >>> p._p_changed
+ False
+
+Setting a with its existing value doesn't put the object in cahnged state.
+
+ >>> p.a
+ 1
+ >>> p.a = 1
+ >>> p._p_changed
+ False
+
+But modifying a :
+
+ >>> p.a = 2
+ >>> p._p_changed
+ True
+ >>> transaction.commit()
+
+ >>> p._p_changed
+ False
+
+Deleting an attribute also put the object into changed state.
+
+ >>> del p.a
+ >>> p._p_changed
+ True
+
+
+Special Properties
+==================
+
+Special property implementations do work too. To show this we use the
+fieldproperties from zope.schema.
+
+ >>> from zope.schema.fieldproperty import FieldProperty
+ >>> from zope import schema, interface
+ >>> class IMyFace(interface.Interface):
+ ... eyesOpen = schema.Bool(default=True, required=False)
+
+ >>> class MyFace(persistent.Persistent):
+ ... eyesOpen = FieldProperty(IMyFace['eyesOpen'])
+
+ >>> persistent.tests.MyFace = MyFace
+ >>> MyFace.__module__ = persistent.tests.setUp.__module__
+ >>> myFace = conn.root()['myFace'] = MyFace()
+ >>> transaction.commit()
+
+Default values.
+
+ >>> myFace.eyesOpen
+ True
+
+Validation.
+
+ >>> myFace.eyesOpen = 'not always'
+ Traceback (most recent call last):
+ ...
+ WrongType: ('not always', <type 'bool'>)
+
+Note, setting to default value does not change the object.
+
+ >>> transaction.commit()
+ >>> myFace.eyesOpen = True
+ >>> myFace._p_changed
+ False
+
+ >>> transaction.commit()
+ >>> myFace.eyesOpen = False
+ >>> myFace._p_changed
+ True
+
+
Property changes on: lovely.persistent/trunk/src/lovely/persistent/README.txt
___________________________________________________________________
Name: svn:eol-style
+ native
Added: lovely.persistent/trunk/src/lovely/persistent/__init__.py
===================================================================
--- lovely.persistent/trunk/src/lovely/persistent/__init__.py (rev 0)
+++ lovely.persistent/trunk/src/lovely/persistent/__init__.py 2007-12-10 15:14:21 UTC (rev 82239)
@@ -0,0 +1,23 @@
+##############################################################################
+#
+# Copyright (c) 2007 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.
+#
+##############################################################################
+"""
+$Id$
+"""
+
+__docformat__ = "reStructuredText"
+
+
+
+from app import Persistent
+
Property changes on: lovely.persistent/trunk/src/lovely/persistent/__init__.py
___________________________________________________________________
Name: svn:keywords
+ Id
Name: svn:eol-style
+ native
Added: lovely.persistent/trunk/src/lovely/persistent/app.py
===================================================================
--- lovely.persistent/trunk/src/lovely/persistent/app.py (rev 0)
+++ lovely.persistent/trunk/src/lovely/persistent/app.py 2007-12-10 15:14:21 UTC (rev 82239)
@@ -0,0 +1,37 @@
+##############################################################################
+#
+# Copyright (c) 2007 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.
+#
+##############################################################################
+"""
+$Id$
+"""
+
+__docformat__ = "reStructuredText"
+
+
+import persistent
+
+_marker = object()
+class Persistent(persistent.Persistent):
+
+ def __setattr__(self, name, value):
+ if getattr(self, name, _marker) != value:
+ # only set the value if changed
+ super(Persistent, self).__setattr__(name, value)
+
+
+ def __delattr__(self, name):
+ if name in self.__dict__:
+ # only delete if in dict
+ persistent.Persistent.__delattr__(self, name)
+
+
Property changes on: lovely.persistent/trunk/src/lovely/persistent/app.py
___________________________________________________________________
Name: svn:keywords
+ Id
Name: svn:eol-style
+ native
Added: lovely.persistent/trunk/src/lovely/persistent/tests.py
===================================================================
--- lovely.persistent/trunk/src/lovely/persistent/tests.py (rev 0)
+++ lovely.persistent/trunk/src/lovely/persistent/tests.py 2007-12-10 15:14:21 UTC (rev 82239)
@@ -0,0 +1,53 @@
+##############################################################################
+#
+# Copyright (c) 2007 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.
+#
+##############################################################################
+"""
+$Id$
+"""
+
+__docformat__ = "reStructuredText"
+
+
+import unittest
+
+from zope.testing import doctest
+from zope.testing.doctestunit import DocFileSuite
+
+from zope.app.testing.setup import (placefulSetUp,
+ placefulTearDown)
+
+from lovely import persistent
+
+class LovelyPersistent(persistent.Persistent):
+ pass
+
+
+def setUp(test):
+ root = placefulSetUp(site=True)
+ test.globs['root'] = root
+ test.globs['LovelyPersistent'] = LovelyPersistent
+
+def tearDown(test):
+ placefulTearDown()
+
+
+def test_suite():
+ return unittest.TestSuite((
+ DocFileSuite('README.txt',
+ setUp=setUp, tearDown=tearDown,
+ optionflags=doctest.NORMALIZE_WHITESPACE|doctest.ELLIPSIS,
+ ),
+ ))
+
+if __name__ == '__main__':
+ unittest.main(defaultTest='test_suite')
Property changes on: lovely.persistent/trunk/src/lovely/persistent/tests.py
___________________________________________________________________
Name: svn:keywords
+ Id
Name: svn:eol-style
+ native
More information about the Checkins
mailing list