/usr/share/pyshared/zope/app/generations/interfaces.py is in python-zope.app.generations 3.6.1-0ubuntu1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 | ##############################################################################
#
# Copyright (c) 2004 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.
#
##############################################################################
"""Interfaces for experimental support for application database generations
$Id: interfaces.py 124134 2012-01-23 15:20:44Z menesis $
"""
__docformat__ = 'restructuredtext'
import zope.interface
class GenerationError(Exception):
"""A database generation is invalid
"""
class GenerationTooHigh(GenerationError):
"""A database generation is higher than an application generation
"""
class GenerationTooLow(GenerationError):
"""A database generation is lower than an application minimum generation
"""
class UnableToEvolve(GenerationError):
"""A database can't evolve to an application minimum generation
"""
class ISchemaManager(zope.interface.Interface):
"""Manage schema evolution for an application."""
minimum_generation = zope.interface.Attribute(
"Minimum supported schema generation")
generation = zope.interface.Attribute(
"Current schema generation")
def evolve(context, generation):
"""Evolve a database to the given schema generation.
The database should be assumed to be at the schema
generation one less than the given `generation`
argument. In other words, the `evolve` method is only
required to make one evolutionary step.
The `context` argument has a connection attribute,
providing a database connection to be used to change
the database. A `context` argument is passed rather than
a connection to make it possible to provide additional
information later, if it becomes necessary.
This method should *not* commit a transaction. The
transaction will be committed by the caller if there is no
error. It is acceptable to commit a transaction if there are no
subsequent operations. The method may create savepoints.
"""
def getInfo(generation):
"""Return an information string about the evolution that is used to
upgrade to the specified generation.
If no information is available, `None` should be returned.
"""
class IInstallableSchemaManager(ISchemaManager):
"""Manage schema evolution for an application, including installation."""
def install(context):
"""Perform any initial installation tasks
The application has never had the application installed
before. The schema manager should bring the database to the
current generation.
This method should *not* commit a transaction. The
transaction will be committed by the caller if there is no
error. It is acceptable to commit a transaction if there are no
subsequent operations. The method may create savepoints.
"""
|