diff -Nru zope.app.generations-3.6.0/bootstrap.py zope.app.generations-3.6.1/bootstrap.py --- zope.app.generations-3.6.0/bootstrap.py 2010-09-17 12:40:12.000000000 +0000 +++ zope.app.generations-3.6.1/bootstrap.py 2012-01-23 16:57:24.000000000 +0000 @@ -1,6 +1,6 @@ ############################################################################## # -# Copyright (c) 2006 Zope Corporation and Contributors. +# Copyright (c) 2006 Zope Foundation and Contributors. # All Rights Reserved. # # This software is subject to the provisions of the Zope Public License, @@ -17,7 +17,7 @@ The script accepts buildout command-line options, so you can use the -c option to specify an alternate configuration file. -$Id: bootstrap.py 73672 2007-03-27 07:42:58Z dobe $ +$Id: bootstrap.py 124134 2012-01-23 15:20:44Z menesis $ """ import os, shutil, sys, tempfile, urllib2 diff -Nru zope.app.generations-3.6.0/CHANGES.txt zope.app.generations-3.6.1/CHANGES.txt --- zope.app.generations-3.6.0/CHANGES.txt 2010-09-17 12:40:12.000000000 +0000 +++ zope.app.generations-3.6.1/CHANGES.txt 2012-01-23 16:57:24.000000000 +0000 @@ -2,6 +2,13 @@ CHANGES ======= +3.6.1 (2012-01-23) +------------------ + +- Replaced an undeclared test dependency on ``zope.app.authentication`` with + ``zope.password``. + + 3.6.0 (2010-09-17) ------------------ diff -Nru zope.app.generations-3.6.0/COPYRIGHT.txt zope.app.generations-3.6.1/COPYRIGHT.txt --- zope.app.generations-3.6.0/COPYRIGHT.txt 1970-01-01 00:00:00.000000000 +0000 +++ zope.app.generations-3.6.1/COPYRIGHT.txt 2012-01-23 16:57:24.000000000 +0000 @@ -0,0 +1 @@ +Zope Foundation and Contributors \ No newline at end of file diff -Nru zope.app.generations-3.6.0/debian/changelog zope.app.generations-3.6.1/debian/changelog --- zope.app.generations-3.6.0/debian/changelog 2011-12-31 08:18:11.000000000 +0000 +++ zope.app.generations-3.6.1/debian/changelog 2012-01-24 16:11:10.000000000 +0000 @@ -1,3 +1,12 @@ +zope.app.generations (3.6.1-0ubuntu1) precise; urgency=low + + * New upstream release. + * debian/patches: remove automatic patch, upstream now includes LICENSE.txt + * debian/copyright: update to latest dep5 format. + * debian/pydist-overrides: remove, we use van.pydeb. + + -- Gediminas Paulauskas Tue, 24 Jan 2012 18:05:15 +0200 + zope.app.generations (3.6.0-0ubuntu4) precise; urgency=low * Rebuild to drop python2.6 dependencies. diff -Nru zope.app.generations-3.6.0/debian/copyright zope.app.generations-3.6.1/debian/copyright --- zope.app.generations-3.6.0/debian/copyright 2011-06-28 10:11:27.000000000 +0000 +++ zope.app.generations-3.6.1/debian/copyright 2012-01-24 16:08:33.000000000 +0000 @@ -1,11 +1,11 @@ -Format-Specification: http://dep.debian.net/deps/dep5/ -Name: zope.app.generations -Maintainer: Zope Foundation and Contributors +Format: http://dep.debian.net/deps/dep5/ +Upstream-Name: zope.app.generations +Upstream-Contact: Zope Corporation and Contributors Source: http://pypi.python.org/pypi/zope.app.generations Files: * -Copyright: (c) 2004, 2007 Zope Corporation and Contributors. -License: ZPL-2.1 +Copyright: (c) 2004, 2006, 2007 Zope Foundation and Contributors. +License: Zope-2.1 Zope Public License (ZPL) Version 2.1 . A copyright notice accompanies this license document that identifies the diff -Nru zope.app.generations-3.6.0/debian/patches/debian-changes-3.6.0-0ubuntu3 zope.app.generations-3.6.1/debian/patches/debian-changes-3.6.0-0ubuntu3 --- zope.app.generations-3.6.0/debian/patches/debian-changes-3.6.0-0ubuntu3 2011-06-30 00:49:31.000000000 +0000 +++ zope.app.generations-3.6.1/debian/patches/debian-changes-3.6.0-0ubuntu3 1970-01-01 00:00:00.000000000 +0000 @@ -1,82 +0,0 @@ -Description: Upstream changes introduced in version 3.6.0-0ubuntu3 - This patch has been created by dpkg-source during the package build. - Here's the last changelog entry, hopefully it gives details on why - those changes were made: - . - zope.app.generations (3.6.0-0ubuntu3) oneiric; urgency=low - . - * dh_python2 transition. - * changed to source format 3.0 quilt. - * added debian/pydist-overrides to assist dhp2 calculate Depends. - * debian/rules - - changed "--with python-central" to "--with python2". - * debian/control - - changed python-all to (>= 2.6.6-3~). - - removed B-D on python-central. - - increased Standards Version to 3.9.2. - - changed XS-P-V: all to X-P-V: >= 2.5. - - removed XB-P-V, no longer needed. - . - The person named in the Author field signed this changelog entry. -Author: Charlie Smotherman - ---- -The information above should follow the Patch Tagging Guidelines, please -checkout http://dep.debian.net/deps/dep3/ to learn about the format. Here -are templates for supplementary fields that you might want to add: - -Origin: , -Bug: -Bug-Debian: http://bugs.debian.org/ -Bug-Ubuntu: https://launchpad.net/bugs/ -Forwarded: -Reviewed-By: -Last-Update: - ---- /dev/null -+++ zope.app.generations-3.6.0/LICENSE.txt -@@ -0,0 +1,44 @@ -+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: -+ -+1. Redistributions in source code must retain the accompanying copyright -+notice, this list of conditions, and the following disclaimer. -+ -+2. 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. -+ -+3. 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. -+ -+4. 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. -+ -+5. 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. diff -Nru zope.app.generations-3.6.0/debian/patches/series zope.app.generations-3.6.1/debian/patches/series --- zope.app.generations-3.6.0/debian/patches/series 2011-06-30 00:49:31.000000000 +0000 +++ zope.app.generations-3.6.1/debian/patches/series 1970-01-01 00:00:00.000000000 +0000 @@ -1 +0,0 @@ -debian-changes-3.6.0-0ubuntu3 diff -Nru zope.app.generations-3.6.0/debian/pydist-overrides zope.app.generations-3.6.1/debian/pydist-overrides --- zope.app.generations-3.6.0/debian/pydist-overrides 2011-06-28 10:11:27.000000000 +0000 +++ zope.app.generations-3.6.1/debian/pydist-overrides 1970-01-01 00:00:00.000000000 +0000 @@ -1,7 +0,0 @@ -setuptools python-setuptools -zope.app.renderer python-zope.app.renderer -zope.interface python-zope.interface -zope.app.publication python-zope.app.publication -ZODB3 python-zodb -zope.processlifetime python-zope.processlifetime -zope.applicationcontrol python-zope.applicationcontrol diff -Nru zope.app.generations-3.6.0/debian/tests/all zope.app.generations-3.6.1/debian/tests/all --- zope.app.generations-3.6.0/debian/tests/all 2011-06-28 10:11:27.000000000 +0000 +++ zope.app.generations-3.6.1/debian/tests/all 2012-01-24 16:07:42.000000000 +0000 @@ -1,2 +1,3 @@ #!/bin/bash -. /usr/share/python-zope.testing/test_helper +testfilter='-s zope.app.generations' +. /usr/share/python-zope.testrunner/test_helper diff -Nru zope.app.generations-3.6.0/debian/tests/control zope.app.generations-3.6.1/debian/tests/control --- zope.app.generations-3.6.0/debian/tests/control 2011-06-28 10:11:27.000000000 +0000 +++ zope.app.generations-3.6.1/debian/tests/control 2012-01-24 16:07:08.000000000 +0000 @@ -1,3 +1,3 @@ Tests: all Features: no-build-needed -Depends: @, python-zope.testing, python-zope.app.testing, python-zope.app.zcmlfiles, python-zope.login, python-zope.publisher (>= 3.12), python-zope.securitypolicy +Depends: @, python-zope.testrunner, python-zope.app.testing, python-zope.app.zcmlfiles, python-zope.login, python-zope.password, python-zope.publisher (>= 3.12), python-zope.securitypolicy diff -Nru zope.app.generations-3.6.0/LICENSE.txt zope.app.generations-3.6.1/LICENSE.txt --- zope.app.generations-3.6.0/LICENSE.txt 1970-01-01 00:00:00.000000000 +0000 +++ zope.app.generations-3.6.1/LICENSE.txt 2012-01-23 16:57:24.000000000 +0000 @@ -0,0 +1,44 @@ +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: + +1. Redistributions in source code must retain the accompanying copyright +notice, this list of conditions, and the following disclaimer. + +2. 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. + +3. 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. + +4. 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. + +5. 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. diff -Nru zope.app.generations-3.6.0/PKG-INFO zope.app.generations-3.6.1/PKG-INFO --- zope.app.generations-3.6.0/PKG-INFO 2010-09-17 12:40:15.000000000 +0000 +++ zope.app.generations-3.6.1/PKG-INFO 2012-01-23 16:57:32.000000000 +0000 @@ -1,6 +1,6 @@ -Metadata-Version: 1.0 +Metadata-Version: 1.1 Name: zope.app.generations -Version: 3.6.0 +Version: 3.6.1 Summary: Zope Application Schema Generations Home-page: http://pypi.python.org/pypi/zope.app.generations Author: Zope Corporation and Contributors @@ -33,24 +33,24 @@ We will be using the component architecture, and we will need a database and a connection: - >>> import cgi - >>> from pprint import pprint - >>> from zope.interface import implements - >>> from zope.app.testing import ztapi - - >>> from ZODB.tests.util import DB - >>> db = DB() - >>> conn = db.open() - >>> root = conn.root() + >>> import cgi + >>> from pprint import pprint + >>> from zope.interface import implements + >>> from zope.app.testing import ztapi + + >>> from ZODB.tests.util import DB + >>> db = DB() + >>> conn = db.open() + >>> root = conn.root() Imagine that our application is an oracle: you can teach it to react to phrases. Let's keep it simple and store the data in a dict: - >>> root['answers'] = {'Hello': 'Hi & how do you do?', - ... 'Meaning of life?': '42', - ... 'four < ?': 'four < five'} - >>> import transaction - >>> transaction.commit() + >>> root['answers'] = {'Hello': 'Hi & how do you do?', + ... 'Meaning of life?': '42', + ... 'four < ?': 'four < five'} + >>> import transaction + >>> transaction.commit() Initial setup @@ -65,10 +65,10 @@ because it uses Python modules to manage generations. For now, it will be just fine, since we don't want it to do anything just yet. - >>> from zope.app.generations.interfaces import ISchemaManager - >>> from zope.app.generations.generations import SchemaManager - >>> dummy_manager = SchemaManager(minimum_generation=0, generation=0) - >>> ztapi.provideUtility(ISchemaManager, dummy_manager, name='some.app') + >>> from zope.app.generations.interfaces import ISchemaManager + >>> from zope.app.generations.generations import SchemaManager + >>> dummy_manager = SchemaManager(minimum_generation=0, generation=0) + >>> ztapi.provideUtility(ISchemaManager, dummy_manager, name='some.app') 'some.app' is a unique identifier. You should use a URI or the dotted name of your package. @@ -78,21 +78,21 @@ evolveMinimumSubscriber by default as a handler for this event. Let's simulate this: - >>> class DatabaseOpenedEventStub(object): - ... def __init__(self, database): - ... self.database = database - >>> event = DatabaseOpenedEventStub(db) + >>> class DatabaseOpenedEventStub(object): + ... def __init__(self, database): + ... self.database = database + >>> event = DatabaseOpenedEventStub(db) - >>> from zope.app.generations.generations import evolveMinimumSubscriber - >>> evolveMinimumSubscriber(event) + >>> from zope.app.generations.generations import evolveMinimumSubscriber + >>> evolveMinimumSubscriber(event) The consequence of this action is that now the database contains the fact that our current schema number is 0. When we update the schema, Zope3 will have an idea of what the starting point was. Here, see? - >>> from zope.app.generations.generations import generations_key - >>> root[generations_key]['some.app'] - 0 + >>> from zope.app.generations.generations import generations_key + >>> root[generations_key]['some.app'] + 0 In real life you should never have to bother with this key directly, but you should be aware that it exists. @@ -109,31 +109,31 @@ Let's update the schema manager (drop the old one and install a new custom one): - >>> ztapi.unprovideUtility(ISchemaManager, name='some.app') + >>> ztapi.unprovideUtility(ISchemaManager, name='some.app') - >>> class MySchemaManager(object): - ... implements(ISchemaManager) - ... - ... minimum_generation = 1 - ... generation = 2 - ... - ... def evolve(self, context, generation): - ... root = context.connection.root() - ... answers = root['answers'] - ... if generation == 1: - ... for question, answer in answers.items(): - ... answers[question] = cgi.escape(answer) - ... elif generation == 2: - ... for question, answer in answers.items(): - ... del answers[question] - ... answers[cgi.escape(question)] = answer - ... else: - ... raise ValueError("Bummer") - ... root['answers'] = answers # ping persistence - ... transaction.commit() + >>> class MySchemaManager(object): + ... implements(ISchemaManager) + ... + ... minimum_generation = 1 + ... generation = 2 + ... + ... def evolve(self, context, generation): + ... root = context.connection.root() + ... answers = root['answers'] + ... if generation == 1: + ... for question, answer in answers.items(): + ... answers[question] = cgi.escape(answer) + ... elif generation == 2: + ... for question, answer in answers.items(): + ... del answers[question] + ... answers[cgi.escape(question)] = answer + ... else: + ... raise ValueError("Bummer") + ... root['answers'] = answers # ping persistence + ... transaction.commit() - >>> manager = MySchemaManager() - >>> ztapi.provideUtility(ISchemaManager, manager, name='some.app') + >>> manager = MySchemaManager() + >>> ztapi.provideUtility(ISchemaManager, manager, name='some.app') We have set `minimum_generation` to 1. That means that our application will refuse to run with a database older than generation 1. The `generation` @@ -168,36 +168,36 @@ So, our furious client downloads our latest code and restarts Zope. The event is automatically sent again: - >>> event = DatabaseOpenedEventStub(db) - >>> evolveMinimumSubscriber(event) + >>> event = DatabaseOpenedEventStub(db) + >>> evolveMinimumSubscriber(event) Shazam! The client is happy again! - >>> pprint(root['answers']) - {'Hello': 'Hi & how do you do?', - 'Meaning of life?': '42', - 'four < ?': 'four < five'} + >>> pprint(root['answers']) + {'Hello': 'Hi & how do you do?', + 'Meaning of life?': '42', + 'four < ?': 'four < five'} Because evolveMinimumSubscriber is very lazy, it only updates the database just enough so that your application can use it (to the `minimum_generation`, that is). Indeed, the marker indicates that the database generation has been bumped to 1: - >>> root[generations_key]['some.app'] - 1 + >>> root[generations_key]['some.app'] + 1 We see that generations are working, so we decide to take the next step and evolve to generation 2. Let's see how this can be done manually: - >>> from zope.app.generations.generations import evolve - >>> evolve(db) + >>> from zope.app.generations.generations import evolve + >>> evolve(db) - >>> pprint(root['answers']) - {'Hello': 'Hi & how do you do?', - 'Meaning of life?': '42', - 'four < ?': 'four < five'} - >>> root[generations_key]['some.app'] - 2 + >>> pprint(root['answers']) + {'Hello': 'Hi & how do you do?', + 'Meaning of life?': '42', + 'four < ?': 'four < five'} + >>> root[generations_key]['some.app'] + 2 Default behaviour of `evolve` upgrades to the latest generation provided by the SchemaManager. You can use the `how` argument to evolve() when you want @@ -219,13 +219,13 @@ manager utilities. The schema managers are run in the order determined by sorting their names. - >>> manager1 = SchemaManager(minimum_generation=0, generation=0) - >>> manager2 = SchemaManager(minimum_generation=0, generation=0) + >>> manager1 = SchemaManager(minimum_generation=0, generation=0) + >>> manager2 = SchemaManager(minimum_generation=0, generation=0) - >>> ztapi.provideUtility( - ... ISchemaManager, manager1, name='another.app') - >>> ztapi.provideUtility( - ... ISchemaManager, manager2, name='another.app-extension') + >>> ztapi.provideUtility( + ... ISchemaManager, manager1, name='another.app') + >>> ztapi.provideUtility( + ... ISchemaManager, manager2, name='another.app-extension') Notice how the name of the first package is used to create a namespace for dependent packages. This is not a requirement of the framework, @@ -233,13 +233,13 @@ Let's evolve the database to establish these generations: - >>> event = DatabaseOpenedEventStub(db) - >>> evolveMinimumSubscriber(event) + >>> event = DatabaseOpenedEventStub(db) + >>> evolveMinimumSubscriber(event) - >>> root[generations_key]['another.app'] - 0 - >>> root[generations_key]['another.app-extension'] - 0 + >>> root[generations_key]['another.app'] + 0 + >>> root[generations_key]['another.app-extension'] + 0 Let's assume that for some reason each of these subsystems needs to add a generation, and that generation 1 of 'another.app-extension' @@ -247,61 +247,61 @@ schema managers for each that record that they've been run so we can verify the result: - >>> ztapi.unprovideUtility(ISchemaManager, name='another.app') - >>> ztapi.unprovideUtility(ISchemaManager, name='another.app-extension') + >>> ztapi.unprovideUtility(ISchemaManager, name='another.app') + >>> ztapi.unprovideUtility(ISchemaManager, name='another.app-extension') - >>> class FoundationSchemaManager(object): - ... implements(ISchemaManager) - ... - ... minimum_generation = 1 - ... generation = 1 - ... - ... def evolve(self, context, generation): - ... root = context.connection.root() - ... ordering = root.get('ordering', []) - ... if generation == 1: - ... ordering.append('foundation 1') - ... print 'foundation generation 1' - ... else: - ... raise ValueError("Bummer") - ... root['ordering'] = ordering # ping persistence - ... transaction.commit() - - >>> class DependentSchemaManager(object): - ... implements(ISchemaManager) - ... - ... minimum_generation = 1 - ... generation = 1 - ... - ... def evolve(self, context, generation): - ... root = context.connection.root() - ... ordering = root.get('ordering', []) - ... if generation == 1: - ... ordering.append('dependent 1') - ... print 'dependent generation 1' - ... else: - ... raise ValueError("Bummer") - ... root['ordering'] = ordering # ping persistence - ... transaction.commit() - - >>> manager1 = FoundationSchemaManager() - >>> manager2 = DependentSchemaManager() - - >>> ztapi.provideUtility( - ... ISchemaManager, manager1, name='another.app') - >>> ztapi.provideUtility( - ... ISchemaManager, manager2, name='another.app-extension') + >>> class FoundationSchemaManager(object): + ... implements(ISchemaManager) + ... + ... minimum_generation = 1 + ... generation = 1 + ... + ... def evolve(self, context, generation): + ... root = context.connection.root() + ... ordering = root.get('ordering', []) + ... if generation == 1: + ... ordering.append('foundation 1') + ... print 'foundation generation 1' + ... else: + ... raise ValueError("Bummer") + ... root['ordering'] = ordering # ping persistence + ... transaction.commit() + + >>> class DependentSchemaManager(object): + ... implements(ISchemaManager) + ... + ... minimum_generation = 1 + ... generation = 1 + ... + ... def evolve(self, context, generation): + ... root = context.connection.root() + ... ordering = root.get('ordering', []) + ... if generation == 1: + ... ordering.append('dependent 1') + ... print 'dependent generation 1' + ... else: + ... raise ValueError("Bummer") + ... root['ordering'] = ordering # ping persistence + ... transaction.commit() + + >>> manager1 = FoundationSchemaManager() + >>> manager2 = DependentSchemaManager() + + >>> ztapi.provideUtility( + ... ISchemaManager, manager1, name='another.app') + >>> ztapi.provideUtility( + ... ISchemaManager, manager2, name='another.app-extension') Evolving the database now will always run the 'another.app' evolver before the 'another.app-extension' evolver: - >>> event = DatabaseOpenedEventStub(db) - >>> evolveMinimumSubscriber(event) - foundation generation 1 - dependent generation 1 + >>> event = DatabaseOpenedEventStub(db) + >>> evolveMinimumSubscriber(event) + foundation generation 1 + dependent generation 1 - >>> root['ordering'] - ['foundation 1', 'dependent 1'] + >>> root['ordering'] + ['foundation 1', 'dependent 1'] Installation @@ -318,86 +318,93 @@ Let's define a new schema manager that includes installation: - >>> ztapi.unprovideUtility(ISchemaManager, name='some.app') + >>> ztapi.unprovideUtility(ISchemaManager, name='some.app') - >>> from zope.app.generations.interfaces import IInstallableSchemaManager - >>> class MySchemaManager(object): - ... implements(IInstallableSchemaManager) - ... - ... minimum_generation = 1 - ... generation = 2 - ... - ... def install(self, context): - ... root = context.connection.root() - ... root['answers'] = {'Hello': 'Hi & how do you do?', - ... 'Meaning of life?': '42', - ... 'four < ?': 'four < five'} - ... transaction.commit() - ... - ... def evolve(self, context, generation): - ... root = context.connection.root() - ... answers = root['answers'] - ... if generation == 1: - ... for question, answer in answers.items(): - ... answers[question] = cgi.escape(answer) - ... elif generation == 2: - ... for question, answer in answers.items(): - ... del answers[question] - ... answers[cgi.escape(question)] = answer - ... else: - ... raise ValueError("Bummer") - ... root['answers'] = answers # ping persistence - ... transaction.commit() + >>> from zope.app.generations.interfaces import IInstallableSchemaManager + >>> class MySchemaManager(object): + ... implements(IInstallableSchemaManager) + ... + ... minimum_generation = 1 + ... generation = 2 + ... + ... def install(self, context): + ... root = context.connection.root() + ... root['answers'] = {'Hello': 'Hi & how do you do?', + ... 'Meaning of life?': '42', + ... 'four < ?': 'four < five'} + ... transaction.commit() + ... + ... def evolve(self, context, generation): + ... root = context.connection.root() + ... answers = root['answers'] + ... if generation == 1: + ... for question, answer in answers.items(): + ... answers[question] = cgi.escape(answer) + ... elif generation == 2: + ... for question, answer in answers.items(): + ... del answers[question] + ... answers[cgi.escape(question)] = answer + ... else: + ... raise ValueError("Bummer") + ... root['answers'] = answers # ping persistence + ... transaction.commit() - >>> manager = MySchemaManager() - >>> ztapi.provideUtility(ISchemaManager, manager, name='some.app') + >>> manager = MySchemaManager() + >>> ztapi.provideUtility(ISchemaManager, manager, name='some.app') Now, lets open a new database: - >>> db.close() - >>> db = DB() - >>> conn = db.open() - >>> 'answers' in conn.root() - False - - - >>> event = DatabaseOpenedEventStub(db) - >>> evolveMinimumSubscriber(event) - - >>> conn.sync() - >>> root = conn.root() - - >>> pprint(root['answers']) - {'Hello': 'Hi & how do you do?', - 'Meaning of life?': '42', - 'four < ?': 'four < five'} - >>> root[generations_key]['some.app'] - 2 + >>> db.close() + >>> db = DB() + >>> conn = db.open() + >>> 'answers' in conn.root() + False + + + >>> event = DatabaseOpenedEventStub(db) + >>> evolveMinimumSubscriber(event) + + >>> conn.sync() + >>> root = conn.root() + + >>> pprint(root['answers']) + {'Hello': 'Hi & how do you do?', + 'Meaning of life?': '42', + 'four < ?': 'four < five'} + >>> root[generations_key]['some.app'] + 2 ======= CHANGES ======= + 3.6.1 (2012-01-23) + ------------------ + + - Replaced an undeclared test dependency on ``zope.app.authentication`` with + ``zope.password``. + + 3.6.0 (2010-09-17) ------------------ - ``zope.app.generations`` depended on ``zope.app.applicationcontrol`` but - did not declare it. Modernized dependecy to ``zope.applicationcontrol`` as - the needed interface has been moved there. + did not declare it. Modernized dependecy to ``zope.applicationcontrol`` as + the needed interface has been moved there. - Using python's ``doctest`` module instead of deprecated - ``zope.testing.doctest[unit]``. + ``zope.testing.doctest[unit]``. - Replaced a testing dependency on ``zope.app.securitypolicy`` with one on - ``zope.securitypolicy``. + ``zope.securitypolicy``. 3.5.1 (2010-01-08) ------------------ - Depend on new ``zope.processlifetime`` interfaces instead of using - BBB imports from ``zope.app.appsetup``. + BBB imports from ``zope.app.appsetup``. - Fix ftesting.zcml due to ``zope.securitypolicy`` update. @@ -407,7 +414,7 @@ ------------------ - Moved ``getRootFolder`` utility method from - ``zope.app.zopeappgenerations`` to ``zope.app.generations.utility``. + ``zope.app.zopeappgenerations`` to ``zope.app.generations.utility``. - Removed not necessary install dependency on ``zope.app.testing``. @@ -416,13 +423,13 @@ ------------------ - Provide more logging output for the various stages and actions of evolving a - database. + database. - Fixed bug: A failing last generation would allow starting an app server - without having evolved to the minimum generation. + without having evolved to the minimum generation. - Substitute zope.app.zapi by direct calls to its wrapped apis. See - bug 219302. + bug 219302. - Corrected author email and home page address. diff -Nru zope.app.generations-3.6.0/setup.py zope.app.generations-3.6.1/setup.py --- zope.app.generations-3.6.0/setup.py 2010-09-17 12:40:12.000000000 +0000 +++ zope.app.generations-3.6.1/setup.py 2012-01-23 16:57:24.000000000 +0000 @@ -1,6 +1,6 @@ ############################################################################## # -# Copyright (c) 2006 Zope Corporation and Contributors. +# Copyright (c) 2006 Zope Foundation and Contributors. # All Rights Reserved. # # This software is subject to the provisions of the Zope Public License, @@ -18,7 +18,7 @@ ############################################################################## """Setup for zope.app.generations package -$Id: setup.py 116511 2010-09-17 12:39:41Z icemac $ +$Id: setup.py 124147 2012-01-23 16:56:34Z menesis $ """ import os from setuptools import setup, find_packages @@ -27,7 +27,7 @@ return open(os.path.join(os.path.dirname(__file__), *rnames)).read() setup(name='zope.app.generations', - version='3.6.0', + version='3.6.1', author='Zope Corporation and Contributors', author_email='zope-dev@zope.org', description='Zope Application Schema Generations', @@ -62,6 +62,7 @@ 'zope.app.testing', 'zope.app.zcmlfiles', 'zope.login', + 'zope.password', 'zope.publisher >= 3.12', 'zope.securitypolicy', ]), diff -Nru zope.app.generations-3.6.0/src/zope/app/generations/browser/managerdetails.py zope.app.generations-3.6.1/src/zope/app/generations/browser/managerdetails.py --- zope.app.generations-3.6.0/src/zope/app/generations/browser/managerdetails.py 2010-09-17 12:40:11.000000000 +0000 +++ zope.app.generations-3.6.1/src/zope/app/generations/browser/managerdetails.py 2012-01-23 16:57:24.000000000 +0000 @@ -1,6 +1,6 @@ ############################################################################## # -# Copyright (c) 2004 Zope Corporation and Contributors. +# Copyright (c) 2004 Zope Foundation and Contributors. # All Rights Reserved. # # This software is subject to the provisions of the Zope Public License, @@ -13,7 +13,7 @@ ############################################################################## """Manager Details View -$Id: managerdetails.py 85608 2008-04-22 18:34:09Z lgs $ +$Id: managerdetails.py 124134 2012-01-23 15:20:44Z menesis $ """ __docformat__ = "reStructuredText" import zope.component diff -Nru zope.app.generations-3.6.0/src/zope/app/generations/browser/managers.py zope.app.generations-3.6.1/src/zope/app/generations/browser/managers.py --- zope.app.generations-3.6.0/src/zope/app/generations/browser/managers.py 2010-09-17 12:40:11.000000000 +0000 +++ zope.app.generations-3.6.1/src/zope/app/generations/browser/managers.py 2012-01-23 16:57:24.000000000 +0000 @@ -1,6 +1,6 @@ ############################################################################## # -# Copyright (c) 2004 Zope Corporation and Contributors. +# Copyright (c) 2004 Zope Foundation and Contributors. # All Rights Reserved. # # This software is subject to the provisions of the Zope Public License, @@ -13,7 +13,7 @@ ############################################################################## """UI for browsing database schema managers -$Id: managers.py 85608 2008-04-22 18:34:09Z lgs $ +$Id: managers.py 124134 2012-01-23 15:20:44Z menesis $ """ __docformat__ = 'restructuredtext' diff -Nru zope.app.generations-3.6.0/src/zope/app/generations/browser/tests.py zope.app.generations-3.6.1/src/zope/app/generations/browser/tests.py --- zope.app.generations-3.6.0/src/zope/app/generations/browser/tests.py 2010-09-17 12:40:11.000000000 +0000 +++ zope.app.generations-3.6.1/src/zope/app/generations/browser/tests.py 2012-01-23 16:57:24.000000000 +0000 @@ -1,6 +1,6 @@ ############################################################################## # -# Copyright (c) 2004 Zope Corporation and Contributors. +# Copyright (c) 2004 Zope Foundation and Contributors. # All Rights Reserved. # # This software is subject to the provisions of the Zope Public License, @@ -13,7 +13,7 @@ ############################################################################## """Generation-browser tests -$Id: tests.py 115808 2010-08-19 19:23:02Z icemac $ +$Id: tests.py 124134 2012-01-23 15:20:44Z menesis $ """ import unittest import doctest diff -Nru zope.app.generations-3.6.0/src/zope/app/generations/demo/evolve1.py zope.app.generations-3.6.1/src/zope/app/generations/demo/evolve1.py --- zope.app.generations-3.6.0/src/zope/app/generations/demo/evolve1.py 2010-09-17 12:40:11.000000000 +0000 +++ zope.app.generations-3.6.1/src/zope/app/generations/demo/evolve1.py 2012-01-23 16:57:24.000000000 +0000 @@ -1,6 +1,6 @@ ############################################################################## # -# Copyright (c) 2004 Zope Corporation and Contributors. +# Copyright (c) 2004 Zope Foundation and Contributors. # All Rights Reserved. # # This software is subject to the provisions of the Zope Public License, @@ -13,7 +13,7 @@ ############################################################################## """Silly demo evolution module -$Id: evolve1.py 28597 2004-12-09 17:52:40Z srichter $ +$Id: evolve1.py 124134 2012-01-23 15:20:44Z menesis $ """ __docformat__ = 'restructuredtext' diff -Nru zope.app.generations-3.6.0/src/zope/app/generations/demo/evolve2.py zope.app.generations-3.6.1/src/zope/app/generations/demo/evolve2.py --- zope.app.generations-3.6.0/src/zope/app/generations/demo/evolve2.py 2010-09-17 12:40:11.000000000 +0000 +++ zope.app.generations-3.6.1/src/zope/app/generations/demo/evolve2.py 2012-01-23 16:57:24.000000000 +0000 @@ -1,6 +1,6 @@ ############################################################################## # -# Copyright (c) 2004 Zope Corporation and Contributors. +# Copyright (c) 2004 Zope Foundation and Contributors. # All Rights Reserved. # # This software is subject to the provisions of the Zope Public License, @@ -13,7 +13,7 @@ ############################################################################## """Silly demo evolution module -$Id: evolve2.py 28597 2004-12-09 17:52:40Z srichter $ +$Id: evolve2.py 124134 2012-01-23 15:20:44Z menesis $ """ __docformat__ = 'restructuredtext' diff -Nru zope.app.generations-3.6.0/src/zope/app/generations/demo/evolve3.py zope.app.generations-3.6.1/src/zope/app/generations/demo/evolve3.py --- zope.app.generations-3.6.0/src/zope/app/generations/demo/evolve3.py 2010-09-17 12:40:11.000000000 +0000 +++ zope.app.generations-3.6.1/src/zope/app/generations/demo/evolve3.py 2012-01-23 16:57:24.000000000 +0000 @@ -1,6 +1,6 @@ ############################################################################## # -# Copyright (c) 2004 Zope Corporation and Contributors. +# Copyright (c) 2004 Zope Foundation and Contributors. # All Rights Reserved. # # This software is subject to the provisions of the Zope Public License, @@ -13,7 +13,7 @@ ############################################################################## """Silly demo evolution module -$Id: evolve3.py 26816 2004-07-28 19:09:51Z pruggera $ +$Id: evolve3.py 124134 2012-01-23 15:20:44Z menesis $ """ __docformat__ = 'restructuredtext' diff -Nru zope.app.generations-3.6.0/src/zope/app/generations/demo/__init__.py zope.app.generations-3.6.1/src/zope/app/generations/demo/__init__.py --- zope.app.generations-3.6.0/src/zope/app/generations/demo/__init__.py 2010-09-17 12:40:11.000000000 +0000 +++ zope.app.generations-3.6.1/src/zope/app/generations/demo/__init__.py 2012-01-23 16:57:24.000000000 +0000 @@ -1,6 +1,6 @@ ############################################################################## # -# Copyright (c) 2004 Zope Corporation and Contributors. +# Copyright (c) 2004 Zope Foundation and Contributors. # All Rights Reserved. # # This software is subject to the provisions of the Zope Public License, @@ -16,7 +16,7 @@ The evolution scripts in this package are pretty dumb. The just call the evolve function defined here with a generation number. -$Id: __init__.py 26816 2004-07-28 19:09:51Z pruggera $ +$Id: __init__.py 124134 2012-01-23 15:20:44Z menesis $ """ __docformat__ = 'restructuredtext' diff -Nru zope.app.generations-3.6.0/src/zope/app/generations/demo/install.py zope.app.generations-3.6.1/src/zope/app/generations/demo/install.py --- zope.app.generations-3.6.0/src/zope/app/generations/demo/install.py 2010-09-17 12:40:11.000000000 +0000 +++ zope.app.generations-3.6.1/src/zope/app/generations/demo/install.py 2012-01-23 16:57:24.000000000 +0000 @@ -1,6 +1,6 @@ ############################################################################## # -# Copyright (c) 2004 Zope Corporation and Contributors. +# Copyright (c) 2004 Zope Foundation and Contributors. # All Rights Reserved. # # This software is subject to the provisions of the Zope Public License, @@ -13,7 +13,7 @@ ############################################################################## """Silly demo evolution module -$Id: install.py 29216 2005-02-19 00:08:56Z jim $ +$Id: install.py 124134 2012-01-23 15:20:44Z menesis $ """ __docformat__ = 'restructuredtext' diff -Nru zope.app.generations-3.6.0/src/zope/app/generations/demo3/__init__.py zope.app.generations-3.6.1/src/zope/app/generations/demo3/__init__.py --- zope.app.generations-3.6.0/src/zope/app/generations/demo3/__init__.py 2010-09-17 12:40:11.000000000 +0000 +++ zope.app.generations-3.6.1/src/zope/app/generations/demo3/__init__.py 2012-01-23 16:57:24.000000000 +0000 @@ -1,6 +1,6 @@ ############################################################################## # -# Copyright (c) 2004 Zope Corporation and Contributors. +# Copyright (c) 2004 Zope Foundation and Contributors. # All Rights Reserved. # # This software is subject to the provisions of the Zope Public License, diff -Nru zope.app.generations-3.6.0/src/zope/app/generations/demo3/install.py zope.app.generations-3.6.1/src/zope/app/generations/demo3/install.py --- zope.app.generations-3.6.0/src/zope/app/generations/demo3/install.py 2010-09-17 12:40:11.000000000 +0000 +++ zope.app.generations-3.6.1/src/zope/app/generations/demo3/install.py 2012-01-23 16:57:24.000000000 +0000 @@ -1,6 +1,6 @@ ############################################################################## # -# Copyright (c) 2004 Zope Corporation and Contributors. +# Copyright (c) 2004 Zope Foundation and Contributors. # All Rights Reserved. # # This software is subject to the provisions of the Zope Public License, @@ -13,7 +13,7 @@ ############################################################################## """Silly demo evolution module -$Id: install.py 70826 2006-10-20 03:41:16Z baijum $ +$Id: install.py 124134 2012-01-23 15:20:44Z menesis $ """ __docformat__ = 'restructuredtext' diff -Nru zope.app.generations-3.6.0/src/zope/app/generations/ftesting.zcml zope.app.generations-3.6.1/src/zope/app/generations/ftesting.zcml --- zope.app.generations-3.6.0/src/zope/app/generations/ftesting.zcml 2010-09-17 12:40:12.000000000 +0000 +++ zope.app.generations-3.6.1/src/zope/app/generations/ftesting.zcml 2012-01-23 16:57:24.000000000 +0000 @@ -10,9 +10,9 @@ - + diff -Nru zope.app.generations-3.6.0/src/zope/app/generations/generations.py zope.app.generations-3.6.1/src/zope/app/generations/generations.py --- zope.app.generations-3.6.0/src/zope/app/generations/generations.py 2010-09-17 12:40:12.000000000 +0000 +++ zope.app.generations-3.6.1/src/zope/app/generations/generations.py 2012-01-23 16:57:24.000000000 +0000 @@ -1,6 +1,6 @@ ############################################################################## # -# Copyright (c) 2004 Zope Corporation and Contributors. +# Copyright (c) 2004 Zope Foundation and Contributors. # All Rights Reserved. # # This software is subject to the provisions of the Zope Public License, @@ -13,7 +13,7 @@ ############################################################################## """Experimental support for application database generations -$Id: generations.py 94908 2009-01-21 17:54:32Z fdrake $ +$Id: generations.py 124134 2012-01-23 15:20:44Z menesis $ """ __docformat__ = 'restructuredtext' diff -Nru zope.app.generations-3.6.0/src/zope/app/generations/__init__.py zope.app.generations-3.6.1/src/zope/app/generations/__init__.py --- zope.app.generations-3.6.0/src/zope/app/generations/__init__.py 2010-09-17 12:40:12.000000000 +0000 +++ zope.app.generations-3.6.1/src/zope/app/generations/__init__.py 2012-01-23 16:57:24.000000000 +0000 @@ -1,6 +1,6 @@ ############################################################################## # -# Copyright (c) 2004 Zope Corporation and Contributors. +# Copyright (c) 2004 Zope Foundation and Contributors. # All Rights Reserved. # # This software is subject to the provisions of the Zope Public License, @@ -13,5 +13,5 @@ ############################################################################## """Experimental support for application database generations -$Id: __init__.py 25177 2004-06-02 13:17:31Z jim $ +$Id: __init__.py 124134 2012-01-23 15:20:44Z menesis $ """ diff -Nru zope.app.generations-3.6.0/src/zope/app/generations/interfaces.py zope.app.generations-3.6.1/src/zope/app/generations/interfaces.py --- zope.app.generations-3.6.0/src/zope/app/generations/interfaces.py 2010-09-17 12:40:12.000000000 +0000 +++ zope.app.generations-3.6.1/src/zope/app/generations/interfaces.py 2012-01-23 16:57:24.000000000 +0000 @@ -1,6 +1,6 @@ ############################################################################## # -# Copyright (c) 2004 Zope Corporation and Contributors. +# Copyright (c) 2004 Zope Foundation and Contributors. # All Rights Reserved. # # This software is subject to the provisions of the Zope Public License, @@ -13,7 +13,7 @@ ############################################################################## """Interfaces for experimental support for application database generations -$Id: interfaces.py 78550 2007-08-02 19:38:20Z jim $ +$Id: interfaces.py 124134 2012-01-23 15:20:44Z menesis $ """ __docformat__ = 'restructuredtext' diff -Nru zope.app.generations-3.6.0/src/zope/app/generations/testing.py zope.app.generations-3.6.1/src/zope/app/generations/testing.py --- zope.app.generations-3.6.0/src/zope/app/generations/testing.py 2010-09-17 12:40:11.000000000 +0000 +++ zope.app.generations-3.6.1/src/zope/app/generations/testing.py 2012-01-23 16:57:24.000000000 +0000 @@ -1,6 +1,6 @@ ############################################################################## # -# Copyright (c) 2007 Zope Corporation and Contributors. +# Copyright (c) 2007 Zope Foundation and Contributors. # All Rights Reserved. # # This software is subject to the provisions of the Zope Public License, @@ -13,7 +13,7 @@ ############################################################################## """zope.app.generations common test related classes/functions/objects. -$Id: testing.py 116409 2010-09-14 14:49:52Z icemac $ +$Id: testing.py 124134 2012-01-23 15:20:44Z menesis $ """ __docformat__ = "reStructuredText" diff -Nru zope.app.generations-3.6.0/src/zope/app/generations/tests.py zope.app.generations-3.6.1/src/zope/app/generations/tests.py --- zope.app.generations-3.6.0/src/zope/app/generations/tests.py 2010-09-17 12:40:12.000000000 +0000 +++ zope.app.generations-3.6.1/src/zope/app/generations/tests.py 2012-01-23 16:57:24.000000000 +0000 @@ -1,6 +1,6 @@ ############################################################################## # -# Copyright (c) 2004 Zope Corporation and Contributors. +# Copyright (c) 2004 Zope Foundation and Contributors. # All Rights Reserved. # # This software is subject to the provisions of the Zope Public License, @@ -13,7 +13,7 @@ ############################################################################## """Schema-generation tests -$Id: tests.py 115808 2010-08-19 19:23:02Z icemac $ +$Id: tests.py 124134 2012-01-23 15:20:44Z menesis $ """ from zope.app.testing import placelesssetup diff -Nru zope.app.generations-3.6.0/src/zope/app/generations/utility.py zope.app.generations-3.6.1/src/zope/app/generations/utility.py --- zope.app.generations-3.6.0/src/zope/app/generations/utility.py 2010-09-17 12:40:12.000000000 +0000 +++ zope.app.generations-3.6.1/src/zope/app/generations/utility.py 2012-01-23 16:57:24.000000000 +0000 @@ -1,6 +1,6 @@ ############################################################################## # -# Copyright (c) 2004 Zope Corporation and Contributors. +# Copyright (c) 2004 Zope Foundation and Contributors. # All Rights Reserved. # # This software is subject to the provisions of the Zope Public License, @@ -13,7 +13,7 @@ ############################################################################## """Utility functions for evolving database generations. -$Id: utility.py 98884 2009-04-05 19:17:58Z icemac $ +$Id: utility.py 124134 2012-01-23 15:20:44Z menesis $ """ __docformat__ = "reStructuredText" diff -Nru zope.app.generations-3.6.0/src/zope.app.generations.egg-info/PKG-INFO zope.app.generations-3.6.1/src/zope.app.generations.egg-info/PKG-INFO --- zope.app.generations-3.6.0/src/zope.app.generations.egg-info/PKG-INFO 2010-09-17 12:40:14.000000000 +0000 +++ zope.app.generations-3.6.1/src/zope.app.generations.egg-info/PKG-INFO 2012-01-23 16:57:27.000000000 +0000 @@ -1,6 +1,6 @@ -Metadata-Version: 1.0 +Metadata-Version: 1.1 Name: zope.app.generations -Version: 3.6.0 +Version: 3.6.1 Summary: Zope Application Schema Generations Home-page: http://pypi.python.org/pypi/zope.app.generations Author: Zope Corporation and Contributors @@ -33,24 +33,24 @@ We will be using the component architecture, and we will need a database and a connection: - >>> import cgi - >>> from pprint import pprint - >>> from zope.interface import implements - >>> from zope.app.testing import ztapi - - >>> from ZODB.tests.util import DB - >>> db = DB() - >>> conn = db.open() - >>> root = conn.root() + >>> import cgi + >>> from pprint import pprint + >>> from zope.interface import implements + >>> from zope.app.testing import ztapi + + >>> from ZODB.tests.util import DB + >>> db = DB() + >>> conn = db.open() + >>> root = conn.root() Imagine that our application is an oracle: you can teach it to react to phrases. Let's keep it simple and store the data in a dict: - >>> root['answers'] = {'Hello': 'Hi & how do you do?', - ... 'Meaning of life?': '42', - ... 'four < ?': 'four < five'} - >>> import transaction - >>> transaction.commit() + >>> root['answers'] = {'Hello': 'Hi & how do you do?', + ... 'Meaning of life?': '42', + ... 'four < ?': 'four < five'} + >>> import transaction + >>> transaction.commit() Initial setup @@ -65,10 +65,10 @@ because it uses Python modules to manage generations. For now, it will be just fine, since we don't want it to do anything just yet. - >>> from zope.app.generations.interfaces import ISchemaManager - >>> from zope.app.generations.generations import SchemaManager - >>> dummy_manager = SchemaManager(minimum_generation=0, generation=0) - >>> ztapi.provideUtility(ISchemaManager, dummy_manager, name='some.app') + >>> from zope.app.generations.interfaces import ISchemaManager + >>> from zope.app.generations.generations import SchemaManager + >>> dummy_manager = SchemaManager(minimum_generation=0, generation=0) + >>> ztapi.provideUtility(ISchemaManager, dummy_manager, name='some.app') 'some.app' is a unique identifier. You should use a URI or the dotted name of your package. @@ -78,21 +78,21 @@ evolveMinimumSubscriber by default as a handler for this event. Let's simulate this: - >>> class DatabaseOpenedEventStub(object): - ... def __init__(self, database): - ... self.database = database - >>> event = DatabaseOpenedEventStub(db) + >>> class DatabaseOpenedEventStub(object): + ... def __init__(self, database): + ... self.database = database + >>> event = DatabaseOpenedEventStub(db) - >>> from zope.app.generations.generations import evolveMinimumSubscriber - >>> evolveMinimumSubscriber(event) + >>> from zope.app.generations.generations import evolveMinimumSubscriber + >>> evolveMinimumSubscriber(event) The consequence of this action is that now the database contains the fact that our current schema number is 0. When we update the schema, Zope3 will have an idea of what the starting point was. Here, see? - >>> from zope.app.generations.generations import generations_key - >>> root[generations_key]['some.app'] - 0 + >>> from zope.app.generations.generations import generations_key + >>> root[generations_key]['some.app'] + 0 In real life you should never have to bother with this key directly, but you should be aware that it exists. @@ -109,31 +109,31 @@ Let's update the schema manager (drop the old one and install a new custom one): - >>> ztapi.unprovideUtility(ISchemaManager, name='some.app') + >>> ztapi.unprovideUtility(ISchemaManager, name='some.app') - >>> class MySchemaManager(object): - ... implements(ISchemaManager) - ... - ... minimum_generation = 1 - ... generation = 2 - ... - ... def evolve(self, context, generation): - ... root = context.connection.root() - ... answers = root['answers'] - ... if generation == 1: - ... for question, answer in answers.items(): - ... answers[question] = cgi.escape(answer) - ... elif generation == 2: - ... for question, answer in answers.items(): - ... del answers[question] - ... answers[cgi.escape(question)] = answer - ... else: - ... raise ValueError("Bummer") - ... root['answers'] = answers # ping persistence - ... transaction.commit() + >>> class MySchemaManager(object): + ... implements(ISchemaManager) + ... + ... minimum_generation = 1 + ... generation = 2 + ... + ... def evolve(self, context, generation): + ... root = context.connection.root() + ... answers = root['answers'] + ... if generation == 1: + ... for question, answer in answers.items(): + ... answers[question] = cgi.escape(answer) + ... elif generation == 2: + ... for question, answer in answers.items(): + ... del answers[question] + ... answers[cgi.escape(question)] = answer + ... else: + ... raise ValueError("Bummer") + ... root['answers'] = answers # ping persistence + ... transaction.commit() - >>> manager = MySchemaManager() - >>> ztapi.provideUtility(ISchemaManager, manager, name='some.app') + >>> manager = MySchemaManager() + >>> ztapi.provideUtility(ISchemaManager, manager, name='some.app') We have set `minimum_generation` to 1. That means that our application will refuse to run with a database older than generation 1. The `generation` @@ -168,36 +168,36 @@ So, our furious client downloads our latest code and restarts Zope. The event is automatically sent again: - >>> event = DatabaseOpenedEventStub(db) - >>> evolveMinimumSubscriber(event) + >>> event = DatabaseOpenedEventStub(db) + >>> evolveMinimumSubscriber(event) Shazam! The client is happy again! - >>> pprint(root['answers']) - {'Hello': 'Hi & how do you do?', - 'Meaning of life?': '42', - 'four < ?': 'four < five'} + >>> pprint(root['answers']) + {'Hello': 'Hi & how do you do?', + 'Meaning of life?': '42', + 'four < ?': 'four < five'} Because evolveMinimumSubscriber is very lazy, it only updates the database just enough so that your application can use it (to the `minimum_generation`, that is). Indeed, the marker indicates that the database generation has been bumped to 1: - >>> root[generations_key]['some.app'] - 1 + >>> root[generations_key]['some.app'] + 1 We see that generations are working, so we decide to take the next step and evolve to generation 2. Let's see how this can be done manually: - >>> from zope.app.generations.generations import evolve - >>> evolve(db) + >>> from zope.app.generations.generations import evolve + >>> evolve(db) - >>> pprint(root['answers']) - {'Hello': 'Hi & how do you do?', - 'Meaning of life?': '42', - 'four < ?': 'four < five'} - >>> root[generations_key]['some.app'] - 2 + >>> pprint(root['answers']) + {'Hello': 'Hi & how do you do?', + 'Meaning of life?': '42', + 'four < ?': 'four < five'} + >>> root[generations_key]['some.app'] + 2 Default behaviour of `evolve` upgrades to the latest generation provided by the SchemaManager. You can use the `how` argument to evolve() when you want @@ -219,13 +219,13 @@ manager utilities. The schema managers are run in the order determined by sorting their names. - >>> manager1 = SchemaManager(minimum_generation=0, generation=0) - >>> manager2 = SchemaManager(minimum_generation=0, generation=0) + >>> manager1 = SchemaManager(minimum_generation=0, generation=0) + >>> manager2 = SchemaManager(minimum_generation=0, generation=0) - >>> ztapi.provideUtility( - ... ISchemaManager, manager1, name='another.app') - >>> ztapi.provideUtility( - ... ISchemaManager, manager2, name='another.app-extension') + >>> ztapi.provideUtility( + ... ISchemaManager, manager1, name='another.app') + >>> ztapi.provideUtility( + ... ISchemaManager, manager2, name='another.app-extension') Notice how the name of the first package is used to create a namespace for dependent packages. This is not a requirement of the framework, @@ -233,13 +233,13 @@ Let's evolve the database to establish these generations: - >>> event = DatabaseOpenedEventStub(db) - >>> evolveMinimumSubscriber(event) + >>> event = DatabaseOpenedEventStub(db) + >>> evolveMinimumSubscriber(event) - >>> root[generations_key]['another.app'] - 0 - >>> root[generations_key]['another.app-extension'] - 0 + >>> root[generations_key]['another.app'] + 0 + >>> root[generations_key]['another.app-extension'] + 0 Let's assume that for some reason each of these subsystems needs to add a generation, and that generation 1 of 'another.app-extension' @@ -247,61 +247,61 @@ schema managers for each that record that they've been run so we can verify the result: - >>> ztapi.unprovideUtility(ISchemaManager, name='another.app') - >>> ztapi.unprovideUtility(ISchemaManager, name='another.app-extension') + >>> ztapi.unprovideUtility(ISchemaManager, name='another.app') + >>> ztapi.unprovideUtility(ISchemaManager, name='another.app-extension') - >>> class FoundationSchemaManager(object): - ... implements(ISchemaManager) - ... - ... minimum_generation = 1 - ... generation = 1 - ... - ... def evolve(self, context, generation): - ... root = context.connection.root() - ... ordering = root.get('ordering', []) - ... if generation == 1: - ... ordering.append('foundation 1') - ... print 'foundation generation 1' - ... else: - ... raise ValueError("Bummer") - ... root['ordering'] = ordering # ping persistence - ... transaction.commit() - - >>> class DependentSchemaManager(object): - ... implements(ISchemaManager) - ... - ... minimum_generation = 1 - ... generation = 1 - ... - ... def evolve(self, context, generation): - ... root = context.connection.root() - ... ordering = root.get('ordering', []) - ... if generation == 1: - ... ordering.append('dependent 1') - ... print 'dependent generation 1' - ... else: - ... raise ValueError("Bummer") - ... root['ordering'] = ordering # ping persistence - ... transaction.commit() - - >>> manager1 = FoundationSchemaManager() - >>> manager2 = DependentSchemaManager() - - >>> ztapi.provideUtility( - ... ISchemaManager, manager1, name='another.app') - >>> ztapi.provideUtility( - ... ISchemaManager, manager2, name='another.app-extension') + >>> class FoundationSchemaManager(object): + ... implements(ISchemaManager) + ... + ... minimum_generation = 1 + ... generation = 1 + ... + ... def evolve(self, context, generation): + ... root = context.connection.root() + ... ordering = root.get('ordering', []) + ... if generation == 1: + ... ordering.append('foundation 1') + ... print 'foundation generation 1' + ... else: + ... raise ValueError("Bummer") + ... root['ordering'] = ordering # ping persistence + ... transaction.commit() + + >>> class DependentSchemaManager(object): + ... implements(ISchemaManager) + ... + ... minimum_generation = 1 + ... generation = 1 + ... + ... def evolve(self, context, generation): + ... root = context.connection.root() + ... ordering = root.get('ordering', []) + ... if generation == 1: + ... ordering.append('dependent 1') + ... print 'dependent generation 1' + ... else: + ... raise ValueError("Bummer") + ... root['ordering'] = ordering # ping persistence + ... transaction.commit() + + >>> manager1 = FoundationSchemaManager() + >>> manager2 = DependentSchemaManager() + + >>> ztapi.provideUtility( + ... ISchemaManager, manager1, name='another.app') + >>> ztapi.provideUtility( + ... ISchemaManager, manager2, name='another.app-extension') Evolving the database now will always run the 'another.app' evolver before the 'another.app-extension' evolver: - >>> event = DatabaseOpenedEventStub(db) - >>> evolveMinimumSubscriber(event) - foundation generation 1 - dependent generation 1 + >>> event = DatabaseOpenedEventStub(db) + >>> evolveMinimumSubscriber(event) + foundation generation 1 + dependent generation 1 - >>> root['ordering'] - ['foundation 1', 'dependent 1'] + >>> root['ordering'] + ['foundation 1', 'dependent 1'] Installation @@ -318,86 +318,93 @@ Let's define a new schema manager that includes installation: - >>> ztapi.unprovideUtility(ISchemaManager, name='some.app') + >>> ztapi.unprovideUtility(ISchemaManager, name='some.app') - >>> from zope.app.generations.interfaces import IInstallableSchemaManager - >>> class MySchemaManager(object): - ... implements(IInstallableSchemaManager) - ... - ... minimum_generation = 1 - ... generation = 2 - ... - ... def install(self, context): - ... root = context.connection.root() - ... root['answers'] = {'Hello': 'Hi & how do you do?', - ... 'Meaning of life?': '42', - ... 'four < ?': 'four < five'} - ... transaction.commit() - ... - ... def evolve(self, context, generation): - ... root = context.connection.root() - ... answers = root['answers'] - ... if generation == 1: - ... for question, answer in answers.items(): - ... answers[question] = cgi.escape(answer) - ... elif generation == 2: - ... for question, answer in answers.items(): - ... del answers[question] - ... answers[cgi.escape(question)] = answer - ... else: - ... raise ValueError("Bummer") - ... root['answers'] = answers # ping persistence - ... transaction.commit() + >>> from zope.app.generations.interfaces import IInstallableSchemaManager + >>> class MySchemaManager(object): + ... implements(IInstallableSchemaManager) + ... + ... minimum_generation = 1 + ... generation = 2 + ... + ... def install(self, context): + ... root = context.connection.root() + ... root['answers'] = {'Hello': 'Hi & how do you do?', + ... 'Meaning of life?': '42', + ... 'four < ?': 'four < five'} + ... transaction.commit() + ... + ... def evolve(self, context, generation): + ... root = context.connection.root() + ... answers = root['answers'] + ... if generation == 1: + ... for question, answer in answers.items(): + ... answers[question] = cgi.escape(answer) + ... elif generation == 2: + ... for question, answer in answers.items(): + ... del answers[question] + ... answers[cgi.escape(question)] = answer + ... else: + ... raise ValueError("Bummer") + ... root['answers'] = answers # ping persistence + ... transaction.commit() - >>> manager = MySchemaManager() - >>> ztapi.provideUtility(ISchemaManager, manager, name='some.app') + >>> manager = MySchemaManager() + >>> ztapi.provideUtility(ISchemaManager, manager, name='some.app') Now, lets open a new database: - >>> db.close() - >>> db = DB() - >>> conn = db.open() - >>> 'answers' in conn.root() - False - - - >>> event = DatabaseOpenedEventStub(db) - >>> evolveMinimumSubscriber(event) - - >>> conn.sync() - >>> root = conn.root() - - >>> pprint(root['answers']) - {'Hello': 'Hi & how do you do?', - 'Meaning of life?': '42', - 'four < ?': 'four < five'} - >>> root[generations_key]['some.app'] - 2 + >>> db.close() + >>> db = DB() + >>> conn = db.open() + >>> 'answers' in conn.root() + False + + + >>> event = DatabaseOpenedEventStub(db) + >>> evolveMinimumSubscriber(event) + + >>> conn.sync() + >>> root = conn.root() + + >>> pprint(root['answers']) + {'Hello': 'Hi & how do you do?', + 'Meaning of life?': '42', + 'four < ?': 'four < five'} + >>> root[generations_key]['some.app'] + 2 ======= CHANGES ======= + 3.6.1 (2012-01-23) + ------------------ + + - Replaced an undeclared test dependency on ``zope.app.authentication`` with + ``zope.password``. + + 3.6.0 (2010-09-17) ------------------ - ``zope.app.generations`` depended on ``zope.app.applicationcontrol`` but - did not declare it. Modernized dependecy to ``zope.applicationcontrol`` as - the needed interface has been moved there. + did not declare it. Modernized dependecy to ``zope.applicationcontrol`` as + the needed interface has been moved there. - Using python's ``doctest`` module instead of deprecated - ``zope.testing.doctest[unit]``. + ``zope.testing.doctest[unit]``. - Replaced a testing dependency on ``zope.app.securitypolicy`` with one on - ``zope.securitypolicy``. + ``zope.securitypolicy``. 3.5.1 (2010-01-08) ------------------ - Depend on new ``zope.processlifetime`` interfaces instead of using - BBB imports from ``zope.app.appsetup``. + BBB imports from ``zope.app.appsetup``. - Fix ftesting.zcml due to ``zope.securitypolicy`` update. @@ -407,7 +414,7 @@ ------------------ - Moved ``getRootFolder`` utility method from - ``zope.app.zopeappgenerations`` to ``zope.app.generations.utility``. + ``zope.app.zopeappgenerations`` to ``zope.app.generations.utility``. - Removed not necessary install dependency on ``zope.app.testing``. @@ -416,13 +423,13 @@ ------------------ - Provide more logging output for the various stages and actions of evolving a - database. + database. - Fixed bug: A failing last generation would allow starting an app server - without having evolved to the minimum generation. + without having evolved to the minimum generation. - Substitute zope.app.zapi by direct calls to its wrapped apis. See - bug 219302. + bug 219302. - Corrected author email and home page address. diff -Nru zope.app.generations-3.6.0/src/zope.app.generations.egg-info/requires.txt zope.app.generations-3.6.1/src/zope.app.generations.egg-info/requires.txt --- zope.app.generations-3.6.0/src/zope.app.generations.egg-info/requires.txt 2010-09-17 12:40:14.000000000 +0000 +++ zope.app.generations-3.6.1/src/zope.app.generations.egg-info/requires.txt 2012-01-23 16:57:27.000000000 +0000 @@ -10,5 +10,6 @@ zope.app.testing zope.app.zcmlfiles zope.login +zope.password zope.publisher >= 3.12 zope.securitypolicy \ No newline at end of file diff -Nru zope.app.generations-3.6.0/src/zope.app.generations.egg-info/SOURCES.txt zope.app.generations-3.6.1/src/zope.app.generations.egg-info/SOURCES.txt --- zope.app.generations-3.6.0/src/zope.app.generations.egg-info/SOURCES.txt 2010-09-17 12:40:14.000000000 +0000 +++ zope.app.generations-3.6.1/src/zope.app.generations.egg-info/SOURCES.txt 2012-01-23 16:57:27.000000000 +0000 @@ -1,4 +1,6 @@ CHANGES.txt +COPYRIGHT.txt +LICENSE.txt README.txt bootstrap.py buildout.cfg