package
stringlengths 1
122
| pacakge-description
stringlengths 0
1.3M
|
---|---|
zope.app.undo | This package implements transaction undo capabilities in Zope 3 applications
and specifically the Zope 3 ZMI.CHANGES3.5.0 (2009-02-01)Adjusted tests so that basic objects and interfaces are pulled fromzope.siteandzope.locationrather thanzope.app.component.3.4.0 (2007-10-27)Initial release independent of the main Zope tree. |
zope.app.versioncontrol | This package provides a framework for managing multiple versions of objects
within a ZODB database.Detailed DocumentationCHANGESVersion 0.1 (2009-07-24)Initial Release as an egg. |
zope.app.wfmc | This package provides Zope application level integration of thezope.wfmcpackage including ZCML directives.Detailed DocumentationLoading XPDLXPDL can be loaded in zcml files with thexpdltag:>>> import os
>>> file_name = os.path.join(this_directory, 'publication.xpdl')
>>> zcml("""
... <configure
... xmlns="http://namespaces.zope.org/zope"
... xmlns:wfmc="http://namespaces.zope.org/wfmc"
... i18n_domain="test"
... >
...
... <wfmc:xpdl
... file="%(file_name)s"
... process="Publication"
... id="example.publication"
... integration="zope.wfmc.adapter.integration"
... />
...
... </configure>
... """ % locals())Lets verify that they were configured:>>> from zope.wfmc.interfaces import IProcessDefinition
>>> import zope.component
>>> pd = zope.component.getUtility(IProcessDefinition,
... 'example.publication')
>>> pd
ProcessDefinition('example.publication')
>>> import zope.wfmc.adapter
>>> pd.integration is zope.wfmc.adapter.integration
TrueCHANGES0.1.2 (2007-11-02)Fix package meta-data.0.1.1 (2007-06-01)Add CHANGES.txtFix setup.py to include package data correctly (zcml, xpdl, txt) |
zope.app.workflow | This package provides the original implementation of a workflow engine based
on Zope 3. It has been superceeded byzope.wfmcandhurry.workflow.CHANGES3.5.0 (2009-02-01)Use zope.container instead of zope.app.container.Explicitly mark test dependency on zope.app.folder.3.4.2 (2009-01-27)Fix broken tests,Remove dependency on zope.app.zapi.3.4.1 (2007-11-04)Move functional tests to tests/ directory.Remove find-links configuration in buildout.cfg.3.4.0 (2007-11-04)Initial release independent of the main Zope tree. |
zope.app.wsgi | This package provides theWSGIPublisherApplicationclass which
exposes the object publishing machinery inzope.publisheras a
WSGI application. It also lets us bring up the Zope application
server (parsingzope.confandsite.zcml) with a mere function
call:>>> db = zope.app.wsgi.config('zope.conf')This is especially useful for debugging.To bring up Zope and obtain the WSGI application object at the same
time, use thegetWSGIApplicationfunction.This package also provides an easy to use application factory forPasteDeploy. You can simply specify an application configuration
like this in your Paste configuration file:[app:main]
use = egg:zope.app.wsgi
config_file = %(here)s/zope.confLook for more documentation inside the package itself.CHANGES5.0 (2023-01-19)Add support for Python 3.11.Add support for Python 3.10.Drop support for Python 2.7, 3.5, 3.6.4.4 (2022-07-13)Add support for Python 3.9.Remove unused dependencies onzope.configuration,zope.error,zope.lifecycleevent,zope.session,zope.testing, and unused
test dependencies onzope.annotation,zope.login, andzope.password.4.3.0 (2020-07-06)Fix the testlayer’shttp()to pass through the request protocol as the
response protocol, for compatibility with zope.app.testing.functional’s
HTTPCaller. SeePR 21.4.2.0 (2020-03-23)Add support for Python 3.7 and 3.8.Drop support for Python 3.3 and 3.4.Fix the testlayer’shttp()to accept leading whitespace in HTTP requests,
for compatibility with zope.app.testing.functional’s HTTPCaller.Add aserver_protocolattribute toFakeResponseso you can customize
the output to be more compatible with zope.app.testing.functional’s
HTTPCaller.Drop support for running the tests usingpython setup.py test.4.1.0 (2017-04-27)Usebase64.b64encodeto avoid deprecation warning with Python 3.Add support for PyPy.Add support for Python 3.6.Fix the testlayer’sFakeResponseassuming that headers were in
unicode on Python 2, where they should usually be encoded bytes
already. This could lead to UnicodeDecodeError if the headers
contained non-ascii characters. Also make it implement__unicode__on Python 2 and__bytes__on Python 3 to ease
cross version testing. Seeissue 7.4.0.0 (2016-08-08)Update dependencies to no longer pin alpha versions of packages which already
have final releases.Drop support for Python 2.6.Claim support for Python 3.4 and 3.5. This requires to update tozope.app.appsetup>= 4.0zope.app.publication>= 4.0Fix a bug occurring in Python 3 when the principal could not be adapted toILoggingInfo.4.0.0a4 (2013-03-19)Improve Trove classifiers.FixBrowserLayer(allowTearDown=True)to actually allow tear downs.4.0.0a3 (2013-03-03)You can now specify additional WSGI middleware components wihtout
subclassing theBrowserLayerclass.toxnow uses the Zope test runner’sftestcommand to execute tests,
since setup tests cannot deal with layers, especially when they need to
spawn sub-proceeses.Switched all functional tests to useWebTestinstead ofzope.testbrowser. Set up proper layering.Do not rely onzope.testbrowser.wsgiWSGI layer support. It was not
needed anyways.Minimized theftesting.zcmlsetup.Backwards incompatibility: if you depend onzope.app.wsgi.testlayer, you
will need to requirezope.app.wsgi[testlayer] >= 4.0(version constraint
is there because older zope.app.wsgi releases did not define atestlayerextra).4.0.0a2 (2013-03-02)Fixed a bug in WSGI Test Layer setup, where the DB is not correctly set.4.0.0a1 (2013-02-28)Added support for Python 3.3.Replaced deprecatedzope.interface.implementsusage with equivalentzope.interface.implementerdecorator.Dropped support for Python 2.4 and 2.5.3.15.0 (2012-01-19)Fixed: zope.app.wsgi.paste.ZopeApplication didn’t emit
ProcessStarting events.NOTEIf an application compensated for this by generating the event, it
will need to stop or there will be multiple events
emited. (Whether or not multiple events will do any harm is
application specific.)3.14.0 (2012-01-10)Set the WSGI environment’sREMOTE_USERitem (if not already set)
with the Zope principal label. (This is the same data set in
thewsgi.logging_infoenvironment item.)This change allows user info to be used bypaste.transloggermiddleware (or
any similar middleware that usesREMOTE_USER), which provides
access logging.3.13.0 (2011-03-15)Update to zope.testbrowser 4.0.0 which uses WebTest instead of wsgi_intercept.3.12.0 (2011-01-25)Fixedzope.app.wsgi.testlayer.httpto work with changes made in
version 3.11.0.3.11.0 (2011-01-24)Movedwsgi_interceptsupport tozope.testbrowser.wsgi, thus
requiring at least version 3.11 of this package:Movedzope.app.wsgi.testlayer.Browsertozope.testbrowser.wsgi.Browser, but left BBB import here.Split upzope.app.wsgi.testlayer.BrowserLayerinto generic WSGI
browser layer (zope.testbrowser.wsgi.Layer) and ZODB/ZOPE specific
part (zope.app.wsgi.testlayer.BrowserLayeras before).3.10.0 (2010-11-18)Add pluggability for setting up WSGI middleware in testlayer.3.9.3 (2010-10-14)Python 2.7 compatibility for xmlrpc. Transplant of zope.app.testing r116141.3.9.2 (2010-05-23)Fixed test breakage due to changes in mechanize 0.2.0.3.9.1 (2010-04-24)Add support for testing XMLRPC using zope.app.wsgi.testlayer.Fix a bug in the status string handling in zope.app.wsgi.testlayer’s
FakeResponse.3.9.0 (2010-04-19)Return a FakeResponse object in zope.app.wsgi.testlayer.http,
so it becomes easier to port over tests from zope.app.testing’s
HTTPCaller.X-Powered-By header is now stripped by zope.app.wsgi.testlayer as
it is by zope.app.testing.Bugfix: initialize any <logger> defined in the config, as
zope.app.server does. (Fixes #291147)3.8.0 (2010-04-14)zope.app.wsgi.testlayer is now a lot more compatible with
the HTTPCaller() functionality in zope.app.testing, which it can
replace:same transaction behavior - pending transactions are committed
before request and synchronized afterwards.support for browser.handleErrors (for zope.testbrowser).support for clear-text (non-base64) Basic authentication headers,
which are easier to read in the tests (though not correct in
actual HTTP traffic).3.7.0 (2010-04-13)Rewrite tests in order not to dependent onzope.app.testingandzope.app.zcmlfiles.zope.app.wsgi.testlayerintroduces new testing functionality that
can replace the old functionality inzope.app.testing. In addition,
it supports usingzope.testbrowserwith WSGI directly (instead of
relying onzope.app.testing, which pulls in a lot of dependencies).The interesting parts are:zope.app.wsgi.testlayer.BrowserLayer: this sets up a minimal layer
that allows you to use the new WSGI-enabled Browser.zope.app.wsgi.testlayer.Browser: this is a subclass of Browser fromzope.testbrowser.browser. Use it instead ofzope.testbrowser.browserdirectly to use the test browser with WSGI.
You need to useBrowserLayerwith your tests for this to work.zope.app.wsgi.testlayer.http: this is the equivalent to thehttp()function inzope.app.testing. It allows low-level HTTP access
through WSGI. You need to useBrowserLayerwith your tests for
this to work.3.6.1 (2010-01-29)Support product configuration sections in Zope configuration files.3.6.0 (2009-06-20)Import database events directly fromzope.processlifetimeinstead of using BBB imports inzope.app.appsetup.3.5.2 (2009-04-03)TheWSGIPublisherApplicationuses now theILoggingInfoconcept given
from zope.publisher.interfaces.logginginfo for log user infos usable for
access logs. This allows you to implement your own access log user info
message. See zope.publisher.interfaces.logginginfo.ILoggingInfo for more
information.3.5.1 (2009-03-31)TheWSGIPublisherApplicationcall now provides a user name
in the environment meant for use in logs.3.5.0 (2009-02-10)Make devmode warning message more generic. We don’t nesessary have theetc/zope.conffile nowadays when using buildout-based setups.Add an application factory for Paste. So Zope application can now be
easily deployed with Paste .ini configuration like this:[app:main]
use = egg:zope.app.wsgi
config_file = %(here)s/zope.conf
handle_errors = falseThe config_file is a required argument, however the handle_errors
defaults to True if not specified. Setting it to False allows you to
make WSGIPublisherApplication not handle exceptions itself but
propagate them to an upper middleware, like WebError or something.TheWSGIPublisherApplicationconstructor andgetWSGIApplicationfunction now accept optionalhandle_errorsargument, described
above.Change mailing list address to zope-dev at zope.org instead of retired
one.3.4.1 (2008-07-30)Added Trove classifiers.NotifyWSGIPublisherApplicationCreatedevent when WSGI application is
created.Fixed deprecation warning inftesting.zcml: ZopeSecurityPolicy moved tozope.securitypolicy.3.4.0 (2007-09-14)Fixed the tests to run on Python 2.5 as well as Python 2.4.SplitgetApplicationintoconfigandgetApplicationso
thatconfigcould be reused, for example for debugging.3.4.0a1 (2007-04-22)Initial release as a separate project, corresponds tozope.app.wsgifrom Zope 3.4.0a1 |
zope.app.xmlrpcintrospection | This Zope 3 package provides an XML-RPC introspection mechanism.Detailed DocumentationXMLRPC IntrospectionWhat’s introspection now ?This Zope 3 package provides an xmlrpcintrospection mechanism,
as defined here:http://xmlrpc-c.sourceforge.net/xmlrpc-howto/xmlrpc-howto-api-introspection.htmlIt registers three new xmlrpc methods:listMethods(): Lists all xmlrpc methods (ie views) registered for the
current objectmethodHelp(method_name): Returns the method documentation of the given
method.methodSignature(method_name): Returns the method documentation of the
given method.How do I use it ?Basically, if you want to add introspection into your XMLRPCView, you just
have to add a decorator for each method of the view, that specifies the return
type of the method and the argument types.The decorator is calledxmlrpccallable>>> from zope.app.xmlrpcintrospection.xmlrpcintrospection import xmlrpccallable
>>> from zope.app.publisher.xmlrpc import XMLRPCView
>>> class MySuperXMLRPCView(XMLRPCView):
... @xmlrpccallable(str, str, str, str)
... def myMethod(self, a, b, c):
... """ my help """
... return '%s %s, %s, lalalala, you and me, lalalala' % (a, b, c)myMethod()will then be introspectable. (find a full examples below, grep
for (*))How does it works ?It is based on introspection mechanisms provided by the apidoc package.*ripped form xmlrpc doctests*Let’s write a view that returns a folder listing:>>> class FolderListing:
... def contents(self):
... return list(self.context.keys())Now we’ll register it as a view:>>> from zope.configuration import xmlconfig
>>> ignored = xmlconfig.string("""
... <configure
... xmlns="http://namespaces.zope.org/zope"
... xmlns:xmlrpc="http://namespaces.zope.org/xmlrpc"
... >
... <!-- We only need to do this include in this example,
... Normally the include has already been done for us. -->
... <include package="zope.app.publisher.xmlrpc" file="meta.zcml" />
...
... <xmlrpc:view
... for="zope.site.interfaces.IFolder"
... methods="contents"
... class="zope.app.xmlrpcintrospection.README.FolderListing"
... permission="zope.ManageContent"
... />
... </configure>
... """)Now, we’ll add some items to the root folder:>>> print http(r"""
... POST /@@contents.html HTTP/1.1
... Authorization: Basic bWdyOm1ncnB3
... Content-Length: 73
... Content-Type: application/x-www-form-urlencoded
...
... type_name=BrowserAdd__zope.site.folder.Folder&new_value=f1""")
HTTP/1.1 303 See Other
...>>> print http(r"""
... POST /@@contents.html HTTP/1.1
... Authorization: Basic bWdyOm1ncnB3
... Content-Length: 73
... Content-Type: application/x-www-form-urlencoded
...
... type_name=BrowserAdd__zope.site.folder.Folder&new_value=f2""")
HTTP/1.1 303 See Other
...And call our xmlrpc method:>>> print http(r"""
... POST / HTTP/1.0
... Authorization: Basic bWdyOm1ncnB3
... Content-Length: 102
... Content-Type: text/xml
...
... <?xml version='1.0'?>
... <methodCall>
... <methodName>contents</methodName>
... <params>
... </params>
... </methodCall>
... """)
HTTP/1.0 200 OK
...
<?xml version='1.0'?>
<methodResponse>
<params>
<param>
<value><array><data>
<value><string>f1</string></value>
<value><string>f2</string></value>
</data></array></value>
</param>
</params>
</methodResponse>
<BLANKLINE>*end of ripped form xmlrpc doctests*Now we want to provide to that view introspection.
Let’s add three new xmlrcp methods, that published
the introspection api.>>> ignored = xmlconfig.string("""
... <configure
... xmlns="http://namespaces.zope.org/zope"
... xmlns:xmlrpc="http://namespaces.zope.org/xmlrpc"
... >
... <!-- We only need to do this include in this example,
... Normally the include has already been done for us. -->
... <include package="zope.app.publisher.xmlrpc" file="meta.zcml" />
... <xmlrpc:view
... for="zope.interface.Interface"
... methods="listMethods methodHelp methodSignature"
... class="zope.app.xmlrpcintrospection.xmlrpcintrospection.XMLRPCIntrospection"
... permission="zope.Public"
... />
... </configure>
... """)They are linked to XMLRPCIntrospection class, that actuallyknows how to lookup to all interfacesAnd call our xmlrpc method, that should list the content method:>>> print http(r"""
... POST / HTTP/1.0
... Content-Type: text/xml
...
... <?xml version='1.0'?>
... <methodCall>
... <methodName>listMethods</methodName>
... <params>
... </params>
... </methodCall>
... """, handle_errors=False)
HTTP/1.0 200 OK
...
<?xml version='1.0'?>
<methodResponse>
...
<value><string>contents</string></value>
...
</methodResponse>
<BLANKLINE>Let’s try to add another method, to se if it gets listed…>>> class FolderListing2:
... def contents2(self):
... return list(self.context.keys())
>>> from zope.configuration import xmlconfig
>>> ignored = xmlconfig.string("""
... <configure
... xmlns="http://namespaces.zope.org/zope"
... xmlns:xmlrpc="http://namespaces.zope.org/xmlrpc"
... >
... <!-- We only need to do this include in this example,
... Normally the include has already been done for us. -->
... <include package="zope.app.publisher.xmlrpc" file="meta.zcml" />
...
... <xmlrpc:view
... for="zope.site.interfaces.IFolder"
... methods="contents2"
... class="zope.app.xmlrpcintrospection.README.FolderListing2"
... permission="zope.ManageContent"
... />
... </configure>
... """)
>>> print http(r"""
... POST / HTTP/1.0
... Content-Type: text/xml
...
... <?xml version='1.0'?>
... <methodCall>
... <methodName>listMethods</methodName>
... <params>
... </params>
... </methodCall>
... """, handle_errors=False)
HTTP/1.0 200 OK
...
<?xml version='1.0'?>
<methodResponse>
...
<value><string>contents</string></value>
<value><string>contents2</string></value>
...
</methodResponse>
<BLANKLINE>No we want to test methodHelp and methodSignature, to check that it returns,The method docThe list of attributesIn RPC, the list of attributes has to be return in an array of type:[return type, param1 type, param2 type]Since in Python we cannot have a static type for the method return type,
we introduce here a new mechanism based on a decorator, that let the xmlrpcview
developer add his own signature.If the signature is not given, a defaut list is returned:[None, None, None…]The decorator append to the function objet two new parameters,
to get back the signature.>>> from zope.app.xmlrpcintrospection.xmlrpcintrospection import xmlrpccallable
>>> class JacksonFiveRPC:
... @xmlrpccallable(str, str, str, str)
... def says(self, a, b, c):
... return '%s %s, %s, lalalala, you and me, lalalala' % (a, b, c)Let’s try to get back the signature:>>> JacksonFiveRPC().says.return_type
<type 'str'>
>>> JacksonFiveRPC().says.parameters_types
(<type 'str'>, <type 'str'>, <type 'str'>)The method is still callable as needed:>>> JacksonFiveRPC().says('a', 'b', 'c')
'a b, c, lalalala, you and me, lalalala'Let’s try out decorated and not decorated methods signatures (*):>>> class JacksonFiveRPC:
... @xmlrpccallable(str, str, str, str)
... def says(self, a, b, c):
... return '%s %s, %s, lalalala, you and me, lalalala' % (a, b, c)
... def says_not_decorated(self, a, b, c):
... return '%s %s, %s, lalalala, you and me, lalalala' % (a, b, c)
>>> from zope.configuration import xmlconfig
>>> ignored = xmlconfig.string("""
... <configure
... xmlns="http://namespaces.zope.org/zope"
... xmlns:xmlrpc="http://namespaces.zope.org/xmlrpc"
... >
... <!-- We only need to do this include in this example,
... Normally the include has already been done for us. -->
... <include package="zope.app.publisher.xmlrpc" file="meta.zcml" />
...
... <xmlrpc:view
... for="zope.site.folder.IFolder"
... methods="says says_not_decorated"
... class="zope.app.xmlrpcintrospection.README.JacksonFiveRPC"
... permission="zope.ManageContent"
... />
... </configure>
... """)Now let’s try to get the signature forsays():>>> print http(r"""
... POST / HTTP/1.0
... Content-Type: text/xml
...
... <?xml version='1.0'?>
... <methodCall>
... <methodName>methodSignature</methodName>
... <params>
... <param>
... <value>says</value>
... </param>
... </params>
... </methodCall>
... """, handle_errors=False)
HTTP/1.0 200 OK
...
<?xml version='1.0'?>
<methodResponse>
<params>
<param>
<value><array><data>
<value><array><data>
<value><string>str</string></value>
<value><string>str</string></value>
<value><string>str</string></value>
<value><string>str</string></value>
</data></array></value>
</data></array></value>
</param>
</params>
</methodResponse>
<BLANKLINE>Now let’s try to get the signature for says_not_decorated()`:>>> print http(r"""
... POST / HTTP/1.0
... Content-Type: text/xml
...
... <?xml version='1.0'?>
... <methodCall>
... <methodName>methodSignature</methodName>
... <params>
... <param>
... <value>says_not_decorated</value>
... </param>
... </params>
... </methodCall>
... """, handle_errors=False)
HTTP/1.0 200 OK
...
<?xml version='1.0'?>
<methodResponse>
<params>
<param>
<value><array><data>
<value><array><data>
<value><string>undef</string></value>
<value><string>undef</string></value>
<value><string>undef</string></value>
<value><string>undef</string></value>
</data></array></value>
</data></array></value>
</param>
</params>
</methodResponse>
<BLANKLINE>Last, but not least, the method help:>>> class JacksonFiveRPCDocumented:
... @xmlrpccallable(str, str, str, str)
... def says(self, a, b, c):
... """ this is the help for
... says()
... """
... return '%s %s, %s, lalalala, you and me, lalalala' % (a, b, c)
... def says_not_documented(self, a, b, c):
... return '%s %s, %s, lalalala, you and me, lalalala' % (a, b, c)
>>> from zope.configuration import xmlconfig
>>> ignored = xmlconfig.string("""
... <configure
... xmlns="http://namespaces.zope.org/zope"
... xmlns:xmlrpc="http://namespaces.zope.org/xmlrpc"
... >
... <!-- We only need to do this include in this example,
... Normally the include has already been done for us. -->
... <include package="zope.app.publisher.xmlrpc" file="meta.zcml" />
...
... <xmlrpc:view
... for="zope.site.folder.IFolder"
... methods="says says_not_documented"
... class="zope.app.xmlrpcintrospection.README.JacksonFiveRPCDocumented"
... permission="zope.ManageContent"
... />
... </configure>
... """)
>>> print http(r"""
... POST / HTTP/1.0
... Content-Type: text/xml
...
... <?xml version='1.0'?>
... <methodCall>
... <methodName>methodHelp</methodName>
... <params>
... <param>
... <value>says</value>
... </param>
... </params>
... </methodCall>
... """, handle_errors=False)
HTTP/1.0 200 OK
...
<?xml version='1.0'?>
<methodResponse>
<params>
<param>
<value><string> this is the help for
says()
</string></value>
</param>
</params>
</methodResponse>
<BLANKLINE>
>>> print http(r"""
... POST / HTTP/1.0
... Content-Type: text/xml
...
... <?xml version='1.0'?>
... <methodCall>
... <methodName>methodHelp</methodName>
... <params>
... <param>
... <value>says_not_documented</value>
... </param>
... </params>
... </methodCall>
... """, handle_errors=False)
HTTP/1.0 200 OK
...
<?xml version='1.0'?>
<methodResponse>
<params>
<param>
<value><string>undef</string></value>
</param>
</params>
</methodResponse>
<BLANKLINE>CHANGES3.5.1 (2010-02-06)Fix test by including zope.loginInclude ftesting.zcml from zope.app.securitypolicy.browser.testsInclude meta.zcml from zope.securitypolicy3.5.0 (2009-02-01)Updatezope.app.folderwithzope.site.3.4.0 (2007-11-03)Initial release independent of the main Zope tree. |
zope.app.zapi | ContentsCHANGES3.5.0 (2011-03-01)3.4.1 (2009-07-23)3.4.0 (2007-10-03)Zope Application Programming Interfaceprincipals()DownloadCHANGES3.5.0 (2011-03-01)Removed BBB imports of deprecated parts (services, multiviews etc.) which
were removed inzope.component3.6, thus requiring at least this
version.Using Python’sdoctestmodule instead of depreactedzope.testing.doctest.3.4.1 (2009-07-23)Explicitely list all dependencies. Fixes test failures.3.4.0 (2007-10-03)Initial public release as an individual package.Zope Application Programming InterfaceThis package provides a collection of commonly used APIs to make
imports simpler.Mostly, the APIs provided here are imported from elsewhere. A few are
provided here.principals()The principals method returns the authentication service. If no
service is defined, a ComponentLookupError is raised:>>> from zope.app import zapi
>>> zapi.principals() #doctest: +NORMALIZE_WHITESPACE
Traceback (most recent call last):
...
ComponentLookupError:
(<InterfaceClass zope.authentication.interfaces.IAuthentication>, '')But if we provide an authentication service:>>> import zope.interface
>>> from zope.authentication.interfaces import IAuthentication
>>> class FakeAuthenticationUtility:
... zope.interface.implements(IAuthentication)
>>> fake = FakeAuthenticationUtility()>>> from zope.app.testing import ztapi
>>> ztapi.provideUtility(IAuthentication, fake)Then we should be able to get the service back when we ask for the
principals:>>> zapi.principals() is fake
TrueDownload |
zope.app.zcmlfiles | ContentsChange History5.0 (2023-07-10)4.1.0 (2022-08-23)4.0.0 (2017-05-29)3.8.0 (2013-08-27)3.7.1 (2011-07-26)3.7.0 (2009-12-28)3.6.1 (2009-12-16)3.6.0 (2009-07-11)3.5.5 (2009-05-23)3.5.4 (2009-05-18)3.5.3 (2009-02-04)3.5.2 (2009-01-31)3.5.1 (2008-12-28)3.5.0 (2008-12-16)3.4.3 (2007-11-01)3.4.2 (2007-10-30)3.4.1 (2007-10-23)3.4.0 (2007-10-03)Change History5.0 (2023-07-10)Add support for Python 3.11.Drop support for Python 2.7, 3.5, 3.6.4.1.0 (2022-08-23)Add support for Python 3.7, 3.8, 3.9, 3.10.Drop support for Python 3.4.4.0.0 (2017-05-29)Add support for Python 3.4, 3.5, 3.6 and PyPy. Update minimum dependency
versions appropriately.3.8.0 (2013-08-27)Remove include ofzope.app.zopeappgenerationsthat is not useful unless
upgrading a database older than Zope 3.4. This cuts the last dependency onzope.app.authenticationfrom the ZTK.3.7.1 (2011-07-26)Move include ofzope.dublincore.browserhere fromzope.dublincore(LP: #590668).3.7.0 (2009-12-28)Use newzope.app.localeswhich has its ownconfigure.zcml.No longer usingzope.testing.doctestunitas it is deprecated
now. Using python’sdoctestmodule.3.6.1 (2009-12-16)Removed reference to no longer existing configure.zcml fromzope.app.pagetemplate.tests.3.6.0 (2009-07-11)No longer depends on deprecatedzope.app.interfacebut onzope.componentvocabulary.3.5.5 (2009-05-23)Added missing dependencies, includingzope.app.httpandzope.app.applicationcontrol.3.5.4 (2009-05-18)Added missingzope.app.exceptiondependency, as we include its ZCML.Added missingzope.app.testingtest dependency to make tests pass.3.5.3 (2009-02-04)Addedzope.app.brokendependency (we include its ZCML).3.5.2 (2009-01-31)We depended onzope.formlibbut didn’t include its configuration. Now
it’s included inconfigure.zcml.We include ZCML ofzope.app.errorbut didn’t mention it as a dependency.3.5.1 (2008-12-28)Add include ofzope.app.schema:configure.zcml. Because component-based
vocabularies are used everywhere and we need to import zope.app.schema
somehow to make it work. This is needed because of removal of the include
of zope.app.schema’s meta.zcml in the previous release.3.5.0 (2008-12-16)Remove deprecated include ofzope.app.component.browser:meta.zcml.Remove deprecated include ofzope.app.schema:meta.zcml.Remove use of zope.modulealias.3.4.3 (2007-11-01)Fix test failure due to missingzope.app.container.browser.ftestsdirectory. Now it is moved tozope.app.container.browser.tests.3.4.2 (2007-10-30)Fix test failure due to missingzope.app.form.browser.ftestsdirectory.
Now it is moved tozope.app.form.browser.tests.3.4.1 (2007-10-23)Added missing dependency.3.4.0 (2007-10-03)Initial public release as an individual package. |
zope.app.zopeappgenerations | This package provides the ZODB schema update generations for all components
included in the classic Zope 3 releases.CHANGES3.6.1 (2010-12-22)Fixed evolve3 that used no longer existing API.3.6.0 (2010-09-18)Now depends onzope.generationsinstead ofzope.app.generations.3.5.0 (2009-04-05)MovedgetRootFolderutility method fromzope.app.zopeappgenerationstozope.app.generations.utility.Fixed author email and home page address.3.4.0 (2007-10-29)Initial release independent of the main Zope tree. |
zope.app.zptpage | ContentsCHANGES3.5.1 (2010-01-08)3.5.0 (2009-01-31)3.4.1 (2007-10-31)3.4.0 (2007-10-03)CHANGES3.5.1 (2010-01-08)Usezope.pagetemplateinstead ofzope.app.pagetemplate.Fix tests using a newer zope.publisher that requires zope.login.3.5.0 (2009-01-31)Usezope.containerinstead ofzope.app.container.Usezope.siteinstead ofzope.app.folder. Add missing
dependency onzope.site.3.4.1 (2007-10-31)ResolveZopeSecurityPolicydeprecation warning.3.4.0 (2007-10-03)Initial public release as an individual package. |
zope.authentication | zope.authenticationThis package provides a definition of authentication concepts for use in
Zope Framework. This includes:IAuthenticationIUnauthenticatedPrincipalILogoutDocumentation is hosted athttps://zopeauthentication.readthedocs.io/en/latest/Changes5.0 (2023-01-06)Add support for Python 3.10, 3.11.Drop support for Python 2.7, 3.5, 3.6.4.5.0 (2021-03-19)Add support for Python 3.8 and 3.9.Drop support for Python 3.4.Fix deprecated test imports from zope.component to use the correct
imports from zope.interface.4.4.0 (2018-08-24)Host documentation athttps://zopeauthentication.readthedocs.ioAdd support for Python 3.7.Drop support for Python 3.3.Drop support forpython setup.py test.4.3.0 (2017-05-11)Add support for Python 3.5 and 3.6.Drop support for Python 2.6 and 3.2.4.2.1 (2015-06-05)Add support for PyPy3 and Python 3.2.4.2.0 (2014-12-26)Add support for PyPy. PyPy3 support is blocked on a release of a fix for:https://bitbucket.org/pypy/pypy/issue/1946Add support for Python 3.4.Add support for testing on Travis.4.1.0 (2013-02-21)Add support for Python 3.3.Addtox.iniandMANIFEST.in.4.0.0 (2012-07-04)Break inappropriate testing dependency onzope.component.nextutility.(Forward-compatibility withzope.component4.0.0).Replace deprecatedzope.component.adaptsusage with equivalentzope.component.adapterdecorator.Replace deprecatedzope.interface.implementsusage with equivalentzope.interface.implementerdecorator.Drop support for Python 2.4 and 2.5.3.7.1 (2010-04-30)Remove undeclared testing dependency onzope.testing.3.7.0 (2009-03-14)Initial release. This package was split off fromzope.app.securityto
provide a separate common interface definition for authentication utilities
without extra dependencies. |
zope.bforest | BForest APIBForests are dictionary-like objects that use multiple BTrees for a backend and
support rotation of the composite trees. This supports various implementations
of timed member expirations, enabling caches and semi-persistent storage. A
useful and simple subclass would be to promote a key-value pair to the
first (newest) bucket whenever the key is accessed, for instance. It also is
useful with disabling the rotation capability.Like btrees, bforests come in four flavors: Integer-Integer (IIBForest),
Integer-Object (IOBForest), Object-Integer (OIBForest), and Object-Object
(OOBForest). The examples here will deal with them in the abstract: we will
create classes from the imaginary and representative BForest class, and
generate keys from KeyGenerator and values from ValueGenerator. From the
examples you should be able to extrapolate usage of all four types.First let’s instantiate a bforest and look at an empty example. By default,
a new bforest creates two composite btree buckets.>>> d = BForest()
>>> list(d.keys())
[]
>>> list(d.values())
[]
>>> len(d.buckets)
2
>>> dummy_key = KeyGenerator()
>>> d.get(dummy_key)
>>> d.get(dummy_key, 42)
42Now we’ll populate it. We’ll first create a BTree we’ll use to compare.>>> original = BForest._treemodule.BTree()
>>> for i in range(10):
... original[KeyGenerator()] = ValueGenerator()
...
>>> d.update(original)
>>> d == original
True
>>> list(d) == list(original)
True
>>> list(d.keys()) == list(original.keys())
True
>>> list(d.values()) == list(original.values())
True
>>> list(d.items()) == list(original.items())
True
>>> original_min = original.minKey()
>>> d.popitem() == (original_min, original.pop(original_min))
True
>>> original_min = original.minKey()
>>> d.pop(original_min) == original.pop(original_min)
True
>>> len(d) == len(original)
TrueNow let’s rotate the buckets.>>> d.rotateBucket()…and we’ll do the exact same test as above, first.>>> d == original
True
>>> list(d) == list(original)
True
>>> list(d.keys()) == list(original.keys())
True
>>> list(d.values()) == list(original.values())
True
>>> list(d.items()) == list(original.items())
True
>>> original_min = original.minKey()
>>> d.popitem() == (original_min, original.pop(original_min))
True
>>> original_min = original.minKey()
>>> d.pop(original_min) == original.pop(original_min)
True
>>> len(d) == len(original)
TrueNow we’ll make a new dictionary to represent changes made after the bucket
rotation.>>> second = BForest._treemodule.BTree()
>>> for i in range(10):
... key = KeyGenerator()
... value = ValueGenerator()
... second[key] = value
... d[key] = value
...
>>> original.update(second)…and we’ll do the exact same test as above, first.>>> d == original
True
>>> list(d) == list(original)
True
>>> list(d.keys()) == list(original.keys())
True
>>> list(d.values()) == list(original.values())
True
>>> list(d.items()) == list(original.items())
True
>>> original_min = original.minKey()
>>> d.popitem() == (original_min, original.pop(original_min))
True
>>> if original_min in second:
... _ = second.pop(original_min)
>>> original_min = original.minKey()
>>> d.pop(original_min) == original.pop(original_min)
True
>>> if original_min in second:
... _ = second.pop(original_min)
>>> len(d) == len(original)
TrueThe bforest offersitervalues,iterkeys, anditeritemsthat have
the same extended arguments as BTrees’values,keys, anditems.>>> list(d.itervalues()) == list(original.values())
True
>>> list(d.iteritems()) == list(original.items())
True
>>> list(d.iterkeys()) == list(original.keys())
True>>> keys = list(original)
>>> mid = keys[len(keys)//2]
>>> list(d.itervalues(min=mid)) == list(original.itervalues(min=mid))
True
>>> list(d.itervalues(max=mid)) == list(original.itervalues(max=mid))
True
>>> list(d.itervalues(min=mid, excludemin=True)) == list(
... original.itervalues(min=mid, excludemin=True))
True
>>> list(d.itervalues(max=mid, excludemax=True)) == list(
... original.itervalues(max=mid, excludemax=True))
True>>> list(d.iterkeys(min=mid)) == list(original.iterkeys(min=mid))
True
>>> list(d.iterkeys(max=mid)) == list(original.iterkeys(max=mid))
True
>>> list(d.iterkeys(min=mid, excludemin=True)) == list(
... original.iterkeys(min=mid, excludemin=True))
True
>>> list(d.iterkeys(max=mid, excludemax=True)) == list(
... original.iterkeys(max=mid, excludemax=True))
True>>> list(d.iteritems(min=mid)) == list(original.iteritems(min=mid))
True
>>> list(d.iteritems(max=mid)) == list(original.iteritems(max=mid))
True
>>> list(d.iteritems(min=mid, excludemin=True)) == list(
... original.iteritems(min=mid, excludemin=True))
True
>>> list(d.iteritems(max=mid, excludemax=True)) == list(
... original.iteritems(max=mid, excludemax=True))
TrueIt also offers maxKey and minKey, like BTrees.>>> d.maxKey() == original.maxKey()
True
>>> d.minKey() == original.minKey()
True
>>> d.maxKey(mid) == original.maxKey(mid)
True
>>> d.minKey(mid) == original.minKey(mid)
TrueNow if we rotate the buckets, the first set of items will be gone, but the
second will remain.>>> d.rotateBucket()
>>> d == original
False
>>> d == second
TrueLet’s set a value, check the copy behavior, and then rotate it one more time.>>> third = BForest._treemodule.BTree({KeyGenerator(): ValueGenerator()})
>>> d.update(third)
>>> copy = d.copy()
>>> copy == d
True
>>> copy != second # because second doesn't have the values of third
True
>>> list(copy.buckets[0].items()) == list(d.buckets[0].items())
True
>>> list(copy.buckets[1].items()) == list(d.buckets[1].items())
True
>>> copy[KeyGenerator()] = ValueGenerator()
>>> copy == d
False
>>> d.rotateBucket()
>>> d == third
True
>>> d.clear()
>>> d == BForest() == {}
True>>> d.update(second)We’ll make a value in one bucket that we’ll override in another.>>> d[third.keys()[0]] = ValueGenerator()
>>> d.rotateBucket()
>>> d.update(third)
>>> second.update(third)
>>> d == second
True
>>> second == d
TrueThe tree method converts the bforest to a btree efficiently for a common case
of more items in buckets than buckets.>>> tree = d.tree()
>>> d_items = list(d.items())
>>> d_items.sort()
>>> t_items = list(tree.items())
>>> t_items.sort()
>>> t_items == d_items
TrueFinally, comparisons work similarly to dicts but in a simpleminded
way–improvements welcome! We’ve already looked at a lot of examples above,
but here are some additional cases>>> d == None
False
>>> d == [1, 2]
False
>>> d != None
True
>>> None == d
False
>>> d != None
True
>>> d >= second
True
>>> d >= dict(second)
True
>>> d <= second
True
>>> d <= dict(second)
True
>>> d > second
False
>>> d > dict(second)
False
>>> d < second
False
>>> d > dict(second)
False
>>> original_min = second.minKey()
>>> del second[original_min]
>>> original_min in d
True
>>> d > second
True
>>> d < second
False
>>> d >= second
True
>>> d <= second
False
>>> second < d
True
>>> second > d
False
>>> second <= d
True
>>> second >= d
FalseCHANGES1.2 (2008-05-09)Bugfixes:added omitted __ne__ implementation.Features:added minKey, maxKey, like BTrees.gave itervalues, iteritems, and iterkeys same extra arguments as BTrees’
values, items, and keys: min, max, excludemin, excludemax.changed implementation of iter[…] functions to try to only wake up buckets
as needed.Incompatible Changes:changed definition of __eq__: now compares contentsandorder. Tries to
only wake up buckets as needed.1.1.1 (2008-04-09)Bugfix:periodic variant was pseudo-guaranteeing maximum period, not minimum
period, contradicting documentation. Changed implementation and test to
match documentation (i.e., guarantees minimum period; maximum period is
a bit fuzzy, as described in docs).1.1 (2008-03-08)Features:added periodic variantadded L-variants1.0 (?)Initial release |
zope.broken | OverviewThis package is obsolete and its functionality has been merged into the ZODB3
distribution itself. If you use version 3.10 or later of ZODB3, please change
your imports of the IBroken interface to a direct:from ZODB.interfaces import IBrokenYou can use this package with older versions of the ZODB3, which didn’t have
the IBroken interface yet.Changelog3.6.0 (2010-01-09)The IBroken interface has been merged into the ZODB3 distribution. Import
the interface from there, while providing a copy for backwards compatibility
with older versions of the ZODB3.3.5.0 (2009-02-04)Createdzope.brokento hold depended upon bits ofzope.app.broken. |
zope.browser | zope.browserThis package provides shared browser components for the Zope Toolkit.
These components consist of a set of interfaces defining common
concepts, including:IViewIBrowserViewIAddingITermsISystemErrorViewDocumentation is hosted athttps://zopebrowser.readthedocs.ioChangelog3.0 (2023-03-27)Add support for Python 3.11.Drop support for Python 2.7, 3.5, 3.6.2.4 (2022-04-06)Add support for Python 3.8, 3.9, 3.10.Drop support for Python 3.4.2.3 (2018-10-05)Add support for Python 3.7.2.2.0 (2017-08-10)Add support for Python 3.5 and 3.6.Drop support for Python 2.6, 3.2 and 3.3.Host documentation athttps://zopebrowser.readthedocs.io2.1.0 (2014-12-26)Add support for Python 3.4.Add support for testing on Travis.2.0.2 (2013-03-08)Add Trove classifiers indicating CPython, 3.2 and PyPy support.2.0.1 (2013-02-11)Add support for testing with tox.2.0.0 (2013-02-11)Test coverage of 100% verified.Add support for Python 3.3 and PyPy.Drop support for Python 2.4 and 2.5.1.3 (2010-04-30)Removetestextra andzope.testingdependency.1.2 (2009-05-18)MoveISystemErrorViewinterface here fromzope.app.exceptionto break undesirable dependencies.Fix home page and author’s e-mail address.Add doctests tolong_description.1.1 (2009-05-13)MoveIAddinginterface here fromzope.app.container.interfacesto break undesirable dependencies.1.0 (2009-05-13)MoveIViewandIBrowserViewinterfaces here fromzope.publisher.interfacesto break undesirable dependencies.0.5.0 (2008-12-11)MoveITermsinterface here fromzope.app.form.browser.interfacesto break undesirable dependencies. |
zope.browsermenu | zope.browsermenuNoteThis package is at present not reusable without depending on a large
chunk of the Zope Toolkit and its assumptions. It is maintained by theZope Toolkit project.This package provides an implementation of browser menus and ZCML directives
for configuring them.Changes5.0 (2023-02-08)Drop support for Python 2.7, 3.4, 3.5, 3.6.Add support for Python 3.7, 3.8, 3.9, 3.10, 3.11.4.4 (2018-10-05)Add support for Python 3.7.4.3.0 (2017-08-03)Drop support for Python 3.3.Add support for PyPy3 3.5.Fix test compatibility with zope.component 4.4.0.4.2.0 (2017-05-28)Add support for Python 3.5 and 3.6.Drop support for Python 2.6 and 3.2.Drop support for ‘setup.py test’.4.1.1 (2015-06-05)Add support for PyPy3 and Python 3.2.4.1.0 (2014-12-24)Add support for PyPy. PyPy3 support is pending a release of fix forhttps://bitbucket.org/pypy/pypy/issue/1946).Add support for Python 3.4.Add support for testing on Travis.4.1.0a1 (2013-02-22)Add support for Python 3.3.4.0.0 (2012-07-04)Strip noise from context actions in doctests.Make output is now more meaningful, and hides irrelevant details.
(forward-compatibility withzope.component4.0.0).Replace deprecatedzope.interface.implementsusage with equivalentzope.interface.implementerdecorator.Drop support for Python 2.4 and 2.5.3.9.1 (2010-04-30)Remove use ofzope.testing.doctestunitin favor of stdlib’sdoctest.3.9.0 (2009-08-27)Initial release. This package was splitted off zope.app.publisher. |
zope.browserpage | zope.browserpageNoteThis package is at present not reusable without depending on a large
chunk of the Zope Toolkit and its assumptions. It is maintained by theZope Toolkit project.This package provides ZCML directives for configuring browser views.
More specifically it defines the following ZCML directives:browser:pagebrowser:pagesbrowser:viewThese directives also support menu item registration for pages, whenzope.browsermenupackage is installed. Otherwise, they simply ignore
the menu attribute.Changes5.0 (2023-01-19)Drop support for Python 2.7, 3.5, 3.6.Add support for Python 3.8, 3.9, 3.10, 3.11.Drop support for running the tests usingpython setup.py test.
(#11)4.4.0 (2019-06-18)Fix regression inallowed_attributesandallowed_interface.
(#7)Drop support for Python 3.4.4.3.0 (2018-10-05)Add support for Python 3.7.4.2.0 (2017-08-02)Add support for Python 3.5 and 3.6.Drop support for Python 2.6 and 3.3.4.1.0 (2014-12-24)Fix deprecated unittest methods.Add explicit support for Python 3.4.Add explicit support for PyPy.4.1.0a1 (2013-02-22)Add support for Python 3.3.4.0.0 (2012-07-04)When registering views, no longer pass the deprecated ‘layer’ agrument
tozope.component.registerAdapter. Instead, pass(for_, layer)as expected (forward-compatibility withzope.component4.0.0).Replace deprecatedzope.interface.implementsusage with equivalentzope.interface.implementerdecorator.Drop support for Python 2.4 and 2.5.3.12.2 (2010-05-24)Fix unit tests broken under Python 2.4 by the switch to the standard
librarydoctestmodule.3.12.1 (2010-04-30)Prefer the standard library’sdoctestmodule to the one fromzope.testing.3.12.0 (2010-04-26)Move the implementation oftales:expressiontypehere fromzope.app.pagetemplate.3.11.0 (2009-12-22)Move the named template implementation here fromzope.app.pagetemplate.3.10.1 (2009-12-22)Depend on theuntrustedpythonextra ofzope.security, since we
import fromzope.pagetemplate.engine.3.10.0 (2009-12-22)Remove the dependency onzope.app.pagetemplateby movingviewpagetemplatefile,simpleviewclassandmetaconfigure.registerTypeinto this package.3.9.0 (2009-08-27)Initial release. This package was split off fromzope.app.publisher. |
zope.browserresource | zope.browserresourceNoteThis package is at present not reusable without depending on a large
chunk of the Zope Toolkit and its assumptions. It is maintained by theZope Toolkit project.This package provides an implementation of browser resources. It also
provides directives for defining those resources using ZCML.Resources are static files and directories that are served to the browser
directly from the filesystem. The most common example are images, CSS style
sheets, or JavaScript files.Resources are be registered under a symbolic name and can later be referred to
by that name, so their usage is independent from their physical
location. Resources can also easily be internationalized.Documentation is hosted athttps://zopebrowserresource.readthedocs.ioChanges5.1 (2023-08-28)Make tests more resilient.5.0 (2023-02-14)Drop support for Python 2.7, 3.5, 3.6.Add support for Python 3.9, 3.10, 3.11.Drop support forpython setup.py test.4.4 (2019-12-10)Make the registration of theFileETagadapter conditional on the environment
as Zope 4 registers this adapter explicitly inProducts.Five.browser.
See#12.Add support for Python 3.8.Drop support for Python 3.4.4.3 (2018-10-05)Add support for Python 3.7.Host documentation athttps://zopebrowserresource.readthedocs.ioAdd.gitto the list of directory names that are ignored by default.Fix test compatibility with zope.i18n 4.3.
See#84.2.1 (2017-09-01)Fix dependencies of thezcmlextra.4.2.0 (2017-08-04)Add support for Python 3.5 and 3.6.Drop support for Python 2.6 and 3.3.4.1.0 (2014-12-26)Add support for PyPy. PyPy3 support awaits release of fix for:https://bitbucket.org/pypy/pypy/issue/1946Add support for Python 3.4.Add support for testing on Travis.4.0.2 (2014-11-04)Return no ETag if no adapter is registered, disabling the
requirement for applications that was introduced in 3.11.0 (GitHub #1)4.0.1 (2013-04-03)Fix some Python 3 string vs bytes issues.4.0.0 (2013-02-20)Replace deprecatedzope.component.adaptsusage with equivalentzope.component.adapterdecorator.Replace deprecatedzope.interface.classProvidesusage with equivalentzope.interface.providerdecorator.Replace deprecatedzope.interface.implementsOnlyusage with equivalentzope.interface.implementer_onlydecorator.Replace deprecatedzope.interface.implementsusage with equivalentzope.interface.implementerdecorator.Drop support for Python 2.4 and 2.5.Add support for Python 3.3.3.12.0 (2010-12-14)Addzcmlextra dependencies and fixed dependencies ofconfigure.zcmlon other packages’meta.zcml.Add a test for including our ownconfigure.zcml.3.11.0 (2010-08-13)Support the HTTP ETag header for file resources. ETag generation can be
customized or disabled by providing an IETag multi-adapter on
(IFileResource, your-application-skin).3.10.3 (2010-04-30)Prefer the standard libraries doctest module to the one from zope.testing.3.10.2 (2009-11-25)The previous release had a broken egg, sorry.3.10.1 (2009-11-24)Import hooks functionality from zope.component after it was moved there from
zope.site. This lifts the dependency on zope.site and thereby, ZODB.Import ISite and IPossibleSite from zope.component after they were moved
there from zope.location.3.10.0 (2009-09-25)Add an ability to forbid publishing of some files in the resource directory,
this is done by fnmatch’ing the wildcards in theforbidden_names``classattribute of ``DirectoryResource. By default, the.svnis in that
attribute, so directories won’t publish subversion system directory that can
contain private information.3.9.0 (2009-08-27)Initial release. This package was splitted off zope.app.publisher as a part
of refactoring process.Additional changes that are made during refactoring:Resource class for file resources are now selected the pluggable way.
The resource directory publisher and browser:resource ZCML directive
now creating file resources using factory utility lookup based on the
file extension, so it’s now possible to add new resource types without
introducing new ZCML directives and they will work inside resource
directories as well.NOTE: the “resource_factories” attribute from the DirectoryResource
was removed, so if you were using this attribute for changing resource
classes for some file extensions, you need to migrate your code to new
utility-based mechanism.See zope.browserresource.interfaces.IResourceFactoryFactory interface.The Image resource class was removed, as they are actually simple files.
To migrate, simply rename the “image” argument in browser:resource and
browser:i18n-resource directives to “file”, if you don’t do this, resouces
will work, but you’ll get deprecation warnings.If you need custom behaviour for images, you can register a resource
factory utility for needed file extensions.The PageTemplateResource was moved into a separate package, “zope.ptresource”,
which is a plugin for this package now. Because of that, the “template”
argument of browser:resource directive was deprecated and you should rename
it to “file” to migrate. The PageTemplateResource will be created for
“pt”, “zpt” and “html” files automatically, if zope.ptresource package is
included in your configuration.Fix stripping the “I” from an interface name for icon title, if no
title is specified.When publishing a resource via Resources view, set resource parent
to an ISite object, not to current site manager.Clean up code and improve test coverage. |
zope.cachedescriptors | zope.cachedescriptorsCached descriptors cache their output. They take into account
instance attributes that they depend on, so when the instance
attributes change, the descriptors will change the values they
return.Cached descriptors cache their data in_v_attributes, so they are
also useful for managing the computation of volatile attributes for
persistent objects.Persistent descriptors:propertyA simple computed property.Seesrc/zope/cachedescriptors/property.rst.methodIdempotent method. The return values are cached based on method
arguments and on any instance attributes that the methods are
defined to depend on.NoteOnly a cache based on arguments has been implemented so far.Seesrc/zope/cachedescriptors/method.rst.Cached PropertiesCached properties are computed properties that cache their computed
values. They take into account instance attributes that they depend
on, so when the instance attributes change, the properties will change
the values they return.CachedPropertyCached properties cache their data in_v_attributes, so they are
also useful for managing the computation of volatile attributes for
persistent objects. Let’s look at an example:>>> from zope.cachedescriptors import property
>>> import math>>> class Point:
...
... def __init__(self, x, y):
... self.x, self.y = x, y
...
... @property.CachedProperty('x', 'y')
... def radius(self):
... print('computing radius')
... return math.sqrt(self.x**2 + self.y**2)>>> point = Point(1.0, 2.0)If we ask for the radius the first time:>>> '%.2f' % point.radius
computing radius
'2.24'We see that the radius function is called, but if we ask for it again:>>> '%.2f' % point.radius
'2.24'The function isn’t called. If we change one of the attribute the
radius depends on, it will be recomputed:>>> point.x = 2.0
>>> '%.2f' % point.radius
computing radius
'2.83'But changing other attributes doesn’t cause recomputation:>>> point.q = 1
>>> '%.2f' % point.radius
'2.83'Note that we don’t have any non-volitile attributes added:>>> names = [name for name in point.__dict__ if not name.startswith('_v_')]
>>> names.sort()
>>> names
['q', 'x', 'y']For backwards compatibility, the same thing can alternately be written
without using decorator syntax:>>> class Point:
...
... def __init__(self, x, y):
... self.x, self.y = x, y
...
... def radius(self):
... print('computing radius')
... return math.sqrt(self.x**2 + self.y**2)
... radius = property.CachedProperty(radius, 'x', 'y')>>> point = Point(1.0, 2.0)If we ask for the radius the first time:>>> '%.2f' % point.radius
computing radius
'2.24'We see that the radius function is called, but if we ask for it again:>>> '%.2f' % point.radius
'2.24'The function isn’t called. If we change one of the attribute the
radius depends on, it will be recomputed:>>> point.x = 2.0
>>> '%.2f' % point.radius
computing radius
'2.83'Documentation and the__name__are preserved if the attribute is accessed through
the class. This allows Sphinx to extract the documentation.>>> class Point:
...
... def __init__(self, x, y):
... self.x, self.y = x, y
...
... @property.CachedProperty('x', 'y')
... def radius(self):
... '''The length of the line between self.x and self.y'''
... print('computing radius')
... return math.sqrt(self.x**2 + self.y**2)>>> print(Point.radius.__doc__)
The length of the line between self.x and self.y
>>> print(Point.radius.__name__)
radiusIt is possible to specify a CachedProperty that has no dependencies.
For backwards compatibility this can be written in a few different ways:>>> class Point:
... def __init__(self, x, y):
... self.x, self.y = x, y
...
... @property.CachedProperty
... def no_deps_no_parens(self):
... print("No deps, no parens")
... return 1
...
... @property.CachedProperty()
... def no_deps(self):
... print("No deps")
... return 2
...
... def no_deps_old_style(self):
... print("No deps, old style")
... return 3
... no_deps_old_style = property.CachedProperty(no_deps_old_style)
>>> point = Point(1.0, 2.0)
>>> point.no_deps_no_parens
No deps, no parens
1
>>> point.no_deps_no_parens
1
>>> point.no_deps
No deps
2
>>> point.no_deps
2
>>> point.no_deps_old_style
No deps, old style
3
>>> point.no_deps_old_style
3Lazy Computed AttributesThepropertymodule provides another descriptor that supports a
slightly different caching model: lazy attributes. Like cached
proprties, they are computed the first time they are used. however,
they aren’t stored in volatile attributes and they aren’t
automatically updated when other attributes change. Furthermore, the
store their data using their attribute name, thus overriding
themselves. This provides much faster attribute access after the
attribute has been computed. Let’s look at the previous example using
lazy attributes:>>> class Point:
...
... def __init__(self, x, y):
... self.x, self.y = x, y
...
... @property.Lazy
... def radius(self):
... print('computing radius')
... return math.sqrt(self.x**2 + self.y**2)>>> point = Point(1.0, 2.0)If we ask for the radius the first time:>>> '%.2f' % point.radius
computing radius
'2.24'We see that the radius function is called, but if we ask for it again:>>> '%.2f' % point.radius
'2.24'The function isn’t called. If we change one of the attribute the
radius depends on, it still isn’t called:>>> point.x = 2.0
>>> '%.2f' % point.radius
'2.24'If we want the radius to be recomputed, we have to manually delete it:>>> del point.radius>>> point.x = 2.0
>>> '%.2f' % point.radius
computing radius
'2.83'Note that the radius is stored in the instance dictionary:>>> '%.2f' % point.__dict__['radius']
'2.83'The lazy attribute needs to know the attribute name. It normally
deduces the attribute name from the name of the function passed. If we
want to use a different name, we need to pass it:>>> def d(point):
... print('computing diameter')
... return 2*point.radius>>> Point.diameter = property.Lazy(d, 'diameter')
>>> '%.2f' % point.diameter
computing diameter
'5.66'Documentation and the__name__are preserved if the attribute is accessed through
the class. This allows Sphinx to extract the documentation.>>> class Point:
...
... def __init__(self, x, y):
... self.x, self.y = x, y
...
... @property.Lazy
... def radius(self):
... '''The length of the line between self.x and self.y'''
... print('computing radius')
... return math.sqrt(self.x**2 + self.y**2)>>> print(Point.radius.__doc__)
The length of the line between self.x and self.y
>>> print(Point.radius.__name__)
radiusThe documentation of the attribute when accessed through the
instance will be the same as the return-value:>>> p = Point(1.0, 2.0)
>>> p.radius.__doc__ == float.__doc__
computing radius
TrueThis is the same behaviour as the standard Pythonpropertydecorator.readpropertyreadproperties are like lazy computed attributes except that the
attribute isn’t set by the property:>>> class Point:
...
... def __init__(self, x, y):
... self.x, self.y = x, y
...
... @property.readproperty
... def radius(self):
... print('computing radius')
... return math.sqrt(self.x**2 + self.y**2)>>> point = Point(1.0, 2.0)>>> '%.2f' % point.radius
computing radius
'2.24'>>> '%.2f' % point.radius
computing radius
'2.24'But youcanreplace the property by setting a value. This is the major
difference to the builtinproperty:>>> point.radius = 5
>>> point.radius
5Documentation and the__name__are preserved if the attribute is accessed through
the class. This allows Sphinx to extract the documentation.>>> class Point:
...
... def __init__(self, x, y):
... self.x, self.y = x, y
...
... @property.readproperty
... def radius(self):
... '''The length of the line between self.x and self.y'''
... print('computing radius')
... return math.sqrt(self.x**2 + self.y**2)>>> print(Point.radius.__doc__)
The length of the line between self.x and self.y
>>> print(Point.radius.__name__)
radiuscachedInThecachedInproperty allows to specify the attribute where to store the
computed value:>>> class Point:
...
... def __init__(self, x, y):
... self.x, self.y = x, y
...
... @property.cachedIn('_radius_attribute')
... def radius(self):
... print('computing radius')
... return math.sqrt(self.x**2 + self.y**2)>>> point = Point(1.0, 2.0)>>> '%.2f' % point.radius
computing radius
'2.24'>>> '%.2f' % point.radius
'2.24'The radius is cached in the attribute with the given name,_radius_attributein this case:>>> '%.2f' % point._radius_attribute
'2.24'When the attribute is removed the radius is re-calculated once. This allows
invalidation:>>> del point._radius_attribute>>> '%.2f' % point.radius
computing radius
'2.24'>>> '%.2f' % point.radius
'2.24'Documentation is preserved if the attribute is accessed through
the class. This allows Sphinx to extract the documentation.>>> class Point:
...
... def __init__(self, x, y):
... self.x, self.y = x, y
...
... @property.cachedIn('_radius_attribute')
... def radius(self):
... '''The length of the line between self.x and self.y'''
... print('computing radius')
... return math.sqrt(self.x**2 + self.y**2)>>> print(Point.radius.__doc__)
The length of the line between self.x and self.yMethod CachecachedInThecachedInproperty allows to specify the attribute where to store the
computed value:>>> import math
>>> from zope.cachedescriptors import method>>> class Point(object):
...
... def __init__(self, x, y):
... self.x, self.y = x, y
...
... @method.cachedIn('_cache')
... def distance(self, x, y):
... """Compute the distance"""
... print('computing distance')
... return math.hypot(self.x - x, self.y - y)
...
>>> point = Point(1.0, 2.0)The value is computed once:>>> point.distance(2, 2)
computing distance
1.0
>>> point.distance(2, 2)
1.0Using different arguments calculates a new distance:>>> point.distance(5, 2)
computing distance
4.0
>>> point.distance(5, 2)
4.0The data is stored at the given_cacheattribute:>>> isinstance(point._cache, dict)
True>>> sorted(point._cache.items())
[(((2, 2), ()), 1.0), (((5, 2), ()), 4.0)]It is possible to exlicitly invalidate the data:>>> point.distance.invalidate(point, 5, 2)
>>> point.distance(5, 2)
computing distance
4.0Invalidating keys which are not in the cache, does not result in an error:>>> point.distance.invalidate(point, 47, 11)The documentation of the function is preserved (whether through the
instance or the class), allowing Sphinx to extract it:>>> print(point.distance.__doc__)
Compute the distance
>>> print(point.distance.__name__)
distance
>>> print(Point.distance.__doc__)
Compute the distance
>>> print(Point.distance.__name__)
distanceIt is possible to pass in a factory for the cache attribute. Create another
Point class:>>> class MyDict(dict):
... pass
>>> class Point(object):
...
... def __init__(self, x, y):
... self.x, self.y = x, y
...
... @method.cachedIn('_cache', MyDict)
... def distance(self, x, y):
... print('computing distance')
... return math.sqrt((self.x - x)**2 + (self.y - y)**2)
...
>>> point = Point(1.0, 2.0)
>>> point.distance(2, 2)
computing distance
1.0Now the cache is a MyDict instance:>>> isinstance(point._cache, MyDict)
TrueChanges5.0 (2023-03-27)Add support for Python 3.11.Drop support for Python 2.7, 3.5, 3.6.4.4 (2022-09-07)Drop support for Python 3.4.Add support for Python 3.7, 3.8, 3.9, 3.10.4.3.1 (2017-12-09)Fix test which will break in the upcoming Python 3.7 release.4.3.0 (2017-07-27)Add support for Python 3.6.Drop support for Python 3.3.4.2.0 (2016-09-05)Add support for Python 3.5.Drop support for Python 2.6 and 3.2.The properties from thepropertymodule all preserve the
documentation string of the underlying function, and all exceptcachedInpreserve everything thatfunctools.update_wrapperpreserves.property.CachedPropertyis usable as a decorator, with or
without dependent attribute names.method.cachedInpreserves the documentation string of the
underlying function, and everything else thatfunctools.wrapspreserves.4.1.0 (2014-12-26)Add support for PyPy and PyPy3.Add support for Python 3.4.Add support for testing on Travis.4.0.0 (2013-02-13)Drop support for Python 2.4 and 2.5.Add support for Python 3.2 and 3.3.3.5.1 (2010-04-30)Remove undeclared testing dependency on zope.testing.3.5.0 (2009-02-10)Remove dependency on ZODB by allowing to specify storage factory forzope.cachedescriptors.method.cachedInwhich is nowdictby default.
If you need to use BTree instead, you must pass it asfactoryargument
to thezope.cachedescriptors.method.cachedIndecorator.Remove zpkg-related file.Clean up package description and documentation a bit.Change package mailing list address to zope-dev at zope.org, as
zope3-dev at zope.org is now retired.3.4.0 (2007-08-30)Initial release as an independent package |
zope.catalog | zope.catalogCatalogs provide management of collections of related indexes with a basic
search algorithm.Changes5.0 (2023-09-01)Drop support for Python 2.7, 3.5, 3.6.Drop support for deprecatedpython setup.py test.Add support for Python 3.11.4.4.1 (2022-09-01)Fix deprecation warning.4.4.0 (2022-04-06)Add support for Python 3.7, 3.8, 3.9, 3.10.Drop support for Python 3.4.4.3.0 (2021-03-19)Drop support for Python 3.3.Replace deprecated usage ofzope.site.hookswithzope.component.hooks.Replace deprecated test usage ofzope.component.interfaces.IComponentLookupwith the proper
import fromzope.interface. This only impacted testing this
package.4.2.1 (2017-05-09)Fix the definition ofIAttributeIndexto specify aNativeStringLineinstead of aBytesLine. Bytes cannot be
used withgetattron Python 3.
Seeissue 7.4.2.0 (2017-05-05)Add support for Python 3.5 and 3.6.Drop support for Python 2.6.Fix the text index throwing aWrongTypeerror on import in
Python 3. Seeissue 5.4.1.0 (2015-06-02)Replace use of long-deprecatedzope.testing.doctestwith stdlib’sdoctest.Add support for PyPy (PyPy3 support is blocked on a PyPy3-compatible
release ofzodbpickle).Convert doctests to Sphinx documentation, including building docs
and running doctest snippets undertox.4.0.0 (2014-12-24)Add support for Python 3.4.4.0.0a1 (2013-02-25)Add support for Python 3.3.Replace deprecatedzope.interface.implementsusage with equivalentzope.interface.implementerdecorator.Drop support for Python 2.4 and 2.5.3.8.2 (2011-11-29)Conform to repository policy.3.8.1 (2009-12-27)Removzope.app.testingdependency.3.8.0 (2009-02-01)Move core functionality fromzope.app.catalogto this package.
Thezope.app.catalogpackage now only contains ZMI-related browser
views and backward-compatibility imports. |
zope.component | zope.componentNoteThis package is intended to be independently reusable in any Python
project. It is maintained by theZope Toolkit project.This package represents the core of the Zope Component Architecture.
Together with thezope.interfacepackage, it provides facilities for
defining, registering and looking up components.Please seehttps://zopecomponent.readthedocs.io/en/latest/for the
documentation.Changes6.0 (2023-04-14)Drop support for Python 2.7, 3.5, 3.6.5.1.0 (2023-01-03)Fix crash when the environment variablePYTHONOPTIMIZEDis set to2and docstrings are set toNoneby the interpreter.
(#67)Add support for Python 3.10 and 3.11.5.0.1 (2021-07-09)Fix unregistering utilities on old persistent adapter registries.
Previously this could raiseTypeError. Seeissue 62.5.0.0 (2021-03-19)Remove backwards compatibility imports that were emitting
deprecation warnings. This affects certain imports fromzope.component.interfaces(which should be imported fromzope.interface.interfaces) as well as certain imports fromzope.component.registery(import fromzope.interface.registry), and the entirezope.component.hookablemodule. Seeissue 59.Respect permission value for utility factory registrations
(#54)Add support for Python 3.9Fix the<subscriber>ZCML directive to allow a missingprovides=attribute when afactory=is given and the Python
object has been decorated with@implementerand implements a
single interface. This has been documented, but hasn’t worked
before. Seeissue 9.MakePersistentAdapterRegistryuse persistent objects
(PersistentMappingandPersistentList) for its internal data
structures instead of plain dicts and lists. This helps make it
scalable to larger registry sizes.This requires zope.interface 5.3.0a1 or later.New registries (and their primary users,PersistentComponentsand
zope.site’sLocalSiteManager) take full advantage of this
automatically. For existing persistent registries to take advantage
of this, you must call theirrebuild()method and commit the
transaction.Seeissue 51.Fixzope.interface.interface.provideInterfaceand the various
search and query methods to use the current site manager instead of
always using the global site manager. (provideInterfaceis
called implicitly when registering components from ZCML.) The search
and query methods continue to return interfaces registered in base
site managers.Seeissue 10.4.6.2 (2020-07-03)Improve the documentation, both published and in docstrings. SeePR
49.4.6.1 (2020-03-23)Ensure the resolution order ofBaseGlobalComponentsis
consistent. Seeissue 45.4.6.0 (2019-11-12)Add support for Python 3.8.Drop support for Python 3.4.Fix tests on Python 2 following changes in ZODB 5.5.0.4.5.0 (2018-10-10)Add support for Python 3.7.Always installzope.hookableas a dependency (thehookextra is now empty).zope.hookablerespects the PURE_PYTHON
environment variable, and has an optional C extension.Make accessing names that have been moved tozope.interfaceproduce aDeprecationWarning.4.4.1 (2017-09-26)Remove obsolete call ofsearchInterfacefrominterfaceToName. Seehttps://github.com/zopefoundation/zope.component/issues/324.4.0 (2017-07-25)Add support for Python 3.6.Drop support for Python 3.3.Drop support for “setup.py test”.Code coverage reports are nowproduced and hosted by coveralls.io, and
PRs must keep them at 100%.Internal test code inzope.component.testfileshas been adjusted
and in some cases removed.4.3.0 (2016-08-26)When testingPURE_PYTHONenvironments undertox, avoid poisoning
the user’s global wheel cache.Drop support for Python 2.6 and 3.2.Add support for Python 3.5.4.2.2 (2015-06-04)Fix test cases for PyPy and PyPy3.4.2.1 (2014-03-19)Add support for Python 3.4.4.2.0 (2014-02-05)Updateboostrap.pyto version 2.2.Reset the cachedadapter_hooksatzope.testing.cleanup.cleanUptime (LP1100501).Implement ability to specify adapter and utility names in Python. Use
[email protected](name)decorator to specify the name.4.1.0 (2013-02-28)Change “ZODB3” depdendency to “persistent”.toxnow runs all tests for Python 3.2 and 3.3.Enable buildout for Python 3.Fix new failing tests.4.0.2 (2012-12-31)Flesh out PyPI Trove classifiers.4.0.1 (2012-11-21)Add support for Python 3.3.4.0.0 (2012-07-02)Add PyPy and Python 3.2 support:Security support omitted untilzope.securityported.Persistent registry support omitted untilZODBported (orpersistentfactored out).Bring unit test coverage to 100%.Remove the long-deprecatedlayerargument to thezope.component.zcml.viewandzope.component.zcml.resourceZCML directives.Add support for continuous integration usingtoxandjenkins.Got tests to run usingsetup.py test.AddSphinxdocumentation.Addsetup.py docsalias (installsSphinxand dependencies).Addsetup.py devalias (runssetup.py developplus installsnoseandcoverage).3.12.1 (2012-04-02)Wrapwith site(foo)in try/finally (LP768151).3.12.0 (2011-11-16)Add convenience function zope.component.hooks.site (a contextmanager),
so one can writewith site(foo): ....3.11.0 (2011-09-22)Move code fromzope.component.registrywhich implements a basic
nonperistent component registry tozope.interface.registry. This code
was moved fromzope.componentintozope.interfaceto make porting
systems (such as Pyramid) that rely only on a basic component registry to
Python 3 possible without needing to port the entirety of thezope.componentpackage. Backwards compatibility import shims have been
left behind inzope.component, so this change will not break any
existing code.Move interfaces fromzope.component.interfacestozope.interface.interfaces:ComponentLookupError,Invalid,IObjectEvent,ObjectEvent,IComponentLookup,IRegistration,IUtilityRegistration,IAdapterRegistration,ISubscriptionAdapterRegistration,IHandlerRegistration,IRegistrationEvent,RegistrationEvent,IRegistered,Registered,IUnregistered,Unregistered,IComponentRegistry, andIComponents. Backwards compatibility shims
left in place.Depend onzope.interface>= 3.8.0.3.10.0 (2010-09-25)Remove thedocsextra and thesphinxdocrecipe.Create asecurityextra to move security-related dependencies out of thetestextra.Use the newzope.testrunnerpackage for tests.Add a basic test for theconfigure.zcmlfile provided.3.9.5 (2010-07-09)Fix test requirements specification.3.9.4 (2010-04-30)Prefer the standard librarydoctestto the one fromzope.testing.3.9.3 (2010-03-08)The ZCML directives provided byzope.componentnow register the
components in the registry returned bygetSiteManagerinstead of the
global registry. This change allows the hooking of thegetSiteManagermethod before the load of a ZCML file to register the components in a
custom registry.3.9.2 (2010-01-22)Fix a bug introduced by recent refactoring, where passingCheckerPublictosecurityAdapterFactorywrongly wrapped the factory
into aLocatingUntrustedAdapterFactory.3.9.1 (2010-01-21)Modify the tests to avoid allowing the tested testrunner to be influenced
by options of the outer testrunner, such a the-voption.3.9.0 (2010-01-21)Add testlayer support. It is now possible to load a ZCML file within
tests more easily. Seesrc/zope/component/testlayer.pyandsrc/zope/component/testlayer.txt.3.8.0 (2009-11-16)Remove the dependencies onzope.proxyandzope.securityfrom the
zcml extra:zope.componentno longer has a hard dependency on them;
the support for security proxied components ZCML registrations is enabled
only ifzope.securityandzope.proxyare available.Move theIPossibleSiteandISiteinterfaces here fromzope.locationas they are dealing withzope.component’s concept of
a site, but not with location.Move thezope.site.hooksfunctionality tozope.component.hooksas it
isn’t actually dealing withzope.site’s concept of a site.3.7.1 (2009-07-24)Fix a problem, wherequeryNextUtilitycould fail if the context could
not be adapted to aIComponentLookup.Fix 2 related bugs:When a utility is registered and there was previously a utility
registered for the same interface and name, then the old utility is
unregistered. The 2 bugs related to this:There was noUnregisteredfor the implicit unregistration. Now
there is.The old utility was still held and returned bygetAllUtilitiesRegisteredFor. In other words, it was still
considered registered, eeven though it wasn’t. A particularly
negative consequence of this is that the utility is held in memory
or in the database even though it isn’t used.3.7.0 (2009-05-21)Ensure thatHookableTestsare run by the testrunner.Addzope:viewandzope:resourceimplementations intozope.component.zcml(dependency loaded withzope.component [zcml]).3.6.0 (2009-03-12)IMPORTANT: the interfaces that were defined in thezope.component.bbb.interfacesand deprecated for years are
now (re)moved. However, some packages, including part of zope
framework were still using those interfaces. They will be adapted
for this change. If you were using some of those interfaces, you
need to adapt your code as well:MoveIViewandIDefaultViewNametozope.publisher.interfaces.MoveIResourcetozope.app.publisher.interfaces.RemoveIContextDependent,IPresentation,IPresentationRequest,IResourceFactory, andIViewFactorycompletely.If you usedIViewFactoryin context ofzope.app.form, there’s nowIWidgetFactoryin thezope.app.form.interfacesinstead.MovegetNextUtility/queryNextUtilityfunctions here fromzope.site(they were inzope.app.componenteven earlier).Add a pure-Pythonhookableimplementation, for use whenzope.hookableis not present.Remove use ofzope.deferredimportby breaking import cycles.Cleanup package documentation and changelog a bit. Add sphinx-based
documentation building command to the buildout.Remove deprecated code.Change package’s mailing list address to zope-dev at zope.org, because
zope3-dev at zope.org is now retired.3.5.1 (2008-07-25)Fix bug introduced in 3.5.0:<utilityfactory="...">no longer supported
interfaces declared in Python and always wanted an explicitprovides="..."attribute.https://bugs.launchpad.net/zope3/+bug/2518653.5.0 (2008-07-25)Support registration of utilities via factories through the component
registry and return factory information in the registration information.
Fixeshttps://bugs.launchpad.net/zope3/+bug/240631Optimizeun/registerUtilityby storing an optimized data structure for
efficient retrieval of already registered utilities. This avoids looping over
all utilities when registering a new one.3.4.0 (2007-09-29)No further changes since 3.4.0a1.3.4.0a1 (2007-04-22)Corresponds tozope.componentfrom Zope 3.4.0a1.In the Zope 3.3.x series,zope.componentwas simplified yet once
more. Seehttp://wiki.zope.org/zope3/LocalComponentManagementSimplificationfor the proposal describing the changes.3.2.0.2 (2006-04-15)Fix packaging bug:package_dirmust be arelativepath.3.2.0.1 (2006-04-14)Packaging change: suppress inclusion ofsetup.cfginsdistbuilds.3.2.0 (2006-01-05)Corresponds to the verison of thezope.componentpackage shipped as part
of the Zope 3.2.0 release.Deprecated services and related APIs. The adapter and utility registries
are now available directly via the site manager’s ‘adapters’ and ‘utilities’
attributes, respectively. Services are accessible, but deprecated, and
will be removed in Zope 3.3.Deprecated all presentation-related APIs, including all view-related
API functions. Use the adapter API functions instead.
Seehttp://dev.zope.org/Zope3/ImplementViewsAsAdapters`Deprecatedcontextdependentpackage: site managers are now looked up
via a thread global, set during URL traversal. Thecontextargument
is now always optional, and should no longer be passed.3.0.0 (2004-11-07)Corresponds to the verison of thezope.componentpackage shipped as part of
the Zope X3.0.0 release. |
zope.componentvocabulary | zope.componentvocabularyThis package contains various vocabularies.Changes2.3.0 (2021-12-17)Add support for Python 3.8, 3.9, and 3.10.Drop support for Python 3.4.2.2.0 (2018-10-19)Add support for Python 3.7.Drop support forsetup.py test.2.1.0 (2017-07-25)Add support for Python 3.5 and 3.6.Drop support for Python 2.6 and 3.3.2.0.0 (2014-12-24)Added support for PyPy. (PyPy3 is pending release of a fix for:https://bitbucket.org/pypy/pypy/issue/1946)Add support for Python 3.4.Add support for testing on Travis.2.0.0a1 (2013-02-25)Add support for Python 3.3.Replace deprecatedzope.interface.classProvidesusage with equivalentzope.interface.providerdecorator.Replace deprecatedzope.interface.implementsusage with equivalentzope.interface.implementerdecorator.Drop support for Python 2.4 and 2.5.When loading this package’s ZCML configuration, make sure to configurezope.componentfirst since we require part of its configuration.1.0.1 (2010-09-25)Add undeclared but needed dependency onzope.component.Add test extra to declare test dependency onzope.component[test].1.0 (2009-05-19)Initial public release, derived from zope.app.component and
zope.app.interface to replace them. |
zope.configuration | zope.configurationThe Zope configuration system provides an extensible system for
supporting various kinds of configurations.It is based on the idea of configuration directives. Users of the
configuration system provide configuration directives in some
language that express configuration choices. The intent is that the
language be pluggable. An XML language is provided by default.Please seehttp://zopeconfiguration.readthedocs.io/en/latest/for the documentation.Changes5.0.1 (2024-02-12)Fix tests when running from a distribution.5.0 (2023-05-04)Drop support for Python 2.7, 3.5, 3.6.Add support for Python 3.11.4.4.1 (2022-04-07)Avoid creating reference cycles through tracebacks inreraise(change
imported fromsix).Add support for Python 3.9, 3.10.4.4.0 (2020-03-22)Ensure a consistent interface resolution order for all objects. Seeissue 49.Drop support for Python 3.4.Add support for Python 3.8.4.3.1 (2019-02-12)Do not break when running the tests from a wheel.4.3.0 (2018-10-01)Simplify exception chaining and nested exception error messages.
Seeissue 43.4.2.2 (2018-09-27)FixGlobalObject(andGlobalInterface) no longer allowing
multiple leading dots. Seeissue 41.Add__all__to all modules listing the documented members of
the module. Note that this is currently a broad list and may be
reduced in the future.4.2.1 (2018-09-26)FixGlobalObject(andGlobalInterface) no longer allowing
just a single ‘.’. Seeissue 35.4.2.0 (2018-09-26)Reach 100% automated test coverage.Add support for Python 3.7.Drop support for Python 3.3 and remove internal compatibility
functions needed to support it. Seeissue 20andissue 26.Drop support forpython setup.py test.Makezope.configuration.fields.Pathandzope.configuration.config.ConfigurationContextexpand
environment variables and expand user home directories in paths. Seeissue 3.Fix resolving names from a Python 2 package whose__init__.pyhas
unicode elements in__all__.MakeGroupingContextDecoratorstop shadowing builtins in its__getattr__. These were not intended as arguments to be used by
subclasses, and the signature caused confusion.Fix the doctests with zope.schema 4.7 and above, and run the
doctests on both Python 2 and Python 3. Seeissue 21.FixGlobalObjectandGlobalInterfacefields to only accept
dotted names instead of names with/. Previously, slash
delimited names could result in incorrect imports. Seeissue 6.Fix the schema fields to include thevalueandfieldvalues
on exceptions they raise.Makezope.configuration.fields.PythonIdentifiersubclassPythonIdentifierfromzope.schema. It now implementsfromBytes,
always produces a native string, and validates the value infromUnicode. Seeissue 28.AddConfigurationMachine.pass_through_exceptionsto allow
customizing the exceptions thatConfigurationMachine.execute_actionswraps in aConfigurationExecutionError. Seeissue 10.Stop catchingBaseExceptionand wrapping it in eitherConfigurationExecutionErrororZopeXMLConfigurationError.SystemExitandKeyboardInterruptwere always allowed to
propagate; nowGeneratorExitand custom subclasses ofBaseExceptionare also allowed te propagate.4.1.0 (2017-04-26)Drop support for Python 2.6 and 3.2.Add support for Python 3.5 and 3.6.Fix thedomainof MessageID fields to be a native string.
Previously on Python 3 they were bytes, which meant that they
couldn’t be used to find translation utilities registered by
zope.i18n. Seeissue 17.4.0.3 (2014-03-19)Add explicit support for Python 3.4.4.0.2 (2012-12-31)Flesh out PyPI Trove classifiers.Remove spurious declaration of ‘test’ dependency onzope.testing.4.0.1 (2012-11-21)Add support for Python 3.3.Remove the deprecated ‘zope.configuration.stxdocs’ script.
and made the ‘zope.configuration.tests.conditions’ helper module
(used in running Sphinx doctest snippets) Py3k compatible.https://bugs.launchpad.net/zope.configuration/+bug/10253904.0.0 (2012-05-16)Bring unit test coverage to 100%.Automate build of Sphinx HTML docs and running doctest snippets via tox.Drop hard testing dependency onzope.testing.Add explicit support for PyPy.Add explicit support for Python 3.2.Drop explicit support for Python 2.4 / 2.5.Add support for continuous integration usingtoxandjenkins.AddSphinxdocumentation.Addsetup.py docsalias (installsSphinxand dependencies).Addsetup.py devalias (runssetup.py developplus installsnoseandcoverage).3.8.1 (2012-05-05)Fix Python 2.4 backwards incompat (itemgetter used with multiple args);
Python 2.4 now works (at least if you use zope.schema == 3.8.1).
This is the last release which will support Python 2.4 or 2.5.3.8.0 (2011-12-06)Change action structures from tuples to dictionaries to allow for action
structure extensibility (merged chrism-dictactions branch).3.7.4 (2011-04-03)Apply test fixes for Windows.3.7.3 (2011-03-11)Correctly locate packages with a __path__ attribute but no
__file__ attribute (such as namespace packages installed with setup.py
install –single-version-externally-managed).Allow “info” and “includepath” to be passed optionally to context.action.3.7.2 (2010-04-30)Prefer the standard libraries doctest module over zope.testing.doctest.3.7.1 (2010-01-05)Jython support: use__builtin__module import rather than assuming__builtins__is available.Jython support: deal with the fact that the Jython SAX parser
returns attribute sets that have an empty string indicating no
namespace instead ofNone.Allowsetup.py testto run at least a subset of the tests that
would be run when using the zope testrunner:setup.py testruns
53 tests, whilebin/testruns 156.3.7.0 (2009-12-22)Adjust testing output to newer zope.schema.Prefer zope.testing.doctest over doctestunit.3.6.0 (2009-04-01)Removed dependency ofzope.deprecationpackage.Don’t suppress deprecation warnings any more in ‘zope.configuration’
package level. This makes it more likely other packages will generate
deprecation warnings now, which will allow us to remove more
outdated ones.Don’t fail when zope.testing is not installed.Added missingprocessFilemethod toIConfigurationContext.
It is already implemented in the mix-in class,zope.configuration.config.ConfigurationContext, and used by
implementations ofincludeandexcludedirectives.3.5.0 (2009-02-26)Added theexcludedirective to standard directives. It was
previously available viazc.configurationpackage and now it’s
merged intozope.configuration.Changed package’s mailing list address to zope-dev at zope.org,
change “cheeseshop” to “pypi” in the package’s url.3.4.1 (2008-12-11)Use built-in ‘set’ type, rather than importin the ‘sets’ module,
which is deprecated in Python 2.6.Added support to bootstrap on Jython.3.4.0 (2007-10-02)Initial release as a standalone package.Before 3.4.0This package was part of the Zope 3 distribution and did not have its own
CHANGES.txt. For earlier changes please refer to either our subversion log or
the CHANGES.txt of earlier Zope 3 releases. |
zope.container | zope.containerThis package define interfaces of container components, and provides
container implementations such as a BTreeContainer and
OrderedContainer, as well as the base class used byzope.site.folderfor the Folder implementation.Documentation is hosted athttps://zopecontainer.readthedocs.ioChanges5.2 (2023-10-05)Add support for Python 3.12.5.1 (2023-04-24)Drop usingsetup_requiresdue to constant problems on GHA.Add preliminary support for Python 3.12a7.5.0 (2023-01-24)Build Linux binary wheels for Python 3.11.Drop support for Python 2.7, 3.5, 3.6.4.10 (2022-11-17)Release to rebuild a full set of binary wheels.4.9 (2022-11-16)Add support for building arm64 wheels on macOS.4.8 (2022-11-06)Add support for final Python 3.11 release.4.7 (2022-09-15)Disable unsafe math optimizations in C code. Seepull request 46.4.6 (2022-07-14)Add support for Python 3.11 (as of 3.11.0b3).4.5.0 (2021-11-19)Add support for Python 3.9 and 3.10.4.4.0 (2020-04-02)Support thePURE_PYTHONenvironment variable at runtime instead
of just at wheel build time. A value of 0 forces the C extensions to
be used failing if they aren’t present. Any other value forces the
Python implementation to be used, ignoring the C extensions.Drop support for the deprecatedpython setup.py testcommand.Ensure all objects have consistent interface resolution orders. This
may slightly change the order of interfaces forContainedProxyobjects. Seeissue 34.Stop including outdated versions ofzope.proxy(implementation)
andpersistentheaders. Instead, locate and use the installed
versions. Seeissue 32.NoteThis adds those two dependencies tosetup_requires.4.3.0 (2019-11-11)Add support for Python 3.8.Drop support for Python 3.4.4.2.2 (2018-08-10)Add a dependency onzope.cachedescriptors, previously removed in
3.11.zope.cachedescriptorsis a lightweight package, and the
copied code had diverged from the source. Seehttps://github.com/zopefoundation/zope.container/issues/16Fix the possibility of a rare crash in the C extension when deallocating items. Seehttps://github.com/zopefoundation/zope.container/issues/24Add support for Python 3.7.4.2.1 (2017-08-02)MakeOrderedContainer.updateOrdernormalize and store text keys
the same way that__setitem__does. Fixeshttps://github.com/zopefoundation/zope.container/issues/214.2.0 (2017-07-31)Add support for Python 3.5 and 3.6.Drop support for Python 2.6 and 3.3.MakeOrderedContainerproperly store the decoded text keys for
maintaining order instead of the raw bytes. Also make it able to
accept raw bytes under Python 3 in the first place. Fixeshttps://github.com/zopefoundation/zope.container/issues/17FixOrderedContainerbecoming inconsistent if an event
subscriber threw an exception when adding an item. Seehttps://github.com/zopefoundation/zope.container/issues/18Attain 100% test coverage. Seehttps://github.com/zopefoundation/zope.container/issues/15Make the defaultNameChooseralways decode bytes using ASCII instead of
whatever the current system codec happens to be.Make the defaultNameChooserstop catchingKeyboardInterruptand otherBaseExceptiontypes when it potentially calls
user-defined code to convert a name to a text string. Instead, just
catchException.Respect thePURE_PYTHONenvironment variable at runtime in
addition to build time. This makes it possible to use the
pure-Python implementation of the container proxy on CPython for
ease of debugging. Seehttps://github.com/zopefoundation/zope.container/issues/134.1.0 (2015-05-22)Makezope.container._proxy.PyContainedProxyBaseinherit
directly fromzope.proxy.AbstractProxyBaseas well aspersistent.Persistent, removing a bunch of redundant code, and
fixing bugs in interaction with pure-Python persistence. See:https://github.com/zopefoundation/zope.container/pull/4Add direct dependencies onzope.proxyandpersistentsince we
import from them; pin them to the versions needed for pure-Python.Drop deprecated BBB imports module,zope.container.dependency.4.0.0 (2014-03-19)Add support for Python 3.4.Add support for PyPy.4.0.0a3 (2013-02-28)RestoreFolderpickle forward/backward compatibility with
version 3.12.0 after making it inherit fromBTreeContainer.4.0.0a2 (2013-02-21)Allow testing without checkouts of unreleasedzope.publisherandZODB.Add Python 3 Trove classifiers.4.0.0a1 (2013-02-20)Add support for Python 3.3.MakeFolderclass inherit fromBTreeContainerclass, so that the
IContainer interface does not need to be re-implemented. Added adataattribute for BBB.Replace deprecatedzope.component.adaptsusage with equivalentzope.component.adapterdecorator.Replace deprecatedzope.interface.implementsusage with equivalentzope.interface.implementerdecorator.Drop support for Python 2.4 and 2.5.SendIContainerModifiedEventafterthe container is modified
(LP#705600).Preserve the original exception traceback inOrderedContainer.__setitem__.Handle Broken Objects more gracefullyFix a bug that made it impossible to store None values in containers
(LP#1070719).3.12.0 (2010-12-14)Fix detection of moving folders into itself or a subfolder of itself.
(LP#118088)Fix ZCML-related tests and dependencies.Addzcmlextra dependencies.3.11.1 (2010-04-30)Prefer the standard libraries doctest module to the one fromzope.testing.Add compatibility with ZODB3 3.10 by importing theIBrokeninterface
from it directly. Once we can rely on the new ZODB3 version exclusively,
we can remove the dependency onto thezope.brokendistribution.Never fail if the suggested name is in a wrong type (#227617)checkNamefirst checks the parameter type before the emptiness.3.11.0 (2009-12-31)Copy two trivial classes fromzope.cachedescriptorsinto this package,
which allows us to remove that dependency. We didn’t actually use any
caching properties as the dependency suggested.3.10.1 (2009-12-29)Movezope.copypastemoverelated tests into that package.Remove no longer used zcml prefix from the configure file.Stop importing DocTestSuite fromzope.testing.doctestunit. Fixes
compatibility problems withzope.testing3.8.4.3.10.0 (2009-12-15)Break testing dependency onzope.app.testing.Break testing dependency onzope.app.dependableby moving the code and
tests into that package.ImportISitefromzope.componentafter it was moved there fromzope.location.3.9.1 (2009-10-18)Rerelease 3.9.0 as it had a broken Windows 2.6 egg.Mark this project as part of the ZTK.3.9.0 (2009-08-28)Previous releases should be versioned 3.9.0 as they are not pure bugfix
releases and worth a “feature” release, increasing feature version.Packages that depend on any changes introduced in version 3.8.2 or 3.8.3
should depend on version 3.9 or greater.3.8.3 (2009-08-27)MoveIXMLRPCPublisherZCML registrations for containers fromzope.app.publisher.xmlrpctozope.containerfor now.3.8.2 (2009-05-17)Rid ourselves ofIContainedinterface. This interface was moved
tozope.location.interfaces. A b/w compat import still exists
to keep old code running. Depend onzope.location>=3.5.4.Rid ourselves of the implementations ofIObjectMovedEvent,IObjectAddedEvent,IObjectRemovedEventinterfaces andObjectMovedEvent,ObjectAddedEventandObjectRemovedEventclasses. B/w compat imports still exist.
All of these were moved tozope.lifecycleevent. Depend onzope.lifecycleevent>=3.5.2.Fix a bug inOrderedContainerwhere trying to set the value for a
key that already exists (duplication error) would actually delete the
key from the order, leaving a dangling reference.Partially break dependency onzope.traversingby disusingzope.traversing.api.getPathin favor of usingILocationInfo(object).getPath(). The rest of the runtime
dependencies onzope.traversingare currently interface
dependencies.Break runtime dependency onzope.app.dependableby using a zcml
condition on the subscriber ZCML directive that registers theCheckDependencyhandler forIObjectRemovedEvent. Ifzope.app.dependableis not installed, this subscriber will never
be registered.zope.app.dependableis now a testing dependency
only.3.8.1 (2009-04-03)Fix misspackaged 3.8.03.8.0 (2009-04-03)Changeconfigure.zcmlto not depend onzope.app.component.
Fixes:https://bugs.launchpad.net/bugs/348329Move the declaration ofIOrderedContainer.updateOrderto a new, basicIOrderedinterface and letIOrderedContainerinherit it. This allows
easier reuse of the declaration.3.7.2 (2009-03-12)Fix: added missingComponentLookupError, missing since revision 95429
and missing in last release.Adapt to the move of IDefaultViewName fromzope.component.interfacestozope.publisher.interfaces.Add support for reserved names for containers. To specify reserved
names for some container, you need to provide an adapter from the
container to thezope.container.interfaces.IReservedNamesinterface.
The defaultNameChooseris now also aware of reserved names.3.7.1 (2009-02-05)Raise more “Pythonic” errors from__setitem__, losing the dependency
onzope.exceptions:ozope.exceptions.DuplicationError->KeyErrorozope.exceptions.UserError->ValueErrorMove import ofIBrokeninterface to use newzope.brokenpackage, which has no dependencies beyondzope.interface.Maketestpart pull in the extra test requirements of this package.Split thez3c.recipe.compattestconfiguration out into a new file,compat.cfg, to reduce the burden of doing standard unit tests.Strip out bogus develop eggs frombuildout.cfg.3.7.0 (2009-01-31)Split this package offzope.app.container. This package is
intended to have far less dependencies thanzope.app.container.This package also contains the container implementation that
used to be inzope.app.folder. |
zope.contentprovider | zope.contentproviderThis package provides a framework to develop componentized Web GUI
applications. Instead of describing the content of a page using a single
template or static system of templates and METAL macros, content provider
objects are dynamically looked up based on the setup/configuration of the
application.Detailed documentation is available athttps://zopecontentprovider.readthedocs.ioChanges5.0 (2023-04-14)Drop support for Python 2.7, 3.4, 3.5, 3.6.Drop support for deprecatedpython setup.py test.Add support for Python 3.8, 3.9, 3.10, 3.11.4.2.1 (2018-11-08)Fix deprecation warnings.4.2 (2018-10-05)Add support for Python 3.7.Fixed UpdateNotCalled being an instance rather than an exception class
(#4).Host documentation athttps://zopecontentprovider.readthedocs.io4.1.0 (2017-08-08)Add support for Python 3.5 and 3.6.Drop support for Python 2.6 and 3.3.4.0.0 (2014-12-24)Add support for PyPy and PyPy3.Add support for Python 3.4.Add support for testing on Travis.4.0.0a1 (2013-02-22)Add Python 3.3 support.Replace deprecatedzope.component.adaptsusage with equivalentzope.component.adapterdecorator.Replace deprecatedzope.interface.implementsusage with equivalentzope.interface.implementerdecorator.Drop support for Python 2.4 and 2.5.3.7.2 (2010-05-25)Fix unit tests broken under Python 2.4 by the switch to the standard
librarydoctestmodule.3.7.1 (2010-04-30)Prefer the standard library’sdoctestmodule to the one fromzope.testing.3.7 (2010-04-27)Sincetales:expressiontypeis now inzope.browserpage, update
conditional ZCML accordingly so it doesn’t depend on the presence ofzope.app.pagetemplateanymore.3.6.1 (2009-12-23)Ensure that ourconfigure.zcmlcan be loaded without requiring further
dependencies. It uses atales:expressiontypedirective defined inzope.app.pagetemplate.We keep that dependency optional, as not all
consumers of this package use ZCML to configure the expression type.3.6.0 (2009-12-22)Update test dependency to usezope.browserpage.3.5.0 (2009-03-18)Add very simple, but useful base class for implementing content
providers, seezope.contentprovider.provider.ContentProviderBase.Remove unneeded testing dependencies. We only needzope.testingandzope.app.pagetemplate.Remove zcml slug and old zpkg-related files.Add setuptools dependency to setup.py.Clean up package’s description and documentation a bit. Remove
duplicate text in README.Change mailing list address to zope-dev at zope.org instead of
retired one.Changecheeseshoptopypiin the package url.3.4.0 (2007-10-02)Initial release independent of the main Zope tree. |
zope.contenttype | zope.contenttypeA utility module for content-type (MIME type) handling.Functions include:Guessing a content type given a name and (optional) body data.Guessing a content type given some text.Parsing MIME types.Documentation is hosted athttps://zopecontenttype.readthedocs.io/en/latest/Change History5.1 (2023-09-21)Add some more MIME types and extensions.5.0 (2023-03-27)Add support for Python 3.11.Drop support for Python 2.7, 3.5, 3.6.Drop support for deprecatedpython setup.py test.4.6 (2022-09-07)Add support for Python 3.9, 3.10.Drop support for Python 3.4.4.5.0 (2019-12-19)Fix tests on Python 3.8
(#7).Add support for Python 3.8.4.4 (2018-10-05)Add support for Python 3.7.4.3.0 (2017-08-10)Add support for Python 3.6.Drop support for Python 3.3.Host documentation athttps://zopecontenttype.readthedocs.io4.2.0 (2016-08-26)Add support for Python 3.5.Drop support for Python 2.6.4.1.0 (2014-12-26)Add support for Python 3.4 and PyPy3.Add support for testing on Travis.4.0.1 (2013-02-20)Change the file contents argument ofguess_content_typefrom string
to bytes. This change has no effect on Python 2.4.0.0 (2013-02-11)Add some tests for better coverage.Addtox.iniand manifest.Add support for Python 3.3 and PyPy.Drop support for Python 2.4 and 2.5.3.5.5 (2011-07-27)Properly restore the HTML snippet detection, by looking at the entire string
and not just its start.3.5.4 (2011-07-26)Restore detection of HTML snippets from 3.4 series.3.5.3 (2011-03-18)Add new mime types for web fonts, cache manifest and new media formats.3.5.2 (2011-02-11)LP #717289: addvideo/x-m4vmimetype for the.m4vextension.3.5.1 (2010-03-23)LP #242321: fix IndexError raised when testing strings consisting
solely of leading whitespace.3.5.0 (2009-10-22)Move the implementation ofzope.publisher.contenttypetozope.contenttype.parse, moved tests along.3.4.3 (2009-12-28)Update mime-type for.jsto be application/javascript.3.4.2 (2009-05-28)Add MS Office 12 types based on:http://www.therightstuff.de/2006/12/16/Office+2007+File+Icons+For+Windows+SharePoint+Services+20+And+SharePoint+Portal+Server+2003.aspx3.4.1 (2009-02-04)Improvetext_type(). Based on the patch fromhttp://www.zope.org/Collectors/Zope/2355/Add missingsetuptoolsdependency to setup.py.Add reference documentation.3.4.0 (2007-09-13)First stable release as an independent package. |
zope.cooties | Popularity has its price. Tired of having to review pull requests, answer
questions about your code, participate in Reddit discussions, all to support
open source software that you’ve given to the world for free? Now you can send
potential new users heading for the hills with a simple addition to theinstall_requiresin yoursetup.py. Depending on this package will cause
the wordZopeto appear on the screen while your package is being installed,
thus dramatically reducing the support burden for releasing open source
software.All you have to do is depend onzope.cootiesand your project will obtain
transitive dependencies on two different Zope packages chosen at random at
install time, as well as any of their dependencies. Suddenly your users will
be installing ZODB or the ZCA for no apparent reason just to use your code.Try it today and give the haters more to hate. |
zope.copy | zope.copyThis package provides a pluggable mechanism for copying persistent objects.Documentation is hosted athttps://zopecopy.readthedocs.io/Changes4.3 (2022-11-29)Add support for Python 3.8, 3.9, 3.10, 3.11.Drop support for Python 3.4.4.2 (2018-10-04)Use the latest and fastest protocol when pickling and unpickling and object
during the clone operationAdd support for Python 3.7.4.1.0 (2017-07-31)Drop support for Python 2.6, 3.2 and 3.3.Add support for Python 3.5 and 3.6.Restorezope.componentas a testing requirement for running doctests.4.0.3 (2014-12-26)Add support for PyPy3.4.0.2 (2014-03-19)Add support for Python 3.3 and 3.4.Updateboostrap.pyto version 2.2.4.0.1 (2012-12-31)Flesh out PyPI Trove classifiers.4.0.0 (2012-06-13)Add support for Python 3.2.Dropzope.componentas a testing requirement. Instead, register
explicit (dummy) adapter hooks where needed.Add PyPy support.100% unit test coverage.Add support for continuous integration usingtoxandjenkins.Add Sphinx documentation: moved doctest examples to API reference.Add ‘setup.py docs’ alias (installsSphinxand dependencies).Add ‘setup.py dev’ alias (runssetup.py developplus installsnose,coverage, and testing dependencies).Drop support for Python 2.4 and 2.5.Include tests of the LocationCopyHook from zope.location.3.5.0 (2009-02-09)Initial release. The functionality was extracted fromzc.copyto
provide a generic object copying mechanism with minimal dependencies. |
zope.copypastemove | zope.copypastemoveThis package provides Copy, Paste and Move support for content
components in Zope. In particular, it defines the following
interfaces for this kind of functionality:IObjectMover,IObjectCopier,IContentItemRenamer,IPrincipalClipboardas well as standard implementations for containers and contained
objects as known from thezope.containerpackage.Changes5.0 (2023-07-06)Add support for Python 3.11.Drop support for Python 2.7, 3.5, 3.6.Drop deprecated support forpython setup.py test.4.2.1 (2022-08-25)Fix DeprecationWarnings.4.2.0 (2022-01-24)Add support for Python 3.7, 3.8, 3.9, and 3.10.Drop support for Python 3.4.4.1.0 (2017-08-04)Add support for Python 3.5 and 3.6.Drop support for Python 2.6 and 3.3.4.0.0 (2014-12-24)Add support for PyPy.Add support for Python 3.4.Add support for testing on Travis.4.0.0a1 (2013-02-24)Add support for Python 3.3.Replace deprecatedzope.component.adaptsusage with equivalentzope.component.adapterdecorator.Replace deprecatedzope.interface.implementsusage with equivalentzope.interface.implementerdecorator.Drop support for Python 2.4 and 2.5.Include zcml dependencies inconfigure.zcml, require the necessary
packages via a zcml extra, and add tests for zcml.3.8.0 (2010-09-14)Add a test that makes sure that dublin core meta data of folder contents
get updated when the folder gets copied. (Requireszope.dublincore3.8
or above.)3.7.0 (2010-09-14)Honor the name given by theIObjectMoverinOrderedContainerItemRenamer.renameItem. It now returns the new of the
obejct, too. Thanks to Marius Gedminas for the patch, and to Justin Ryan
for the test. Fixeshttps://bugs.launchpad.net/zope.copypastemove/+bug/98385.Add a check for name and container if the namechooser computes a
name which is the same as the current name.
Fixeshttps://bugs.launchpad.net/zope.copypastemove/+bug/123532Remove use ofzope.testing.doctestunitin favor of stdlib’sdoctest.Movezope.copypastemove-related tests fromzope.containerhere.3.6.0 (2009-12-16)Favorzope.principalannotationover itszope.appvariant.Avoidzope.app.componentand testing dependencies.3.5.2 (2009-08-15)Fix documentation for theIObjectCopier.copyTomethod.Add a missing dependency onzope.app.component.3.5.1 (2009-02-09)Use the newzope.copypackage for ObjectCopier to provide pluggable
copying mechanism that is not dependent onzope.locationhardly.Move theItemNotFoundErrorexception to the interfaces module as
it’s part of public API. Old import still works as we actually
use it where it was previously defined, however, the new import
place is preferred.3.5.0 (2009-01-31)Usezope.containerinstead ofzope.app.container.3.4.1 (2009-01-26)Move the test dependencies to atestextra requirement.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 tozope.copypastemovefrom Zope 3.4.0a1 |
zope.datetime | zope.datetimeFunctions to parse and format date/time strings in common formats.The documentation is hosted athttps://zopedatetime.readthedocs.io/CHANGES5.0.0 (2023-04-25)Drop support for Python 2.7, 3.5, 3.6.Add support for Python 3.10, 3.11.4.3.0 (2021-02-26)Drop support for Python 3.4.Add support for Python 3.7, 3.8 and 3.9.Prevent aDeprecationWarningin Python 3.8+ when using a parameter foriso8601_date,rfc850_date, orrfc1123_datewhich has to be
converted via its__int__method.4.2.0 (2017-08-14)Remove support for guessing the timezone name when a timestamp
exceeds the value supported by Python’slocaltimefunction. On
platforms with a 32-bittime_t, this would involve parsed values
that do not specify a timezone and are past the year 2038. Now the
underlying exception will be propagated. Previously an undocumented
heuristic was used. This is not expected to be a common issue;
Windows, as one example, always uses a 64-bittime_t, even on
32-bit platforms. Seehttps://github.com/zopefoundation/zope.datetime/issues/4Use true division on Python 2 to match Python 3, in case certain
parameters turn out to be integers instead of floating point values.
This is not expected to be user-visible, but it can arise in
artificial tests of internal functions.Add support for Python 3.5 and 3.6.Drop support for Python 2.6, 3.2 and 3.3.4.1.0 (2014-12-26)Add support for PyPy and PyPy3.Add support for Python 3.4.Add support for testing on Travis.4.0.0 (2013-02-19)Add support for Python 3.2 and 3.3.Drop support for Python 2.4 and 2.5.3.4.1 (2011-11-29)Add test cases from LP #139360 (all passed without modification to
theparsefunction).Remove unneededzope.testingdependency.3.4.0 (2007-07-20)Initial release as a separate project. |
zope.decorator | Decorator Support.DEPRECATED!CHANGES3.4.0 (2007-11-04)Initial release independent of the main Zope tree. |
zope.deferredimport | zope.deferredimportOften, especially for package modules, you want to import names for
convenience, but not actually perform the imports until necessary.
The zope.deferredimport package provided facilities for defining names
in modules that will be imported from somewhere else when used. You
can also cause deprecation warnings to be issued when a variable is
used.Documentation is hosted athttps://zopedeferredimport.readthedocs.io/Changes5.0 (2023-06-29)Drop support for Python 2.7, 3.5, 3.6.Add support for Python 3.11.4.4 (2021-12-10)Add support for Python 3.8, 3.9 and 3.10.Drop support for Python 3.4.4.3.1 (2019-08-05)Avoid race condition indeferredmodule.ModuleProxy.__getattr__#8.4.3 (2018-10-05)Add support for Python 3.7.4.2.1 (2017-10-24)Preserve the docstrings of proxied modules created withdeprecatedFrom,deferredFrom, etc. Seeissue 5.4.2.0 (2017-08-08)Add support for Python 3.5 and 3.6.Drop support for Python 2.6 and 3.3.Convert doctests to Sphinx documentation, including building docs
and running doctest snippets undertox.4.1.0 (2014-12-26)Add support for PyPy. PyPy3 support is blocked on release of fix for:https://bitbucket.org/pypy/pypy/issue/1946Add support for Python 3.4.Add support for testing on Travis.4.0.0 (2013-02-28)Add support for Python 3.3.Drop support for Python 2.4 and 2.5.3.5.3 (2010-09-25)Add test extra to declare test dependency onzope.testing.3.5.2 (2010-05-24)Fix unit tests broken under Python 2.4 by the switch to the standard
librarydoctestmodule.3.5.1 (2010-04-30)Prefer the standard library’sdoctestmodule to the one fromzope.testing.3.5.0 (2009-02-04)Add support to bootstrap on Jython.Add reference documentation.3.4.0 (2007-07-19)Finish release ofzope.deferredimport.3.4.0b1 (2007-07-09)Initial release as a separate project, corresponding to thezope.deferredimportfrom Zope 3.4.0b1. |
zope.dependencytool | This package installs a script that allows a developer to discover the used
packages of a given package. This is useful when creating a list of
dependencies forsetup.py.CHANGESVersion 3.4.0 (9/21/2007)Initial Release |
zope.deprecation | zope.deprecationThis package provides a simple function calleddeprecated(names, reason)to mark deprecated modules, classes, functions, methods and properties.Please seehttps://zopedeprecation.readthedocs.iofor the documentation.zope.deprecationChangelog5.0 (2023-03-29)Drop support for Python 2.7, 3.4, 3.5, 3.6.Drop support for deprecatedpython setup.py test.Add support for Python 3.8, 3.9, 3.10, 3.11.4.4.0 (2018-12-03)Add support for Python 3.7.4.3.0 (2017-08-07)Allow custom warning classes to be specified to override the defaultDeprecationWarning.
Seehttps://github.com/zopefoundation/zope.deprecation/pull/7Add support for Python 3.6.Drop support for Python 3.3.4.2.0 (2016-11-07)Drop support for Python 2.6 and 3.2.Add support for Python 3.5.4.1.2 (2015-01-13)Do not require aselfparameter for deprecated functions. See:https://github.com/zopefoundation/zope.deprecation/pull/14.1.1 (2014-03-19)Added explicit support for Python 3.4.4.1.0 (2013-12-20)Added aSuppressorcontext manager, allowing scoped suppression of
deprecation warnings.Updatedboostrap.pyto version 2.2.4.0.2 (2012-12-31)Fleshed out PyPI Trove classifiers.4.0.1 (2012-11-21)Added support for Python 3.3.4.0.0 (2012-05-16)Automated build of Sphinx HTML docs and running doctest snippets via tox.Added Sphinx documentation:API docs moved from package-data README intodocs/api.rst.Snippets can be tested by running ‘make doctest’.Updated support for continuous integration usingtoxandjenkins.100% unit test coverage.Addedsetup.py devalias (runssetup.py developplus installsnoseandcoverage).Addedsetup.py docsalias (installsSphinxand dependencies).Removed spurious dependency onzope.testing.Dropped explicit support for Python 2.4 / 2.5 / 3.1.3.5.1 (2012-03-15)Revert a move ofREADME.txtto unbreakzope.app.apidoc.3.5.0 (2011-09-05)Replaced doctesting with unit testing.Python 3 compatibility.3.4.1 (2011-06-07)Removed import cycle for__show__by defining it in thezope.deprecation.deprecationmodule.Added support to bootstrap on Jython.Fixzope.deprecation.warn()to make the signature identical towarnings.warn()and to check for .pyc and .pyo files.3.4.0 (2007-07-19)Release 3.4 final, corresponding to Zope 3.4.3.3.0 (2007-02-18)Corresponds to the version of thezope.deprecationpackage shipped as
part of the Zope 3.3.0 release. |
zope.documenttemplate | Document Templating Markup LanguageThis package implements the Document Templating Markup Language (DTML). It
uses custom SGML tags to implement simple programmatic feratures, such as
variable replacement, conditional logic and loops.DTML was the first templating language developed for Zope 2 and is still
preferred by some over newer templating solutions due to its speed and
simplicity.CHANGES3.4.3 (2011-10-31)LP #267820: Fix broken multi-exception ‘except:’ clause.Removed use of ‘zope.testing.doctestunit’ in favor of stdlib’s doctest.Simpler, faster implementation of dt_var.newline_to_br().
(It still uses HTML 4 style <br> tags rather than XHTML style.)3.4.2 (2008/10/10)Re-release 3.4.13.4.1 (2008/10/10)Fixed usage of ‘with’ as a variable name. It is now a keyword in
Python 2.6, causing a SyntaxError.zope.documenttemplatenow
supports Python 2.6.3.4.0 (2007/10/02)zope.documenttemplatenow supports Python 2.53.2.0 (2006/01/05)Corresponds to the verison of thezope.documenttemplatepackage shipped
as part of the Zope 3.2.0 release.‘dt_in.py’: replaced another string exception, ‘InError’.Coding style cleanups.3.1.0 (2005/10/03)Corresponds to the verison of thezope.documenttemplatepackage shipped
as part of the Zope 3.1.0 release.documenttemplate.py: Replace use of named string exception,ParseError, with normal exception class of the same name (fromdt_util.py).3.0.0 (2004/11/07)Corresponds to the verison of thezope.documenttemplatepackage shipped
as part of the Zope X3.0.0 release. |
zope.dottedname | zope.dottednameResolve strings containing dotted names into the appropriate python object.Changes6.0 (2023-03-27)Add support for Python 3.11.Drop support for Python 3.6.5.0 (2022-09-08)Add support for Python 3.8, 3.9, 3.10.Drop support for Python 2.7, 3.4, 3.5.4.3 (2018-10-05)Add support for Python 3.7.Drop support for Python 3.3.4.2 (2017-05-11)Add support for Python 3.5 and 3.6.Drop support for Python 2.6 and 3.2.100% unit test coverage (including branches).Convert doctests to Sphinx documentation, including building docs
and running doctest snippets undertox.4.1.0 (2014-12-26)Add support for PyPy3.Add support for Python 3.4.Add support for testing on Travis.4.0.0 (2013-02-05)Made tests pass on Python 3.2, 3.3 and PyPy.Add support for continuous integration usingtox.3.4.6 (2009-09-15)Make tests pass on python26.3.4.5 (2009-01-27)Move README.txt in the egg, so tests works with the released egg as well.3.4.4 (2009-01-27)Fix ReST in README.txt, fix broken tests with recent zope.testing.3.4.3 (2008-12-02)More documentation and tests.3.4.2 (2007-10-02)Fix broken release.3.4.1 (2007-10-02)Update package meta-data.3.4.0 (2007-07-19)Initial Zope-independent release. |
zope.dublincore | zope.dublincoreThis package provides a Dublin Core support for Zope-based web
applications. This includes:anIZopeDublinCoreinterface definition that can be implemented
by objects directly or via an adapter to support DublinCore
metadata.anIZopeDublinCoreadapter for annotatable objects (objects
providingIAnnotatablefromzope.annotation).a partial adapter for objects that already implement some of theIZopeDublinCoreAPI,a “Metadata” browser page (which by default appears in the ZMI),subscribers to various object lifecycle events that automatically
set the created and modified date and some other metadata.Complete documentation is hosted athttps://zopedublincore.readthedocs.io/Changes5.0 (2023-07-05)Drop support for Python 2.7, 3.5, 3.6.Add back support for Python 3.5.Add support for Python 3.10, 3.11.4.3.0 (2020-10-14)Port.browsersub-package to Python 3.Add support for Python 3.7, 3.8 and 3.9.Drop support for running the tests usingpython setup.py test.Drop support for Python 3.4 and 3.5.4.2.0 (2017-07-25)Add support for Python 3.5 and 3.6.Drop support for Python 2.6 and 3.3.Convert doctests to Sphinx, including building docs and testing doctest
snippets undertox.4.1.1 (2014-01-10)Add explicit dependency onpersistent(required but not declared).Add explicit dependency onzope.annotation(required but not declared).4.1.0 (2014-12-26)Add support for PyPy. (PyPy3 is pending release of a fix for:https://bitbucket.org/pypy/pypy/issue/1946)Add support for Python 3.4.4.0.1 (2014-12-20)Add support for testing on Travis-CI.4.0.0 (2013-02-20)Add support for Python 3.3.Replace deprecatedzope.component.adaptsusage with equivalentzope.component.adapterdecorator.Replace deprecatedzope.interface.implementsusage with equivalentzope.interface.implementerdecorator.Drop support for Python 2.4 and 2.5.3.8.2 (2010-02-19)Update <DATETIME> regex normalizer to guard against test failure when
a datetime’s microseconds value is zero.3.8.1 (2010-12-14)Add missing test dependency on zope.configuration and missing dependency
of security.zcml on zope.security’s meta.zcml.3.8.0 (2010-09-14)Register the annotators also for (object, event), so copy-pasting a
folder, changes the dublin core data of the contained objects, too. The
changed annotators are the following:zope.dublincore.timeannotators.ModifiedAnnotatorzope.dublincore.timeannotators.CreatedAnnotatorzope.dublincore.creatorannotator.CreatorAnnotator3.7.0 (2010-08-19)Remove backward-compatibility shims for deprecatedzope.app.dublincore.*permissions.Remove include the zcml configuration ofzope.dublincore.browser.Use python`s doctest instead of deprecatedzope.testing.doctest.3.6.3 (2010-04-23)Restore backward-compatiblezope.app.dublincore.*permissions,
mapping them onto the new permissions using the<meta:redefinePermission>directive. These shims will be removed in 3.7.0.Add unit (not functional) test for loadability ofconfigure.zcml.3.6.2 (2010-04-20)Repair regression introduced in 3.6.1: the renamed permissions were
not updated in other ZCML files.3.6.1 (2010-04-19)Rename thezope.app.dublincore.*permissions tozope.dublincore.*. Applications may need to fix up grants based on the
old permissions.Add tests forzope.dublincore.timeannotators.Add not declared dependency onzope.lifecycleevent.3.6.0 (2009-12-02)Remove the marker interface IZopeDublinCoreAnnotatable which doesn’t seem
to be used.Make the registration of ZDCAnnotatableAdapter conditional, lifting the
dependency on zope.annotation and thereby the ZODB, leaving it as a test
dependency.3.5.0 (2009-09-15)Add missing dependencies.Get rid of any testing dependencies beyond zope.testing.Include browser ZCML configuration only if zope.browserpage is installed.Specify i18n domain in package’sconfigure.zcml, because we use message
IDs for permission titles.Remove unused imports, fix one test that was inactive because of being
overriden by another one by a mistake.3.4.2 (2009-01-31)Declare dependency on zope.datetime.3.4.1 (2009-01-26)Test dependencies are declared in atestextra now.Fix: Make CreatorAnnotator not to fail if participation principal is None3.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 |
zope.error | zope.errorThis package provides an error reporting utility which is able to store errors.Changes5.0 (2023-07-06)Add support for Python 3.11.Drop support for Python 2.7, 3.5, 3.6.4.6 (2022-08-29)Add support for Python 3.8, 3.9, 3.10.Drop support for Python 3.4.4.5.0 (2018-10-19)Add support for Python 3.7.4.4.0 (2017-07-22)Drop support for Python 3.3.Add support for Python 3.6.100% test coverage.Remove internal_compatmodule in favor ofsix, which we
already had a dependency on.Stop decoding in ASCII (whatever the default codec is) in favor of UTF-8.Tighten the interface ofILocalErrorReportingUtility.setProperties. Nowignored_exceptionsis required to be str or byte objects.
Previously any object that could be converted into a text object via
the text constructor was accepted, but this encouraged passing class
objects, when in actuality we need the classname.Stop ignoringKeyboardInterruptexceptions and other similarBaseExceptionexceptions during theraisingmethod.4.3.0 (2016-07-07)Add support for Python 3.5.Drop support for Python 2.6.bugfix: fix leak by convertingrequest.URLto string inErrorReportingUtility4.2.0 (2014-12-27)Add support for PyPy and PyPy3.Add support for Python 3.4.4.1.1 (2014-12-22)Enable testing on Travis.4.1.0 (2013-02-21)Add compatibility with Python 3.34.0.0 (2012-12-10)Replace deprecatedzope.interface.implementsusage with equivalentzope.interface.implementerdecorator.Drop support for Python 2.4 and 2.5.Sort request items for presentation in the error reporting utility.Don’t HTML-escape HTML tracebacks twice.3.7.4 (2012-02-01)Add explicit tests for escaping introduced in 3.7.3.Handing names of classes those string representation cannot
be determined as untrusted input thus escaping them in error reports.Fix tests on Python 2.4 and 2.5.3.7.3 (2012-01-17)Escape untrusted input before constructing HTML for error reporting.3.7.2 (2010-10-30)Setcopy_to_zlogby default to 1/True.
Having it turned off is a small problem, because fatal (startup) errors
will not get logged anywhere.3.7.1 (2010-09-25)Add test extra to declare test dependency onzope.testing.3.7.0 (2009-09-29)Clean up dependencies. Droped all testing dependencies as we only need
zope.testing now.Fix ImportError when zope.testing is not available for some reason.Remove zcml slug and old zpkg-related files.Remove word “version” from changelog entries.Change package’s mailing list address to zope-dev at zope.org as
zope3-dev at zope.org is now retired. Also changedcheeseshoptopypiin the package’s homepage url.Add dependency on ZODB3 as we use Persistent.Use a mock request for testing. Dropped the dependency on zope.publisher
which was really only a testing dependency.Reduce the dependency on zope.container to one on zope.location by no
longer using the Contained mix-in class.3.6.0 (2009-01-31)Use zope.container instead of zope.app.containerMove error log bootstrapping logic (which was untested) tozope.app.appsetup, to which we added a test.3.5.1 (2007-09-27)Rebump to replace faulty egg3.5.0Initial documented releaseMoved core components fromzope.app.errorto this package. |
zope.errorview | zope.errorviewProvides basic HTTP and Browser views for common exceptions.Refactored fromzope.app.http.exception andzope.app.exception.CHANGES2.0 (2023-02-09)Drop support for Python 2.7, 3.4, 3.5, 3.6.Add support for Python 3.7, 3.8, 3.9, 3.10, 3.11.1.2.0 (2018-01-15)Remove the whitespace between the content-type and charset of the default
error views. This is because in certain cases zope.publisher.http will parse
the content type parameters and combine them back again without the
whitespace. This fix makes things more predictable esp. in tests.1.1 (2018-01-10)Additional fixes for Python 3 compatibility.NOTE: The error view base classes now set a Content-Type response header to
“text/plain”. If your error view subclassing from the zope.errorview classes
return a response body other than “text/plain” you need to explicitly set
the Content-Type in your views.1.0.0 (2017-05-10)Add support for Python 3.4, 3.5, 3.6 and PyPy.Fix typo in Dutch translation0.11 (2011-06-28)Added nl translations.0.10 (2011-02-08)Exception views do not by default provide ISystemErrorView anymore as it
would result in duplicate log output. The mixin class still exists for
writing custom error views that do provide ISystemErrorView.0.9 (2011-01-20)Initial release. |
zope.event | zope.eventREADMEThezope.eventpackage provides a simple event system, including:An event publishing API, intended for use by applications which are
unaware of any subscribers to their events.A very simple synchronous event-dispatching system, on which more sophisticated
event dispatching systems can be built. For example, a type-based
event dispatching system that builds onzope.eventcan be found inzope.component.Please seehttp://zopeevent.readthedocs.io/for the documentation.zope.eventChangelog5.0 (2023-06-23)Drop support for Python 2.7, 3.5, 3.6.4.6 (2022-12-15)Port documentation to Python 3.Add support for Python 3.10, 3.11.4.5.0 (2020-09-18)Add support for Python 3.8 and 3.9.Remove support for Python 3.4.4.4 (2018-10-05)Add support for Python 3.74.3.0 (2017-07-25)Add support for Python 3.6.Drop support for Python 3.3.4.2.0 (2016-02-17)Add support for Python 3.5.Drop support for Python 2.6 and 3.2.4.1.0 (2015-10-18)Require 100% branch (as well as statement) coverage.Add a simple class-based handler implementation.4.0.3 (2014-03-19)Add support for Python 3.4.Updateboostrap.pyto version 2.2.4.0.2 (2012-12-31)Flesh out PyPI Trove classifiers.Add support for jython 2.7.4.0.1 (2012-11-21)Add support for Python 3.3.4.0.0 (2012-05-16)Automate build of Sphinx HTML docs and running doctest snippets via tox.Drop explicit support for Python 2.4 / 2.5 / 3.1.Add support for PyPy.3.5.2 (2012-03-30)This release is the last which will maintain support for Python 2.4 /
Python 2.5.Add support for continuous integration usingtoxandjenkins.Add ‘setup.py dev’ alias (runssetup.py developplus installsnoseandcoverage).Add ‘setup.py docs’ alias (installsSphinxand dependencies).3.5.1 (2011-08-04)Add Sphinx documentation.3.5.0 (2010-05-01)Add change log tolong-description.Add support for Python 3.x.3.4.1 (2009-03-03)A few minor cleanups.3.4.0 (2007-07-14)Initial release as a separate project. |
zope.exceptions | zope.exceptionsThis package contains exception exceptions and implementations which are so
general purpose that they don’t belong in Zope application-specific packages.Please seehttps://zopeexceptions.readthedocs.io/for the documentation.zope.exceptions Changelog5.0.1 (2023-07-11)Fix issue introduced in the last release which is breakingHTMLExceptionFormatterwhen using non-str__traceback_info__.5.0 (2023-06-29)Drop support for Python 2.7, 3.5, 3.6.4.6 (2022-11-10)Catch exceptions informatExceptionOnly.
Getting an exception when reporting about a different exception is not helpful.
On Python 3.11 this is needed for some HTTPErrors.Add official support for Python 3.11.4.5 (2022-02-11)Add official support for Python 3.9 and 3.10.Undo dropping support for Python 3.5.Drop support for running the tests usingpython setup.py test.4.4 (2020-07-16)Add support for Python 3.8 and preliminary support for 3.9b4.Drop support for Python 3.4 and 3.5.4.3 (2018-10-04)Add support for Python 3.7.4.2.0 (2017-09-12)Add support for Python 3.6.Drop support for Python 3.3.Fix handling of unicode supplemental traceback information on
Python 2. Now such values are always encoded to UTF-8; previously
the results were undefined and depended on system encodings and the
values themselves. Seeissue 1.4.1.0 (2017-04-12)Drop support for Python 2.6 and 3.2.Makeexceptionformatter.extract_stacksignature comply withtraceback.extract_stackAdd support for Python 3.5.4.0.8 (2015-08-13)Fixes aroundTextExceptionFormatterlimit:formatExceptionandextractStackwas cutting the traceback at the bottom,
at the most interesting point. Now it will cut from the middle.
Some text about the missing entries will be inserted.Maybe fix forextractStack, it did not detect recursions in the frames.4.0.7 (2014-03-19)Added explicit support for Python 3.4.Updatedboostrap.pyto version 2.2.4.0.6 (2013-02-28)Make sure thatsetup.pyfinds all tests. Now tox runs them all as well.Fix failing test under Python 3.Made buildout work under Python 3 and Buildout 2.4.0.5 (2012-12-31)Fleshed out PyPI Trove classifiers.Fixed a test failure under Python 2.6.4.0.4 (2012-12-13)Release with a fixed MANIFEST.in (withoutdocs/)4.0.3 (2012-12-10)Fixed format_exception(…, as_html=True) not to HTML-escape the ‘<br />’
it adds to the exception value.4.0.2 (2012-11-21)Test Python 3.3 support under tox.4.0.1 (2012-08-20)Fixed optional dependency code for‘zope.security`to work under Python 3.3.4.0.0.1 (2012-05-16)Fixed rendering of package docs on PyPI.4.0.0 (2012-05-16)Automated build of Sphinx HTML docs and running doctest snippets via tox.Added Sphinx documentation.Added support for continuous integration usingtoxandjenkins.Removed use of ‘2to3’ and associated fixers when installing under Py3k.
The code is now in a “compatible subset” which supports Python 2.6, 2.7,
and 3.2, including PyPy 1.8 (the version compatible with the 2.7 language
spec).100% unit test coverage.Dropped explicit support for Python 2.4 / 2.5 / 3.1.Added ‘setup.py dev’ alias (runssetup.py developplus installsnoseandcoverage).Added ‘setup.py docs’ alias (installsSphinxand dependencies).3.7.1 (2012-03-28)Fix: missed to reverse extractStack entries3.7.0 (2012-03-28)Added TextExceptionFormatter.extractStack and extract_stack3.6.2 (2012-03-28)Fallback to traceback.format_tb when the formatter is called recursively.
i.e. Don’t let errors in the formatter pass silently.Fix deprecated unittest functions:assert_andassertEquals.3.6.1 (2010-07-06)Fixed tests to work under Python 2.7.PEP8 cleanup and removed obsolete build infrastructure files.3.6.0 (2010-05-02)Added support to bootstrap on Jython.Added Python 3 support.The dependency on zope.testing seemed spurious, possibly a rest of a real
dependency that is gone now. I removed it.3.5.2 (2008-04-30)Updated CHANGES.txt.3.5.1 (2008-04-28)Reverted changes in 3.5.0.3.5.0Added the capability for exceptions to be formatted line-by-line.
Unfortunately, also introduced a bug cause each line of the exception to be
its own log message.3.4.0 (2007-10-02)Updated package meta-data.3.4.0b2 (2007-08-14)Removed superfluous dependency onzope.deprecation.3.4.0b1 (2007-07-09)Corresponds to the version of thezope.exceptionspackage shipped as
part of the Zope 3.4.0b1 release.3.2.0 (2006-01-05)Corresponds to the version of thezope.exceptionspackage shipped as part of
the Zope 3.2.0 release.Deprecated theINotFoundErrorinterface and the correspondingNotFoundErrorexception class, in favor of “standard” exceptionsAttributeError,KeyError). The deprecated items will be removed in
Zope 3.3.3.0.0 (2004-11-07)Corresponds to the version of the zope.exceptions package shipped as part of
the Zope X3.0.0 release. |
zope.fanstatic | Zope integration for fanstaticThis package provides Zope integration for fanstatic. This means it’s
taking care of three things:provide access to the needed resources throughout the request/response cycle.provide the base URL for the resources to be rendered.clear the needed resources when an exception view is rendered.This library fulfills these conditions for a Zope Toolkit/Grok setup.We’ll run through a few tests to demonstrate it. Note that the real
code being tested is not in this document itself, but in the views
described inftesting.zcml.We need to be in a request to make this work, so let’s up a request to
a page we have set up inftesting.zcmlthat should cause the
inclusion of a single resource in its header:>>> from zope.testbrowser.wsgi import Browser
>>> browser = Browser()
>>> browser.open('http://localhost/zope.fanstatic.test_single')
>>> print(browser.contents)
<html>
<head>
<script type="text/javascript" src="http://localhost/fanstatic/foo/a.js"></script></head>
<body>
<p>the widget HTML itself</p>
</body>
</html>If a resource happens to need another resource, this resource is also
automatically included:>>> browser.open('http://localhost/zope.fanstatic.test_multiple')
>>> print(browser.contents)
<html>
<head>
<script type="text/javascript" src="http://localhost/fanstatic/foo/a.js"></script>
<script type="text/javascript" src="http://localhost/fanstatic/foo/b.js"></script></head>
<body>
<p>the widget HTML itself</p>
</body>
</html>Bottom rendering of resources, just before the</body>tag:>>> browser.open('http://localhost/zope.fanstatic.test_bottom')
>>> print(browser.contents)
<html>
<head>
</head>
<body>
<p>the widget HTML itself</p>
<script type="text/javascript" src="http://localhost/fanstatic/foo/c.js"></script>
<script type="text/javascript" src="http://localhost/fanstatic/foo/d.js"></script></body>
</html>In-template resourceszope.fanstatic provides support for rendering resource publisher
aware URLs to in-template resources:>>> browser.open('http://localhost/zope.fanstatic.test_inline_resource')
>>> print(browser.contents)
<html>
<head>
</head>
<body>
<img src="http://localhost/fanstatic/foo/evencaveman.jpg" />
<img src="http://localhost/fanstatic/foo/sub/evencaveman.jpg" />
</body>
</html>Exception viewsWhen an exception occurs in the rendering of a view, we don’t want to have any
needed resources intended for a view being also injected in the error view.
The needed resources are cleared and if the exception view chooses to do so,
it can need resources itself.>>> browser.raiseHttpErrors = False
>>> browser.open('http://localhost/zope.fanstatic.test_error')
>>> import fanstatic
>>> fanstatic.get_needed().has_resources()
FalseCHANGES3.0.0 (2018-01-16)Python 3 and Fanstatic 1.0.0 compatibility.0.12 (2011-08-31)Similar to the fix in 0.11, make sure calling for the URL of a resource
will not failed for aDummyNeededResourcesobject which would badly hurt
testability of function or “browser” tests of applications that depend
on fanstatic/zope.fanstatic.0.11 (2011-08-17)Fix bug where callingensure_base_url()failed forDummyNeededResourcesobjects. This was problematic when writing functional or “browser” tests
of applications that depend on fanstatic/zope.fanstatic.0.10 (2011-04-11)Update to fanstatic 0.11 API.0.9.1 (2011-01-20)Do not clear resources on DummyNeededResources objects.0.9 (2011-01-20)Integrate zope.errorview, subscribing to the HandleExceptionEvent. This will
clear the needed resources thusfar required, to have a clean slate for the
error view to be rendered.0.9b (2011-01-06)Zope.fanstatic version 0.9 is a fundamental rewrite ofhurry.zoperesource,
as a result of the rewrite ofhurry.resourceintofanstatic.Here’s a list of essential changes since version 0.7 of hurry.zoperesource:Compliance with the Fanstatic API.++resource++foo/bar/baz.jpgexpressions in Page Templates are
still supported by way registering a traversable component for all
available resource libraries. There are no zope.browserresource
components involved anymore in zope.fanstatic.Download |
zope.file | Thezope.filepackage provides a content object used to store a
file. The interface supports efficient upload and download.ContentsFile ObjectDownloading File ObjectsHeadersBodyThe Download ViewThe Inline ViewThe Default Display ViewLarge Unicode CharactersUploading a new fileContent type and encoding controlsPresentation AdaptersCHANGES1.2.0 (2020-03-06)1.1.0 (2017-09-30)1.0.0 (2017-04-25)0.6.2 (2012-06-04)0.6.1 (2012-01-26)0.6.0 (2010-09-16)0.5.0 (2009-07-23)0.4.0 (2009-01-31)0.3.0 (2007-11-01)0.2.0 (2007-04-18)0.1.0 (2007-04-18)File ObjectThezope.filepackage provides a content object used to store a
file. The interface supports efficient upload and download. Let’s
create an instance:>>> from zope.file.file import File
>>> f = File()The object provides a limited number of data attributes. ThemimeTypeattribute is used to store the preferred MIME
content-type value for the data:>>> f.mimeType>>> f.mimeType = "text/plain"
>>> f.mimeType
'text/plain'>>> f.mimeType = "application/postscript"
>>> f.mimeType
'application/postscript'Theparametersattribute is a mapping used to store the content-type
parameters. This is where encoding information can be found when
applicable (and available):>>> f.parameters
{}
>>> f.parameters["charset"] = "us-ascii"
>>> f.parameters["charset"]
'us-ascii'Both,parametersandmimeTypecan optionally also be set when
creating aFileobject:>>> f2 = File(mimeType = "application/octet-stream",
... parameters = dict(charset = "utf-8"))
>>> f2.mimeType
'application/octet-stream'>>> f2.parameters["charset"]
'utf-8'File objects also sport asizeattribute that provides the number of
bytes in the file:>>> f.size
0The object supports efficient upload and download by providing all
access to content data through accessor objects that provide (subsets
of) Python’s file API.A file that hasn’t been written to is empty. We can get a reader by callingopen(). Note that all blobs are binary, thus the mode always contains a
‘b’:>>> r = f.open("r")
>>> r.mode
'rb'Theread()method can be called with a non-negative integer argument
to specify how many bytes to read, or with a negative or omitted
argument to read to the end of the file:>>> r.read(10)
''
>>> r.read()
''
>>> r.read(-1)
''Once the accessor has been closed, we can no longer read from it:>>> r.close()
>>> r.read()
Traceback (most recent call last):
ValueError: I/O operation on closed fileWe’ll see that readers are more interesting once there’s data in the
file object.Data is added by using a writer, which is also created using theopen()method on the file, but requesting a write file mode:>>> w = f.open("w")
>>> w.mode
'wb'Thewrite()method is used to add data to the file, but note that
the data may be buffered in the writer:>>> _ = w.write(b"some text ")
>>> _ = w.write(b"more text")Theflush()method ensure that the data written so far is written to
the file object:>>> w.flush()We need to close the file first before determining its file size>>> w.close()
>>> f.size
19We can now use a reader to see that the data has been written to the
file:>>> w = f.open("w")
>>> _ = w.write(b'some text more text')
>>> _ = w.write(b" still more")
>>> w.close()
>>> f.size
30Now create a new reader and let’s perform some seek operations.>>> r = f.open()The reader also has aseek()method that can be used to back up or
skip forward in the data stream. Simply passing an offset argument,
we see that the current position is moved to that offset from the
start of the file:>>> _ = r.seek(20)
>>> r.read()
'still more'That’s equivalent to passing 0 as thewhenceargument:>>> _ = r.seek(20, 0)
>>> r.read()
'still more'We can skip backward and forward relative to the current position by
passing 1 forwhence:>>> _ = r.seek(-10, 1)
>>> r.read(5)
'still'
>>> _ = r.seek(2, 1)
>>> r.read()
'ore'We can skip to some position backward from the end of the file using
the value 2 forwhence:>>> _ = r.seek(-10, 2)
>>> r.read()
'still more'>>> _ = r.seek(0)
>>> _ = r.seek(-4, 2)
>>> r.read()
'more'>>> r.close()Attempting to write to a closed writer raises an exception:>>> w = f.open('w')
>>> w.close()>>> w.write(b'foobar')
Traceback (most recent call last):
ValueError: I/O operation on closed fileSimilarly, usingseek()ortell()on a closed reader raises an
exception:>>> r.close()
>>> _ = r.seek(0)
Traceback (most recent call last):
ValueError: I/O operation on closed file>>> r.tell()
Traceback (most recent call last):
ValueError: I/O operation on closed fileDownloading File ObjectsThe file content type provides a view used to download the file,
regardless of the browser’s default behavior for the content type.
This relies on browser support for the Content-Disposition header.The download support is provided by two distinct objects: A view that
provides the download support using the information in the content
object, and a result object that can be used to implement a file
download by other views. The view can override the content-type or the
filename suggested to the browser using the standard IResponse.setHeader
method.Note that result objects are intended to be used once and then
discarded.Let’s start by creating a file object we can use to demonstrate the
download support:>>> import transaction
>>> from zope.file.file import File
>>> f = File()
>>> getRootFolder()['file'] = f
>>> transaction.commit()HeadersNow, let’s get the headers for this file. We use a utility function calledgetHeaders:>>> from zope.file.download import getHeaders
>>> headers = getHeaders(f, contentDisposition='attachment')Since there’s no suggested download filename on the file, the
Content-Disposition header doesn’t specify one, but does indicate that
the response body be treated as a file to save rather than to apply
the default handler for the content type:>>> sorted(headers)
[('Content-Disposition', 'attachment; filename="file"'),
('Content-Length', '0'),
('Content-Type', 'application/octet-stream')]Note that a default content type of ‘application/octet-stream’ is
used.If the file object specifies a content type, that’s used in the headers
by default:>>> f.mimeType = "text/plain"
>>> headers = getHeaders(f, contentDisposition='attachment')
>>> sorted(headers)
[('Content-Disposition', 'attachment; filename="file"'),
('Content-Length', '0'),
('Content-Type', 'text/plain')]Alternatively, a content type can be specified togetHeaders:>>> headers = getHeaders(f, contentType="text/xml",
... contentDisposition='attachment')
>>> sorted(headers)
[('Content-Disposition', 'attachment; filename="file"'),
('Content-Length', '0'),
('Content-Type', 'text/xml')]The filename provided to the browser can be controlled similarly. If
the content object provides one, it will be used by default:>>> headers = getHeaders(f, contentDisposition='attachment')
>>> sorted(headers)
[('Content-Disposition', 'attachment; filename="file"'),
('Content-Length', '0'),
('Content-Type', 'text/plain')]Providing an alternate name togetHeadersoverrides the download
name from the file:>>> headers = getHeaders(f, downloadName="foo.txt",
... contentDisposition='attachment')
>>> sorted(headers)
[('Content-Disposition', 'attachment; filename="foo.txt"'),
('Content-Length', '0'),
('Content-Type', 'text/plain')]The default Content-Disposition header can be overridden by providing
an argument togetHeaders:>>> headers = getHeaders(f, contentDisposition="inline")
>>> sorted(headers)
[('Content-Disposition', 'inline; filename="file"'),
('Content-Length', '0'),
('Content-Type', 'text/plain')]If thecontentDispositionargument is not provided, none will be
included in the headers:>>> headers = getHeaders(f)
>>> sorted(headers)
[('Content-Length', '0'),
('Content-Type', 'text/plain')]BodyWe use DownloadResult to deliver the content to the browser. Since
there’s no data in this file, there are no body chunks:>>> transaction.commit()
>>> from zope.file.download import DownloadResult
>>> result = DownloadResult(f)
>>> list(result)
[]We still need to see how non-empty files are handled. Let’s write
some data to our file object:>>> with f.open("w") as w:
... _ = w.write(b"some text")
... w.flush()
>>> transaction.commit()Now we can create a result object and see if we get the data we
expect:>>> result = DownloadResult(f)
>>> L = list(result)
>>> b"".join(L)
'some text'If the body content is really large, the iterator may provide more
than one chunk of data:>>> with f.open("w") as w:
... _ = w.write(b"*" * 1024 * 1024)
... w.flush()
>>> transaction.commit()>>> result = DownloadResult(f)
>>> L = list(result)
>>> len(L) > 1
TrueOnce iteration over the body has completed, further iteration will not
yield additional data:>>> list(result)
[]The Download ViewNow that we’ve seen thegetHeadersfunction and the result object,
let’s take a look at the basic download view that uses them. We’ll need
to add a file object where we can get to it using a browser:>>> f = File()
>>> f.mimeType = "text/plain"
>>> with f.open("w") as w:
... _ = w.write(b"some text")
>>> transaction.commit()>>> getRootFolder()["abcdefg"] = f>>> transaction.commit()Now, let’s request the download view of the file object and check the
result:>>> print(http(b"""
... GET /abcdefg/@@download HTTP/1.1
... Authorization: Basic mgr:mgrpw
... """, handle_errors=False))
HTTP/1.0 200 Ok
Content-Disposition: attachment; filename="abcdefg"
Content-Length: 9
Content-Type: text/plain
<BLANKLINE>
some textThe Inline ViewIn addition, it is sometimes useful to view the data inline instead of
downloading it. A basic inline view is provided for this use case.
Note that browsers may decide not to display the image when this view
is used and there is not page that it’s being loaded into: if this
view is being referenced directly via the URL, the browser may show
nothing:>>> print(http(b"""
... GET /abcdefg/@@inline HTTP/1.1
... Authorization: Basic mgr:mgrpw
... """, handle_errors=False))
HTTP/1.0 200 Ok
Content-Disposition: inline; filename="abcdefg"
Content-Length: 9
Content-Type: text/plain
<BLANKLINE>
some textThe Default Display ViewThis view is similar to the download and inline views, but no content
disposition is specified at all. This lets the browser’s default
handling of the data in the current context to be applied:>>> print(http(b"""
... GET /abcdefg/@@display HTTP/1.1
... Authorization: Basic mgr:mgrpw
... """, handle_errors=False))
HTTP/1.0 200 Ok
Content-Length: 9
Content-Type: text/plain
<BLANKLINE>
some textLarge Unicode CharactersWe need to be able to support Unicode characters in the filename
greater than what Latin-1 (the encoding used by WSGI) can support.Let’s rename a file to contain a high Unicode character and try to
download it; the filename will be encoded:>>> getRootFolder()["abcdefg"].__name__ = u'Big \U0001F4A9'
>>> transaction.commit()>>> print(http(b"""
... GET /abcdefg/@@download HTTP/1.1
... Authorization: Basic mgr:mgrpw
... """, handle_errors=False))
HTTP/1.0 200 Ok
Content-Disposition: attachment; filename="Big ð©"
Content-Length: 9
Content-Type: text/plain
<BLANKLINE>
some textUploading a new fileThere’s a simple view for uploading a new file. Let’s try it:>>> from io import BytesIO as StringIO>>> sio = StringIO(b"some text")>>> from zope.testbrowser.wsgi import Browser
>>> browser = Browser()
>>> browser.handleErrors = False
>>> browser.addHeader("Authorization", "Basic mgr:mgrpw")
>>> browser.addHeader("Accept-Language", "en-US")>>> browser.open("http://localhost/@@+/zope.file.File")>>> ctrl = browser.getControl(name="form.data")
>>> ctrl.add_file(
... sio, "text/plain; charset=utf-8", "plain.txt")
>>> browser.getControl("Add").click()Now, let’s request the download view of the file object and check the
result:>>> print(http(b"""
... GET /plain.txt/@@download HTTP/1.1
... Authorization: Basic mgr:mgrpw
... """, handle_errors=False))
HTTP/1.0 200 Ok
Content-Disposition: attachment; filename="plain.txt"
Content-Length: 9
Content-Type: text/plain;charset=utf-8
<BLANKLINE>
some textWe’ll peek into the database to make sure the object implements the
expected MIME type interface:>>> from zope.mimetype import types
>>> ob = getRootFolder()["plain.txt"]
>>> types.IContentTypeTextPlain.providedBy(ob)
TrueWe can upload new data into our file object as well:>>> sio = StringIO(b"new text")
>>> browser.open("http://localhost/plain.txt/@@edit.html")>>> ctrl = browser.getControl(name="form.data")
>>> ctrl.add_file(
... sio, "text/plain; charset=utf-8", "stuff.txt")
>>> browser.getControl("Edit").click()Now, let’s request the download view of the file object and check the
result:>>> print(http(b"""
... GET /plain.txt/@@download HTTP/1.1
... Authorization: Basic mgr:mgrpw
... """, handle_errors=False))
HTTP/1.0 200 Ok
Content-Disposition: attachment; filename="plain.txt"
Content-Length: 8
Content-Type: text/plain;charset=utf-8
<BLANKLINE>
new textIf we upload a file that has imprecise content type information (as we
expect from browsers generally, and MSIE most significantly), we can
see that the MIME type machinery will improve the information where
possible:>>> sio = StringIO(b"<?xml version='1.0' encoding='utf-8'?>\n"
... b"<html>...</html>\n")>>> browser.open("http://localhost/@@+/zope.file.File")>>> ctrl = browser.getControl(name="form.data")
>>> ctrl.add_file(
... sio, "text/html; charset=utf-8", "simple.html")
>>> browser.getControl("Add").click()Again, we’ll request the download view of the file object and check
the result:>>> print(http(b"""
... GET /simple.html/@@download HTTP/1.1
... Authorization: Basic mgr:mgrpw
... """, handle_errors=False))
HTTP/1.0 200 Ok
Content-Disposition: attachment; filename="simple.html"
Content-Length: 56
Content-Type: application/xhtml+xml;charset=utf-8
<BLANKLINE>
<?xml version='1.0' encoding='utf-8'?>
<html>...</html>
<BLANKLINE>Further, if a browser is bad and sends a full path as the file name (as
sometimes happens in many browsers, apparently), the name is correctly
truncated and changed.>>> sio = StringIO(b"<?xml version='1.0' encoding='utf-8'?>\n"
... b"<html>...</html>\n")>>> browser.open("http://localhost/@@+/zope.file.File")>>> ctrl = browser.getControl(name="form.data")
>>> ctrl.add_file(
... sio, "text/html; charset=utf-8", r"C:\Documents and Settings\Joe\naughty name.html")
>>> browser.getControl("Add").click()Again, we’ll request the download view of the file object and check
the result:>>> print(http(b"""
... GET /naughty%20name.html/@@download HTTP/1.1
... Authorization: Basic mgr:mgrpw
... """, handle_errors=False))
HTTP/1.0 200 Ok
Content-Disposition: attachment; filename="naughty name.html"
Content-Length: 56
Content-Type: application/xhtml+xml;charset=utf-8
<BLANKLINE>
<?xml version='1.0' encoding='utf-8'?>
<html>...</html>
<BLANKLINE>In zope.file <= 0.5.0, a redundant ObjectCreatedEvent was fired in the
Upload view. We’ll demonstrate that this is no longer the case.>>> import zope.component
>>> from zope.file.interfaces import IFile
>>> from zope.lifecycleevent import IObjectCreatedEventWe’ll register a subscriber for IObjectCreatedEvent that simply increments
a counter.>>> count = 0
>>> def inc(*args):
... global count; count += 1
>>> zope.component.provideHandler(inc, (IFile, IObjectCreatedEvent))>>> browser.open("http://localhost/@@+/zope.file.File")>>> ctrl = browser.getControl(name="form.data")
>>> sio = StringIO(b"some data")
>>> ctrl.add_file(
... sio, "text/html; charset=utf-8", "name.html")
>>> browser.getControl("Add").click()The subscriber was called only once.>>> print(count)
1Content type and encoding controlsFiles provide a view that supports controlling the MIME content type
and, where applicable, the content encoding. Content encoding is
applicable based on the specific content type of the file.Let’s demonstrate the behavior of the form with a simple bit of
content. We’ll upload a bit of HTML as a sample document:>>> from io import BytesIO
>>> sio = BytesIO(b"A <sub>little</sub> HTML."
... b" There's one 8-bit Latin-1 character: \xd8.")>>> from zope.testbrowser.wsgi import Browser
>>> browser = Browser()
>>> browser.handleErrors = False
>>> browser.addHeader("Authorization", "Basic mgr:mgrpw")
>>> browser.addHeader("Accept-Language", "en-US")
>>> browser.open("http://localhost/@@+/zope.file.File")>>> ctrl = browser.getControl(name="form.data")
>>> ctrl.add_file(
... sio, "text/html", "sample.html")
>>> browser.getControl("Add").click()We can see that the MIME handlers have marked this as HTML content:>>> import zope.mimetype.interfaces
>>> import zope.mimetype.mtypes>>> file = getRootFolder()[u"sample.html"]
>>> zope.mimetype.mtypes.IContentTypeTextHtml.providedBy(file)
TrueIt’s important to note that this also means the content is encoded
text:>>> zope.mimetype.interfaces.IContentTypeEncoded.providedBy(file)
TrueThe “Content Type” page will show us the MIME type and encoding that
have been selected:>>> browser.getLink("sample.html").click()
>>> browser.getLink("Content Type").click()>>> browser.getControl(name="form.mimeType").value
['zope.mimetype.mtypes.IContentTypeTextHtml']The empty string value indicates that we have no encoding
information:>>> ctrl = browser.getControl(name="form.encoding")
>>> print(ctrl.value)
['']Let’s now set the encoding value to an old favorite, Latin-1:>>> ctrl.value = ["iso-8859-1"]
>>> browser.handleErrors = False
>>> browser.getControl("Save").click()We now see the updated value in the form, and can check the value in
the MIME content-type parameters on the object:>>> ctrl = browser.getControl(name="form.encoding")
>>> print(ctrl.value)
['iso-8859-1']>>> file = getRootFolder()["sample.html"]
>>> file.parameters
{'charset': 'iso-8859-1'}Something more interesting is that we can now use a non-encoded
content type, and the encoding field will be removed from the form:>>> ctrl = browser.getControl(name="form.mimeType")
>>> ctrl.value = ["zope.mimetype.mtypes.IContentTypeImageTiff"]
>>> browser.getControl("Save").click()>>> browser.getControl(name="form.encoding")
Traceback (most recent call last):
...
LookupError: name 'form.encoding'
...If we switch back to an encoded type, we see that our encoding wasn’t
lost:>>> ctrl = browser.getControl(name="form.mimeType")
>>> ctrl.value = ["zope.mimetype.mtypes.IContentTypeTextHtml"]
>>> browser.getControl("Save").click()>>> browser.getControl(name="form.encoding").value
['iso-8859-1']On the other hand, if we try setting the encoding to something which
simply cannot decode the input data, we get an error message saying
that’s not going to work, and no changes are saved:>>> ctrl = browser.getControl(name="form.encoding")
>>> ctrl.value = ["utf-8"]>>> browser.getControl("Save").click()>>> print(browser.contents)
<...Selected encoding cannot decode document...Presentation AdaptersObject sizeThe size of the file as presented in the contents view of a container is
provided using an adapter implementing thezope.size.interfaces.ISizedinterface. Such an adapter is available for the file object.Let’s do some imports and create a new file object:>>> from zope.file.file import File
>>> from zope.file.browser import Sized
>>> from zope.size.interfaces import ISized>>> f = File()
>>> f.size
0>>> s = Sized(f)
>>> ISized.providedBy(s)
True
>>> s.sizeForSorting()
('byte', 0)
>>> s.sizeForDisplay()
u'0 KB'Let’s add some content to the file:>>> with f.open('w') as w:
... _ = w.write(b"some text")The sized adapter now reflects the updated size:>>> s.sizeForSorting()
('byte', 9)
>>> s.sizeForDisplay()
u'1 KB'Let’s try again with a larger file size:>>> with f.open('w') as w:
... _ = w.write(b"x" * (1024*1024+10))>>> s.sizeForSorting()
('byte', 1048586)
>>> m = s.sizeForDisplay()
>>> m
u'${size} MB'
>>> m.mapping
{'size': '1.00'}And still a bigger size:>>> with f.open('w') as w:
... _ = w.write(b"x" * 3*512*1024)>>> s.sizeForSorting()
('byte', 1572864)
>>> m = s.sizeForDisplay()
>>> m
u'${size} MB'
>>> m.mapping
{'size': '1.50'}CHANGES1.2.0 (2020-03-06)Add support for Python 3.7 and 3.8Drop Python 3.4 support.1.1.0 (2017-09-30)Move more browser dependencies to thebrowserextra.Begin testing PyPy3 on Travis CI.1.0.0 (2017-04-25)Remove unneeded test dependencies zope.app.server,
zope.app.component, zope.app.container, and others.Update to work with zope.testbrowser 5.Add PyPy support.Add support for Python 3.4, 3.5 and 3.6.
SeePR 5.0.6.2 (2012-06-04)Moved menu-oriented registrations into new menus.zcml. This is now
loaded if zope.app.zcmlfiles is available only.Increase test coverage.0.6.1 (2012-01-26)Declared more dependencies.0.6.0 (2010-09-16)Bug fix: remove duplicate firing of ObjectCreatedEvent in
zope.file.upload.Upload (the event is already fired in its base class,
zope.formlib.form.AddForm).Move browser-related zcml tobrowser.zcmlso that it easier for
applications to exclude it.Import content-type parser from zope.contenttype, adding a dependency on
that package.Removed undeclared dependency on zope.app.container, depend on zope.browser.Using Python’sdoctestmodule instead of deprecatedzope.testing.doctest.0.5.0 (2009-07-23)Change package’s mailing list address to zope-dev at zope.org instead
of the retired one.Made tests compatible with ZODB 3.9.Removed not needed install requirement declarations.0.4.0 (2009-01-31)openDetachedis now protected by zope.View instead of zope.ManageContent.Use zope.container instead of zope.app.container.0.3.0 (2007-11-01)Package data update.0.2.0 (2007-04-18)Fix code for Publisher version 3.4.0.1.0 (2007-04-18)Initial release. |
zope.filerepresentation | zope.filerepresentationThe interfaces defined here are used for file-system and file-system-like
representations of objects, such as file-system synchronization, FTP, PUT, and
WebDAV.Documentation is hosted athttps://zopefilerepresentation.readthedocs.io/Changes6.0 (2023-01-14)Drop support for Python 2.7, 3.5, 3.6.Add support for Python 3.9, 3.10, 3.11.5.0.0 (2020-03-31)Drop support for Python 3.4.Add support for Python 3.7 and 3.8.Ensure all objects have a consistent interface resolution order.
Seeissue 7.4.2.0 (2017-08-10)Add support for Python 3.5 and 3.6.Drop support for Python 2.6 and 3.3.4.1.0 (2014-12-27)Add support for PyPy3.Add support for Python 3.4.4.0.2 (2013-03-08)Add Trove classifiers indicating CPython and PyPy support.4.0.1 (2013-02-11)Add tox.ini to release.4.0.0 (2013-02-11)Add support for Python 3.3 and PyPy.Drop support for Python 2.4 / 2.5.3.6.1 (2011-11-29)Add undeclaredzope.schemadependency.Removezope.testingtest dependency andtestextra.3.6.0 (2009-10-08)AddIRawReadFileandIRawWriteFileinterfaces. These extendIReadFileandIWritefile, respectively, to behave pretty much like a
standard Python file object with a few embellishments. This in turn allows
efficient, iterator- based implementations of file reading and writing.Remove dependency onzope.container:IReadDirectoryandIWriteDirectoryinherit only from interfaces defined inzope.interfaceandzope.interface.common.mapping.3.5.0 (2009-01-31)Change use ofzope.app.containertozope.container.3.4.0 (2007-10-02)Initial Zope-independent release. |
zope.fixers | IntroductionFixers for Zope Component Architecture and the frameworks built with it.Currently, there is only one fixer, fix_implements. This fixer will change
all uses of implements(IFoo) in a class body to the class decorator
@implementer(IFoo), which is the most likely Python 3 syntax for
zope.interfaces implements statements.UsageTypically you will use zope.fixers together with Distribute’s 2to3 support.
This is done by adding zope.fixers to some parameters in setup():>>> setup(
... install_requires = ['zope.fixers'],
... use_2to3 = True,
... use_2to3_fixers = ['zope.fixers'],
... )For an example usage of a complex case, look at:http://svn.zope.org/zope.interface/branches/regebro-python3/setup.py?rev=106216&view=markupThat setup.py supports both distutils, setuptools and distribute, all versions
of python from 2.4 to 3.1, and has an optional C-extension, so don’t worry if
it’s overwhelming. For simple projects all you need is to use Distribute and
add the above three lines to the setup.py. Distribute has more documentation
on how to use it to support Python 3 porting.If you don’t want to use Distribute things get a bit more complex, as you have
to make the list of fixers yourself and call lib2to3 with that:>>> from lib2to3.refactor import RefactoringTool, get_fixers_from_package
>>> fixers = get_fixers_from_package('lib2to3.fixes') + \
... get_fixers_from_package('zope.fixers')And the run the fixing with the fixers:>>> tool = RefactoringTool(fixers)
>>> tool.refactor(files, write=True)Fixer ScriptThe package also provides a console script calledzope-2to3that has the
same arguments as2to3but applies the fixers defined in this package.CHANGES1.1.2 (2013-02-23)Removed setup.cfg and make sure that we point to real Change Log.1.1.1 (2013-02-23)Remove support for Python 2.7 again. It did not work.1.1.0 (2013-02-22)Added console scriptzope-2to3.1.0.0 (2009-09-12)Initial release. Includes the implements fix to change implements(IFoo)
class body call to@implementer(IFoo)class decorator. |
zope_fixtures | Copyright (c) 2011, Robert Collins <[email protected]>Licensed under either the Apache License, Version 2.0 or the BSD 3-clause
license at the users choice. A copy of both licenses are available in the
project source as Apache-2.0 and BSD. You may not use this file except in
compliance with one of these two licences.Unless required by applicable law or agreed to in writing, software
distributed under these licenses is distributed on an “AS IS” BASIS, WITHOUT
WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
license you chose for the specific language governing permissions and
limitations under that license.Zope fixtures provides Fixtures (http://pypi.python.org/pypi/fixtures) for
use with Zope tests. These permit easy unit testing in Zope environments.DependenciesPython 2.4+
This is the base language fixtures is written in and for.zope.interfaces.Fixtures (http://pypi.python.org/pypi/fixtures).For use in a unit test suite using the included glue, one of:Python 2.7unittest2bzrlib.testsOr any other test environment that supports TestCase.addCleanup.Writing your own glue code is easy, or you can simply use the fixtures directly
without any support code.To run the test suite for zope_fixtures, testtools is needed.See the Fixtures documentation for overview and design information.Stock FixturesComponentsFixtureThis permits overlaying registrations in the zope registry. While the fixture
is setup any registrations made are local to the fixture, and will be thrown
away when the fixture is torn down.>>> from zope_fixtures import ComponentsFixture
>>> from zope.interface import Interface, implements
>>> from zope.component import getSiteManager
>>> class ITestUtility(Interface):pass
>>> class TestUtility(object):
... implements(ITestUtility)
>>> with ComponentsFixture():
... getSiteManager().registerUtility(TestUtility())UtilityFixtureThis permits simple replacement of a single utility.>>> from zope_fixtures import UtilityFixture
>>> with UtilityFixture(TestUtility()):
... pass |
zope.formlib | zope.formlibForms are web components that use widgets to display and input data.
Typically a template displays the widgets by accessing an attribute or
method on an underlying class.Documentation is hosted athttps://zopeformlib.readthedocs.io/en/latest/Changes6.0 (2023-03-27)Add support for Python 3.11.Drop support for Python 2.7, 3.5, 3.6.5.0.1 (2021-10-25)Add support for Python 3.10.5.0.0 (2021-10-25)Possibly breaking changesFix checking of constraints on field contents. Theprefixof anIFormFieldcan still be empty and now officially allows dots.
Seepull request 35.FeaturesAdd support for Python 3.9.Other changesRemove unused non-BBB imports.Adjust checkbox widget test to new default forrequiredon boolean
fields.4.7.1 (2020-03-31)Ensure all objects have consistent interface resolution orders.
Seeissue 30.Remove support for deprecatedpython setup.py testcommand.4.7.0 (2020-02-27)Move inline javascript function definitions containing “<”, “>” or “&”
into external files to follow the XHTML recommendation concerning
XML/HTML compatibility
(#25)Add support for Python 3.8.Drop support for Python 3.4.4.6.0 (2019-02-12)Add support for Python 3.7.Make the tests compatible withzope.i18n >= 4.5.4.5.0 (2018-09-27)Fix IE issue in /@@user-information?user_id=TestUser for
orderedSelectionList (GH#17)Move documentation tohttps://zopeformlib.readthedocs.io4.4.0 (2017-08-15)Add support for Python 3.5, and 3.6.Drop support for Python 2.6 and 3.3.UseUTF-8as default encoding when casting bytes to unicode for Python 2and3.4.3.0 (2014-12-24)Add support for PyPy. (PyPy3 is pending release of a fix for:https://bitbucket.org/pypy/pypy/issue/1946)Add support for Python 3.4.Add support for testing on Travis.Explicitly hide span inorderedSelectionList.pt. This only
contains hidden inputs, but Internet Explorer 10 was showing them
anyway.Support for CSRF protection.Added support for restricting the acceptable request method for the
form submit.4.3.0a1 (2013-02-27)Added support for Python 3.3.4.2.1 (2013-02-22)Moved default values for theBooleanDisplayWidgetfrom module to class
definition to make them changeable in instance.4.2.0 (2012-11-27)LP #1017884: Add redirect status codes (303, 307) to the set which prevent
form rendering.Replaced deprecatedzope.component.adaptsusage with equivalentzope.component.adapterdecorator.Replaced deprecatedzope.interface.implementsusage with equivalentzope.interface.implementerdecorator.Dropped support for Python 2.5.Make separator ofSourceSequenceDisplayWidgetconfigurable.4.1.1 (2012-03-16)AddedignoreContextattribute to form classes to control whethercheckInvariantstakes the context of the form into account when
checking interface invariants.By defaultignoreContextis set toFalse. On theAddFormit isTrueby default because the context of this form is naturally not
suitable as context for the interface invariant.4.1.0 (2012-03-15)checkInvariantsnow takes the context of the form into account when
checking interface invariants.Tests are no longer compatible with Python 2.4.4.0.6 (2011-08-20)Fixed bug inorderedSelectionList.pttemplate.4.0.5 (2010-09-16)Fixed Action name parameter handling, since 4.0.3 all passed names were
lowercased.4.0.4 (2010-07-06)Fixed tests to pass under Python 2.7.Fix validation of “multiple” attributes in orderedSelectionList.pt.4.0.3 (2010-05-06)Keep Actions from raising exceptions when passed Unicode lables [LP:528468].Improve display of the “nothing selected” case for optional Choice fields
[LP:269782].Improve truth testing for ItemDisplayWidget [LP:159232].Don’t blow up if TypeError raised during token conversion [LP:98491].4.0.2 (2010-03-07)Adapted tests for Python 2.4 (enforce sorting for short pprint output)4.0.1 (2010-02-21)Documentation uploaded to PyPI now contains widget documentation.Escape MultiCheckBoxWidget content [LP:302427].4.0 (2010-01-08)Widget implementation and all widgets from zope.app.form have been
moved into zope.formlib, breaking zope.formlib’s dependency on
zope.app.form (instead zope.app.form now depends on zope.formlib).Widgets can all be imported fromzope.formlib.widgets.Widget base classes and render functionality is inzope.formlib.widget.All relevant widget interfaces are now inzope.formlib.interfaces.3.10.0 (2009-12-22)Use named template from zope.browserpage in favor of zope.app.pagetemplate.3.9.0 (2009-12-22)Use ViewPageTemplateFile from zope.browserpage.3.8.0 (2009-12-22)Adjusted test output to new zope.schema release.3.7.0 (2009-12-18)Rid ourselves from zope.app test dependencies.Fix: Button label needs escaping3.6.0 (2009-05-18)Remove deprecated imports.Remove dependency on zope.app.container (useIAddingfromzope.browser.interfaces) instead. Depend onzope.browser>=1.1(the version withIAdding).Movednamedtemplatetozope.app.pagetemplate, to cut some
dependencies onzope.formlibwhen using this feature. Left BBB
imports here.3.5.2 (2009-02-21)Adapt tests for Python 2.5 output.3.5.1 (2009-01-31)Adapt tests to upcoming zope.schema release 3.5.1.3.5.0 (2009-01-26)New FeaturesTest dependencies are declared in atestextra now.Introducedzope.formlib.form.applyDatawhich works likeapplyChangesbut returns a dictionary with information about
which attribute of which schema changed. This information is then
sent along with theIObjectModifiedEvent.This fixeshttps://bugs.launchpad.net/zope3/+bug/98483.Bugs FixedActions that cause a redirect (301, 302) do not cause therendermethod to
be called anymore.The zope.formlib.form.Action class didn’t fully implement
zope.formlib.interfaces.IAction.zope.formlib.form.setupWidgets and zope.formlib.form.setupEditWidgets did
not check for write access on the adapter but on context. This fixeshttps://bugs.launchpad.net/zope3/+bug/2199483.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.formlib
from Zope 3.4.0a1 |
zope.fssync | zope.fssync PackageThis package provides filesystem synchronization utilities for Zope
3. It is used by the zope.app.fssync package.Filesystem SynchronizationThis package provides an API for the synchronization of Python objects
with a serialized filesystem representation. This API does not address
security issues. (See zope.app.fssync for a protected web-based API).
This API is Zope and ZODB independent.The main use cases aredata export / import (e.g. moving data from one place to another)content management (e.g. managing a wiki or other collections of
documents offline)The target representation depends on your use case. In the use case of
data export/import, for instance, it is crucial that all data are
exported as completely as possible. Since the data need not be read
by humans in most circumstances a pickle format may be the most
complete and easy one to use.
In the use case of content management it may be more important that
all metadata are readable by humans. In this case another format,
e.g. RDFa, may be more appropriate.Main componentsA synchronizer serializes content objects and stores the serialized
data in a repository in an application specific format. It uses
deserializers to read the object back into the content space.
The serialization format must be rich enough to preserve various forms
of references which should be reestablished on deserialization.All these components should be replaceable. Application may use
different serialization formats with different references for
different purposes (e.g. backup vs. content management) and different
target systems (e.g. a zip archive vs. a svn repository).The main components are:ISyncTasks like Checkout, Check, and Commit which synchronize
a content space with a repository. These tasks uses serializers
to produce serialized data for a repository in an application
specific format. They use deserializers to read the data back.
The default implementation uses xmlpickle for python objects,
data streams for file contents, and special directories for
extras and metadata. Alternative implementations may use
standard pickles, a human readable format like RDFa, or
application specific formats.ISynchronizer: Synchronizers produce serialized pieces of a
Python object (the ISerializer part of a synchronizer) and
consume serialized data to (re-)create Python objects (the
IDeserializer part of a synchronizer).IPickler: An adapter that determines the pickle format.IRepository: represents a target system that can be used
to read and write serialized data.Let’s take some samples:>>> from StringIO import StringIO
>>> from zope import interface
>>> from zope import component
>>> from zope.fssync import interfaces
>>> from zope.fssync import task
>>> from zope.fssync import synchronizer
>>> from zope.fssync import repository
>>> from zope.fssync import pickle>>> class A(object):
... data = 'data of a'
>>> class B(A):
... pass
>>> a = A()
>>> b = B()
>>> b.data = 'data of b'
>>> b.extra = 'extra of b'
>>> root = dict(a=a, b=b)Persistent ReferencesMany applications use more than one system of persistent references.
Zope, for instance, uses p_oids, int ids, key references,
traversal paths, dotted names, named utilities, etc.Other systems might use generic reference systems like global unique
ids or primary keys together with domain specific references, like
emails, URI, postal addresses, code numbers, etc.
All these references are candidates for exportable references as long
as they can be resolved on import or reimport.In our example we use simple integer ids:>>> class GlobalIds(object):
... ids = dict()
... count = 0
... def getId(self, obj):
... for k, v in self.ids.iteritems():
... if obj == v:
... return k
... def register(self, obj):
... uid = self.getId(obj)
... if uid is not None:
... return uid
... self.count += 1
... self.ids[self.count] = obj
... return self.count
... def resolve(self, uid):
... return self.ids.get(int(uid), None)>>> globalIds = GlobalIds()
>>> globalIds.register(a)
1
>>> globalIds.register(b)
2
>>> globalIds.register(root)
3In our example we use the int ids as a substitute for the default path
references which are the most common references in Zope.In our examples we use a SnarfRepository which can easily be examined:>>> snarf = repository.SnarfRepository(StringIO())
>>> checkout = task.Checkout(synchronizer.getSynchronizer, snarf)Snarf is a Zope3 specific archive format where the key
need is for simple software. The format is dead simple: each file
is represented by the string‘<size> <pathname>n’followed by exactly <size> bytes. Directories are not represented
explicitly.Entry IdsPersistent ids are also used in the metadata files of fssync.
The references are generated by an IEntryId adapter which must
have a string representation in order to be saveable in a text file.
Typically these object ids correspond to the persistent pickle ids, but
this is not necessarily the case.Since we do not have paths we use our integer ids:>>> @component.adapter(interface.Interface)
... @interface.implementer(interfaces.IEntryId)
... def entryId(obj):
... global globalIds
... return globalIds.getId(obj)
>>> component.provideAdapter(entryId)SynchronizerIn the use case of data export / import it is crucial that fssync is
able to serialize “all” object data. Note that it isn’t always obvious
what data is intrinsic to an object. Therefore we must provide
special serialization / de-serialization tools which take care of
writing and reading “all” data.An obvious solution would be to use inheriting synchronization
adapters. But this solution bears a risk. If someone created a subclass
and forgot to create an adapter, then their data would be serialized
incompletely. To give an example: What happens if someone has a
serialization adapter for class Person which serializes every aspect of
Person instances and defines a subclass Employee(Person) later on?
If the Employee class has some extra aspects (for example additional
attributes like insurance id, wage, etc.) these would never be serialized
as long as there is no special serialization adapter for Employees
which handles this extra aspects. The behavior is different if the
adapters are looked up by their dotted class name (i.e. the most specific
class) and not their class or interface (which might led to adapters
written for super classes). If no specific adapter exists a default
serializer (e.g a xmlpickler) can serialize the object completely. So
even if you forget to provide special serializers for all your classes
you can be sure that your data are complete.Since the component architecture doesn’t support adapters that work
one class only (not their subclasses), we register the adapter classes
as named ISynchronizerFactory utilities and use the dotted name of the
class as lookup key. The default synchronizer is registered as a
unnamed ISynchronizerFactory utility. This synchronizer ensures that
all data are pickled to the target repository.>>> component.provideUtility(synchronizer.DefaultSynchronizer,
... provides=interfaces.ISynchronizerFactory)All special synchronizers are registered for a specific content class and
not an abstract interface. The class is represented by the dotted class
name in the factory registration:>>> class AFileSynchronizer(synchronizer.Synchronizer):
... interface.implements(interfaces.IFileSynchronizer)
... def dump(self, writeable):
... writeable.write(self.context.data)
... def load(self, readable):
... self.context.data = readable.read()>>> component.provideUtility(AFileSynchronizer,
... interfaces.ISynchronizerFactory,
... name=synchronizer.dottedname(A))The lookup of the utilities by the dotted class name is handled
by the getSynchronizer function, which first tries to find
a named utility. The IDefaultSynchronizer utility is used as a fallback:>>> synchronizer.getSynchronizer(a)
<zope.fssync.doctest.AFileSynchronizer object at ...>If no named adapter is registered it returns the registered unnamed default
adapter (as long as the permissions allow this):>>> synchronizer.getSynchronizer(b)
<zope.fssync.synchronizer.DefaultSynchronizer object at ...>This default serializer typically uses a pickle format, which is determined
by the IPickler adapter. Here we use Zope’s xmlpickle.>>> component.provideAdapter(pickle.XMLPickler)
>>> component.provideAdapter(pickle.XMLUnpickler)For container like objects we must provide an adapter that maps the
container to a directory. In our example we use the buildin dict class:>>> component.provideUtility(synchronizer.DirectorySynchronizer,
... interfaces.ISynchronizerFactory,
... name=synchronizer.dottedname(dict))Now we can export the object to the snarf archive:>>> checkout.perform(root, 'test')
>>> print snarf.stream.getvalue()
00000213 @@Zope/Entries.xml
<?xml version='1.0' encoding='utf-8'?>
<entries>
<entry name="test"
keytype="__builtin__.str"
type="__builtin__.dict"
factory="__builtin__.dict"
id="3"
/>
</entries>
00000339 test/@@Zope/Entries.xml
<?xml version='1.0' encoding='utf-8'?>
<entries>
<entry name="a"
keytype="__builtin__.str"
type="zope.fssync.doctest.A"
factory="zope.fssync.doctest.A"
id="1"
/>
<entry name="b"
keytype="__builtin__.str"
type="zope.fssync.doctest.B"
id="2"
/>
</entries>
00000009 test/a
data of a00000370 test/b
<?xml version="1.0" encoding="utf-8" ?>
<pickle>
<object>
<klass>
<global name="B" module="zope.fssync.doctest"/>
</klass>
<attributes>
<attribute name="data">
<string>data of b</string>
</attribute>
<attribute name="extra">
<string>extra of b</string>
</attribute>
</attributes>
</object>
</pickle>
<BLANKLINE>After the registration of the necessary generators we can reimport the
serialized data from the repository:>>> component.provideUtility(synchronizer.FileGenerator(),
... provides=interfaces.IFileGenerator)>>> target = {}
>>> commit = task.Commit(synchronizer.getSynchronizer, snarf)
>>> commit.perform(target, 'root', 'test')
>>> sorted(target.keys())
['root']
>>> sorted(target['root'].keys())
['a', 'b']>>> target['root']['a'].data
'data of a'>>> target['root']['b'].extra
'extra of b'If we want to commit the data back into the original place we must check
whether the repository is still consistent with the original content.
We modify the objects in place to see what happens:>>> check = task.Check(synchronizer.getSynchronizer, snarf)
>>> check.check(root, '', 'test')
>>> check.errors()
[]>>> root['a'].data = 'overwritten'
>>> root['b'].extra = 'overwritten'>>> check = task.Check(synchronizer.getSynchronizer, snarf)
>>> check.check(root, '', 'test')
>>> check.errors()
['test/a', 'test/b']>>> commit.perform(root, '', 'test')
>>> sorted(root.keys())
['a', 'b']
>>> root['a'].data
'data of a'
>>> root['b'].extra
'extra of b'>>> del root['a']
>>> commit.perform(root, '', 'test')
>>> sorted(root.keys())
['a', 'b']>>> del root['b']
>>> commit.perform(root, '', 'test')
>>> sorted(root.keys())
['a', 'b']>>> del root['a']
>>> del root['b']
>>> commit.perform(root, '', 'test')
>>> sorted(root.keys())
['a', 'b']PicklingIn many data structures, large, complex objects are composed of
smaller objects. These objects are typically stored in one of two
ways:The smaller objects are stored inside the larger object.The smaller objects are allocated in their own location,
and the larger object stores references to them.In case 1 the object is self-contained and can be pickled
completely. This is the default behavior of the fssync pickler:>>> pickler = interfaces.IPickler([42])
>>> pickler
<zope.fssync.pickle.XMLPickler object at ...>
>>> print pickler.dumps()
<?xml version="1.0" encoding="utf-8" ?>
<pickle>
<list>
<int>42</int>
</list>
</pickle>
<BLANKLINE>Case 2 is more complex since the pickler has to take persistent
references into account.>>> class Complex(object):
... def __init__(self, part1, part2):
... self.part1 = part1
... self.part2 = part2Everthing here depends on the definition of what we consider to be an intrinsic
reference. In the examples above we simply considered all objects as intrinsic.>>> from zope.fssync import pickle
>>> c = root['c'] = Complex(a, b)
>>> stream = StringIO()
>>> print interfaces.IPickler(c).dumps()
<?xml version="1.0" encoding="utf-8" ?>
<pickle>
<initialized_object>
<klass>
<global id="o0" name="_reconstructor" module="copy_reg"/>
</klass>
<arguments>
<tuple>
<global name="Complex" module="zope.fssync.doctest"/>
<global id="o1" name="object" module="__builtin__"/>
<none/>
</tuple>
</arguments>
<state>
<dictionary>
<item key="part1">
<object>
<klass>
<global name="A" module="zope.fssync.doctest"/>
</klass>
<attributes>
<attribute name="data">
<string>data of a</string>
</attribute>
</attributes>
</object>
</item>
<item key="part2">
<object>
<klass>
<global name="B" module="zope.fssync.doctest"/>
</klass>
<attributes>
<attribute name="data">
<string>data of b</string>
</attribute>
<attribute name="extra">
<string>overwritten</string>
</attribute>
</attributes>
</object>
</item>
</dictionary>
</state>
</initialized_object>
</pickle>
<BLANKLINE>In order to use persistent references we must define a
PersistentIdGenerator for our pickler, which determines whether
an object should be pickled completely or only by reference:>>> class PersistentIdGenerator(object):
... interface.implements(interfaces.IPersistentIdGenerator)
... component.adapts(interfaces.IPickler)
... def __init__(self, pickler):
... self.pickler = pickler
... def id(self, obj):
... if isinstance(obj, Complex):
... return None
... return globalIds.getId(obj)>>> component.provideAdapter(PersistentIdGenerator)>>> globalIds.register(a)
1
>>> globalIds.register(b)
2
>>> globalIds.register(root)
3>>> xml = interfaces.IPickler(c).dumps()
>>> print xml
<?xml version="1.0" encoding="utf-8" ?>
<pickle>
<object>
<klass>
<global name="Complex" module="zope.fssync.doctest"/>
</klass>
<attributes>
<attribute name="part1">
<persistent> <string>1</string> </persistent>
</attribute>
<attribute name="part2">
<persistent> <string>2</string> </persistent>
</attribute>
</attributes>
</object>
</pickle>
<BLANKLINE>The persistent ids can be loaded if we define and register
a IPersistentIdLoader adapter first:>>> class PersistentIdLoader(object):
... interface.implements(interfaces.IPersistentIdLoader)
... component.adapts(interfaces.IUnpickler)
... def __init__(self, unpickler):
... self.unpickler = unpickler
... def load(self, id):
... global globalIds
... return globalIds.resolve(id)>>> component.provideAdapter(PersistentIdLoader)
>>> c2 = interfaces.IUnpickler(None).loads(xml)
>>> c2.part1 == a
TrueAnnotations, Extras, and MetadataComplex objects often combine metadata and content data in various ways.
The fssync package allows to distinguish between file content, extras,
annotations, and fssync specific metadata:The file content or body is directly stored in a corresponding
file.The extras are object attributes which are part of the object but not
part of the file content. They are typically store in extra files.Annotations are content related metadata which can be stored as
attribute annotations or outside the object itself. They are typically
stored in seperate pickles for each annotation namespace.Metadata directly related to fssync are stored in Entries.xml
files.Where exactly these aspects are stored is defined in the
synchronization format. The default format uses a @@Zope directory with
subdirectories for object extras and annotations. These @@Zope directories
also contain an Entries.xml metadata file which defines the following
attributes:id: the system id of the object, in Zope typically a traversal pathname: the filename of the serialized objectfactory: the factory of the object, typically a dotted name of a classtype: a type identifier for pickled objects without factoryprovides: directly provided interfaces of the objectkey: the original name in the content space which is usedin cases where the repository is not able to store this key
unambigouslybinary: a flag that prevents merging of binary dataflag: a status flag with the values ‘added’ or ‘removed’In part the metadata have to be delivered by the synchronizer. The base
synchronizer, for instance, returns the directly provided interfaces
of an object as part of it’s metadata:>>> class IMarkerInterface(interface.Interface):
... pass
>>> interface.directlyProvides(a, IMarkerInterface)
>>> pprint(synchronizer.Synchronizer(a).metadata())
{'factory': 'zope.fssync.doctest.A',
'provides': 'zope.fssync.doctest.IMarkerInterface'}The setmetadata method can be used to write metadata
back to an object. Which metadata are consumed is up to the
synchronizer:>>> metadata = {'provides': 'zope.fssync.doctest.IMarkerInterface'}
>>> synchronizer.Synchronizer(b).setmetadata(metadata)
>>> [x for x in interface.directlyProvidedBy(b)]
[<InterfaceClass zope.fssync.doctest.IMarkerInterface>]In order to serialize annotations we must first provide a
ISynchronizableAnnotations adapter:>>> snarf = repository.SnarfRepository(StringIO())
>>> checkout = task.Checkout(synchronizer.getSynchronizer, snarf)>>> from zope import annotation
>>> from zope.annotation.attribute import AttributeAnnotations
>>> component.provideAdapter(AttributeAnnotations)
>>> class IAnnotatableSample(interface.Interface):
... pass
>>> class AnnotatableSample(object):
... interface.implements(IAnnotatableSample,
... annotation.interfaces.IAttributeAnnotatable)
... data = 'Main file content'
... extra = None
>>> sample = AnnotatableSample()>>> class ITestAnnotations(interface.Interface):
... a = interface.Attribute('A')
... b = interface.Attribute('B')
>>> import persistent
>>> class TestAnnotations(persistent.Persistent):
... interface.implements(ITestAnnotations,
... annotation.interfaces.IAnnotations)
... component.adapts(IAnnotatableSample)
... def __init__(self):
... self.a = None
... self.b = None>>> component.provideAdapter(synchronizer.SynchronizableAnnotations)>>> from zope.annotation.factory import factory
>>> component.provideAdapter(factory(TestAnnotations))
>>> ITestAnnotations(sample).a = 'annotation a'
>>> ITestAnnotations(sample).a
'annotation a'
>>> sample.extra = 'extra'Without a special serializer the annotations are pickled since
the annotations are stored in the __annotions__ attribute:>>> root = dict()
>>> root['test'] = sample
>>> checkout.perform(root, 'test')
>>> print snarf.stream.getvalue()
00000197 @@Zope/Entries.xml
<?xml version='1.0' encoding='utf-8'?>
<entries>
<entry name="test"
keytype="__builtin__.str"
type="__builtin__.dict"
factory="__builtin__.dict"
/>
</entries>
00000182 test/@@Zope/Entries.xml
<?xml version='1.0' encoding='utf-8'?>
<entries>
<entry name="test"
keytype="__builtin__.str"
type="zope.fssync.doctest.AnnotatableSample"
/>
</entries>
00001929 test/test
<?xml version="1.0" encoding="utf-8" ?>
<pickle>
<object>
<klass>
<global name="AnnotatableSample" module="zope.fssync.doctest"/>
</klass>
...
</attributes>
</object>
</pickle>
<BLANKLINE>If we provide a directory serializer for annotations and extras we get a
file for each extra attribute and annotation namespace.>>> component.provideUtility(
... synchronizer.DirectorySynchronizer,
... interfaces.ISynchronizerFactory,
... name=synchronizer.dottedname(synchronizer.Extras))>>> component.provideUtility(
... synchronizer.DirectorySynchronizer,
... interfaces.ISynchronizerFactory,
... name=synchronizer.dottedname(
... synchronizer.SynchronizableAnnotations))Since the annotations are already handled by the Synchronizer base class
we only need to specify the extra attribute here:>>> class SampleFileSynchronizer(synchronizer.Synchronizer):
... interface.implements(interfaces.IFileSynchronizer)
... def dump(self, writeable):
... writeable.write(self.context.data)
... def extras(self):
... return synchronizer.Extras(extra=self.context.extra)
... def load(self, readable):
... self.context.data = readable.read()
>>> component.provideUtility(SampleFileSynchronizer,
... interfaces.ISynchronizerFactory,
... name=synchronizer.dottedname(AnnotatableSample))>>> interface.directlyProvides(sample, IMarkerInterface)
>>> root['test'] = sample
>>> checkout.perform(root, 'test')
>>> print snarf.stream.getvalue()
00000197 @@Zope/Entries.xml
<?xml version='1.0' encoding='utf-8'?>
<entries>
<entry name="test"
keytype="__builtin__.str"
type="__builtin__.dict"
factory="__builtin__.dict"
/>
</entries>
00000182 test/@@Zope/Entries.xml
<?xml version='1.0' encoding='utf-8'?>
<entries>
<entry name="test"
keytype="__builtin__.str"
type="zope.fssync.doctest.AnnotatableSample"
/>
</entries>
00001929 test/test
<?xml version="1.0" encoding="utf-8" ?>
<pickle>
<object>
<klass>
<global name="AnnotatableSample" module="zope.fssync.doctest"/>
</klass>
<attributes>
<attribute name="__annotations__">
...
</attribute>
<attribute name="extra">
<string>extra</string>
</attribute>
</attributes>
</object>
</pickle>
00000197 @@Zope/Entries.xml
<?xml version='1.0' encoding='utf-8'?>
<entries>
<entry name="test"
keytype="__builtin__.str"
type="__builtin__.dict"
factory="__builtin__.dict"
/>
</entries>
00000296 test/@@Zope/Entries.xml
<?xml version='1.0' encoding='utf-8'?>
<entries>
<entry name="test"
keytype="__builtin__.str"
type="zope.fssync.doctest.AnnotatableSample"
factory="zope.fssync.doctest.AnnotatableSample"
provides="zope.fssync.doctest.IMarkerInterface"
/>
</entries>
00000211 test/@@Zope/Annotations/test/@@Zope/Entries.xml
<?xml version='1.0' encoding='utf-8'?>
<entries>
<entry name="zope.fssync.doctest.TestAnnotations"
keytype="__builtin__.str"
type="zope.fssync.doctest.TestAnnotations"
/>
</entries>
00000617 test/@@Zope/Annotations/test/zope.fssync.doctest.TestAnnotations
<?xml version="1.0" encoding="utf-8" ?>
<pickle>
...
</pickle>
00000161 test/@@Zope/Extra/test/@@Zope/Entries.xml
<?xml version='1.0' encoding='utf-8'?>
<entries>
<entry name="extra"
keytype="__builtin__.str"
type="__builtin__.str"
/>
</entries>
00000082 test/@@Zope/Extra/test/extra
<?xml version="1.0" encoding="utf-8" ?>
<pickle> <string>extra</string> </pickle>
00000017 test/test
Main file contentThe annotations and extras can of course also be deserialized. The default
deserializer handles both cases:>>> target = {}
>>> commit = task.Commit(synchronizer.getSynchronizer, snarf)
>>> commit.perform(target, 'root', 'test')
>>> result = target['root']['test']
>>> result.extra
'extra'
>>> ITestAnnotations(result).a
'annotation a'Since we use an IDirectorySynchronizer each extra attribute and
annotation namespace get’s it’s own file:>>> for path in sorted(snarf.iterPaths()):
... print path
@@Zope/Entries.xml
test/@@Zope/Annotations/test/@@Zope/Entries.xml
test/@@Zope/Annotations/test/zope.fssync.doctest.TestAnnotations
test/@@Zope/Entries.xml
test/@@Zope/Extra/test/@@Zope/Entries.xml
test/@@Zope/Extra/test/extra
test/testThe number of files can be reduced if we provide the default synchronizer
which uses a single file for all annotations and a single file for
all extras:>>> component.provideUtility(
... synchronizer.DefaultSynchronizer,
... interfaces.ISynchronizerFactory,
... name=synchronizer.dottedname(synchronizer.Extras))>>> component.provideUtility(
... synchronizer.DefaultSynchronizer,
... interfaces.ISynchronizerFactory,
... name=synchronizer.dottedname(
... synchronizer.SynchronizableAnnotations))>>> root['test'] = sample
>>> snarf = repository.SnarfRepository(StringIO())
>>> checkout.repository = snarf
>>> checkout.perform(root, 'test')
>>> for path in sorted(snarf.iterPaths()):
... print path
@@Zope/Entries.xml
test/@@Zope/Annotations/test
test/@@Zope/Entries.xml
test/@@Zope/Extra/test
test/testThe annotations and extras can of course also be deserialized. The default
deserializer handles both>>> target = {}
>>> commit = task.Commit(synchronizer.getSynchronizer, snarf)
>>> commit.perform(target, 'root', 'test')
>>> result = target['root']['test']
>>> result.extra
'extra'
>>> ITestAnnotations(result).a
'annotation a'
>>> [x for x in interface.directlyProvidedBy(result)]
[<InterfaceClass zope.fssync.doctest.IMarkerInterface>]If we encounter an error, or multiple errors, while commiting we’ll
see them in the traceback.>>> def bad_sync(container, key, fspath, add_callback):
... raise ValueError('1','2','3')>>> target = {}
>>> commit = task.Commit(synchronizer.getSynchronizer, snarf)
>>> old_sync_new = commit.synchNew
>>> commit.synchNew = bad_sync
>>> commit.perform(target, 'root', 'test')
Traceback (most recent call last):
...
Exception: test: '1', '2', '3'Notice that if we encounter multiple exceptions we print them all
out at the end.>>> old_sync_old = commit.synchOld
>>> commit.synchOld = bad_sync
>>> commit.perform(target, 'root', 'test')
Traceback (most recent call last):
...
Exceptions:
test: '1', '2', '3'
test: '1', '2', '3'>>> commit.synchNew = old_sync_new
>>> commit.synchOld = old_sync_oldChanges3.6.1 (2013-05-02)Fixed exception raising on unpickling errors when checking in.Improved reporting of unpickling errors.3.6.0 (2012-03-15)Commit task will collect errors and send them all back rather
than stopping on the first error encountered.3.5.2 (2010-10-18)Fix tests; zope.location no longer exports TLocation.Raise the right error in zope.fssync.synchronizer when the configured
synchronizer does not exist.Update dependency information.Minor code cleanups.3.5.1 (2009-07-24)Properly setup tests, so that they will work in a release as well.Removed slugs.3.5 (????)Added the support for empty directories in snarf format. Now
directories can be explicitly described by snarf.Synchronizers can now return callbacks from the load
method. This allows for fix ups to be run later. This is useful
when adding multiple objects at the same time that depend on
each other. Callbacks can in turn return callbacks.Add support to FSMerger to allow locally modified files to be
overwritten by files returned from the server. The purpose of
this is to avoid conflicts after commit on files that are
formatted differently on the server from local versions.3.4.0b1 (????)Refactoring of zope.fssync and zope.app.fssync into two clearly
separated packages:zope.fssync contains now a Python API that has no critical dependencies
on Zope, the ZODB, and the security machinery.zope.app.fssync contains a protected web-based API and special
synchronizers for zope.app content types.Other major changes aresynchronizers (i.e. serialization/de-serialization adapters) are created
by named utilities which use dotted class names as lookup keysadded doctestssupport for large filesadapters for pickler, unpickler and handling of persistent pickle idsbinaries are no longer mergedcase-insensitive filesystems and repositories use disambiguated names on
export and the original names on importexport and import of directly provided interfacesdirect export to archives/direct import from archivesaddressed encoding problems on Mac OSX |
zope.generations | zope.generationsGenerations are a way of updating objects in the database when the application
schema changes. An application schema is essentially the structure of data,
the structure of classes in the case of ZODB or the table descriptions in the
case of a relational database.Seehttps://zopegenerations.readthedocs.io/for complete documentation.CHANGES5.1.0 (2022-02-11)Drop support for Python 3.4.Add support for Python 3.8, 3.9 and 3.10.5.0.0 (2019-09-23)Add support for transaction managers operating in explicit mode.
Schema managers were previously required not to commit transactions
in theirevolveorinstallmethods, but a loophole was open
to allow them to commit “if there were no subsequent operations”.
That loophole is now closed, at least in explicit mode. Seeissue 8.4.1.0 (2018-10-23)Add support for Python 3.7.4.0.0 (2017-07-20)Dropped support for Python 2.6 and 3.3.Added support for Python 3.4, 3.5, 3.6, PyPy2 and PyPy3.4.0.0a1 (2013-02-25)Added support for Python 3.3.Replaced deprecatedzope.interface.implementsusage with equivalentzope.interface.implementerdecorator.Dropped support for Python 2.4 and 2.5.3.7.1 (2011-12-22)Removed buildout part which was used during development but does not
compile on Windows.Generation scripts add a transaction note.3.7.0 (2010-09-18)Initial release extracted fromzope.app.generations.Generations key (stored in database root) has been changed fromzope.app.generationstozope.generations. Migration is done whenevolveis run the first time by coping the existing generations data
over to the new key. So the old and the new key can be used in parallel. |
zope.globalrequest | IntroductionThis package provides a contextless way to retrieve the currently active request object in a zope-based web framework.
To do so you simply need to do the following:from zope.globalrequest import getRequest
request = getRequest()This package is mainly intended to be used with the Zope/Plone stack.
While it also works with the Zope3 framework,
the latter promotes a clean separation of concerns and the pattern of having a globally available request object is discouraged.Changelog2.0 (2023-03-27)Drop support for Python 2.7, 3.5, 3.6.Mention Python 3.11 support in trove classifiers.1.6 (2022-10-18)Add support for Python 3.8, 3.9, 3.10 and 3.11Drop support for Python 3.4.1.5 (2018-10-04)Add support for Python 3.7.1.4 (2017-05-29)Turn functional tests into better covering unit tests and also add more tests.
This removes test dependencies on unrelated packages.1.3 (2016-10-22)Python 3 compatibility.1.2 (2016-06-07)Lighten test dependencies by using neitherzope.app.testingnorzope.app.zcmlfilesany longer.1.1 (2015-04-29)Fix import locations and declare all dependencies.
[thet]1.0 (2010-08-07)Fix test setup regardingzope.securitypolicy.
[ldr]1.0a2 (2009-01-17)Update documentation to clarify the intentions of this package. Also seehttp://thread.gmane.org/gmane.comp.web.zope.devel/18023for more information.
[witsch]1.0a1 (2009-01-15)Initial release
[witsch] |
zope.hookable | zope.hookableThis package supports the efficient creation of “hookable” objects, which
are callable objects that are meant to be optionally replaced.The idea is that you create a function that does some default thing and make it
hookable. Later, someone can modify what it does by calling its sethook method
and changing its implementation. All users of the function, including those
that imported it, will see the change.Documentation is hosted athttps://zopehookable.readthedocs.ioChanges6.0 (2023-10-05)Drop support for Python 2.7, 3.5, 3.6.Add support for Python 3.12.5.4 (2022-11-17)Add support for building arm64 wheels on macOS.5.3 (2022-11-03)Add support for the final release of Python 3.11.5.2 (2022-09-13)Add support for Python 3.10 and 3.11 (as of 3.11.0rc1).Disable unsafe math optimizations in C code. Seepull request 25.5.1.0 (2021-07-20)Add support for Python 3.9.Create Linux aarch64 wheels.5.0.1 (2020-03-10)Stop using the setuptoolsFeatureclass, allowing this
project to be built from source with newer versions of setuptools
that remove that functionality.5.0.0 (2019-11-12)Add support for Python 3.7 and 3.8.Drop support for Python 3.4.4.2.0 (2017-11-07)Expose the__doc__(and, where applicable,__bases__and__dict__) of the hooked object. This lets Sphinx document them.
Seeissue 6.RespectPURE_PYTHONat runtime. At build time, always try to
build the C extensions on supported platforms, but allow it to fail.
Seeissue 7.4.1.0 (2017-07-26)Drop support for Python 2.6, 3.2 and 3.3.Add support for Python 3.5 and 3.6.4.0.4 (2014-03-19)Add support for Python 3.4.4.0.3 (2014-03-17)Updateboostrap.pyto version 2.2.Fix extension compilation on Py3k.4.0.2 (2012-12-31)Flesh out PyPI Trove classifiers.4.0.1 (2012-11-21)Add support for Python 3.3.Avoid building the C extension explicitly (use the “feature” indirection
instead).https://bugs.launchpad.net/zope.hookable/+bug/10254704.0.0 (2012-06-04)Add support for PyPy.Add support for continuous integration usingtoxandjenkins.Add a pure-Python reference implementation.Move doctests to Sphinx documentation.Bring unit test coverage to 100%.Add ‘setup.py docs’ alias (installsSphinxand dependencies).Add ‘setup.py dev’ alias (runssetup.py developplus installsnoseandcoverage).Drop support for Python 2.4 / 2.5.Remove of ‘zope.testing.doctestunit’ in favor of stdlib’s ‘doctest.Add Python 3 support.3.4.1 (2009-04-05)Update for compatibility with Python 2.6 traceback formats.Use Jython-compatiblebootstrap.py.3.4.0 (2007-07-20)Initial release as a separate project. |
zope.html | This package contains support for editing HTML and XHTML inside a web
page using the FCKeditor as a widget. This is a fairly simple
application of FCKeditor, and simply instantiates a pre-configured
editor for each widget. There are no options to control the editors
individually.Detailed DocumentationHTML file editing supportThis package contains support for editing HTML and XHTML inside a web
page using the FCKeditor as a widget. This is a fairly simple
application of FCKeditor, and simply instantiates a pre-configured
editor for each widget. There are no options to control the editors
individually.In creating this, we ran into some limitations of the editor that are
worth being aware of. Noting these as limitations does not mean that
other editors do any better; what’s available seems to be a mixed bag.The editor only deals with what can be contained inside a <body>
element; anything that goes outside that, including the <body> and
</body> tags, get lost or damaged. If there’s any way to configure
FCKeditor to deal with such material, it isn’t documented.There’s no real control of the HTML source; whitespace is not
preserved as a programmer would expect. That’s acceptable in many
use cases, but not all. Applications should avoid using this widget
if the original whitespace must be maintained.Implementation problemsThese are problems with the widget used to integrate FCKeditor rather
than problems with FCKeditor itself. These should be dealt with.The width of the editor is hardcoded; this should be either
configurable or the editor should stretch to fill the available
space. The sample uses of the FCKeditor don’t seem to exhibit this
problem, so it can be better than it is.The height of the editor should be configurable in a way similar to
the configuration of the basic textarea widget.Ideas for future developmentThese ideas might be interesting to pursue, but there are no specific
plans to do so at this time:Categorize the applications of the editor and provide alternate
toolbar configurations for those applications. There’s a lot of
configurability in the editor itself, so it can be made to do
different things.Add support for some of the other fancy client-side HTML editors,
and allow a user preference to select which to use for what
applications, including the option of disabling the GUI editors when
detailed control over the HTML is needed (or for luddite users who
don’t like the GUI editors).XINHA (http://xinha.python-hosting.com/) appears to be an
interesting option as well, and may be more usable for applications
that want more than editing of small HTML fragments, especially if
the user is fairly HTML-savvy.HTMLArea (http://www.dynarch.com/projects/htmlarea/) may become
interesting at some point, but a rough reading at this time
indicates that XINHA may be a more reasonable route.More information about FCKeditorhttp://www.fckeditor.net/http://discerning.com/topics/software/ttw.htmlhttp://www.phpsolvent.com/wordpress/?page_id=330Management of supplemental informationThezope.htmlpackage provides additional views on files containing
HTML and XHTML data that allow editing the files over the web. The
files may contain either complete documents or fragments that may be
composed into larger documents. Preview views are also provided.The editing and preview views rely on getting supplemental information
about the file being edited using theIEditableHtmlInformationadapter for the file. That adapter uses annotations on the content
object to store information that needs to be persisted.TheIEditableHtmlInformationinterface is very simple; there’s only
one field defined, and it’s a simple boolean value: whether the file
should be treated as a fragment or not. Let’s create a simple content
object that we can use for testing:>>> import zope.file.file
>>> import zope.interface
>>> import zope.annotation
>>> class File(zope.file.file.File):
... zope.interface.implements(
... zope.annotation.IAttributeAnnotatable)
...
... def __init__(self, text=None):
... super(File, self).__init__("text/html", {"charset": "utf-8"})
... f = self.open("w")
... f.write(text)
... f.close()Let’s create a file and the correspondingIEditableHtmlInformationobject:>>> import zope.html.docinfo
>>> file = File("This is a <em>fragment</em>.")
>>> info = zope.html.docinfo.EditableHtmlInformation(file)We can now check that the initial value of theisFragmentattribute
is computed reasonably:>>> info.isFragment
TrueThe user can cause theisFragmentflag to be toggled from the UI, so
it should remember the current state of the flag:>>> info.isFragment = False
>>> info.isFragment
FalseA new instance of theIEditableHtmlInformationinstance should also remember the last value of the setting:>>> zope.html.docinfo.EditableHtmlInformation(file).isFragment
False(X)HTML fragment editor widgetThe widget included in this package is a simple application of the
FCKeditor control. It is only expected to work for fragments, not for
arbitrary documents. Let’s create a field and a widget:>>> from zope.html import field
>>> from zope.html import widget
>>> from zope.publisher import browser
>>> class Context(object):
... sample = u""
>>> myfield = field.XhtmlFragment(
... __name__="sample",
... title=u"Sample Field",
... ).bind(Context())
>>> request = browser.TestRequest()
>>> mywidget = widget.FckeditorWidget(myfield, request)
>>> mywidget.setPrefix("form")
>>> mywidget.configurationPath = "/myconfig.js"
>>> mywidget.editorWidth = 360
>>> mywidget.editorHeight = 200
>>> mywidget.toolbarConfiguration = "mytoolbars"
>>> print mywidget()
<textarea...></textarea>
<script...
"form.sample", 360, 200, "mytoolbars");
...Config["CustomConfigurationsPath"] = "/myconfig.js";
...
</script>
<BLANKLINE>We should also test the CkeditorWidget.>>> ckwidget = widget.CkeditorWidget(myfield, request)
>>> ckwidget.configurationPath = "/myconfig.js"
>>> ckwidget.editorHeight = 200The “fckVersion” attribute holds the version of CKEditor library.>>> ckwidget.fckVersion
'3.6.2'>>> print ckwidget()
<textarea...></textarea>
<script...
...height: 200...
...customConfig : "/myconfig.js"...
</script>
<BLANKLINE>Views on editable HTMLLet’s start by uploading some HTML to create a file object:>>> import StringIO
>>> sio = StringIO.StringIO("This is a <em>fragment</em>."
... " There's one 8-bit Latin-1 character: \xd8.")
>>> from zope.testbrowser.testing import Browser
>>> browser = Browser()
>>> browser.addHeader("Authorization", "Basic user:userpw")
>>> browser.addHeader("Accept-Language", "en-US")
>>> browser.open("http://localhost/@@+/zope.file.File")
>>> ctrl = browser.getControl(name="form.data")
>>> ctrl.mech_control.add_file(sio, "text/html", "sample.html")
>>> browser.getControl("Add").click()We can see that the MIME handlers have marked this as HTML content:>>> import zope.mimetype.types
>>> file = getRootFolder()["sample.html"]
>>> zope.mimetype.types.IContentTypeTextHtml.providedBy(file)
TrueThe “Edit” view can be used to check and modify the “Is fragment?”
field, which is stored by the views in an annotation on the object.
The particular fragment we uploaded here should be see as a fragment
by default:>>> browser.getLink("sample.html").click()
>>> browser.getLink("Edit").click()
>>> browser.open("http://localhost/sample.html/@@htmledit.html")
>>> ctrl = browser.getControl(name="form.isFragment")
>>> ctrl.value
TrueThe setting can be toggle by unchecking the checkbox and clicking
“Save”:>>> ctrl.value = False
>>> browser.getControl("Save").click()
>>> ctrl = browser.getControl(name="form.isFragment")
>>> ctrl.value
FalseThe edit view also allows editing of the HTML content if the document
can be decoded. If the encoding of the document is not known, the
document cannot be edited by the user is prompted to select an
encoding that should be used.Our example document does not have a specified encoding, so we expect
the form to indicate that the encoded is needed, and to allow the user
to select and encoding. Let’s reload the form to get rid of the
“Updated…” message so we can see what the user is told:>>> browser.getLink("Edit").click()
>>> print browser.contents
<...Can't decode text for editing; please specify the document encoding...
>>> ctrl = browser.getControl(name="form.encoding")
>>> ctrl.value
['']The user can then select an encoding:>>> ctrl.value = ["utf-8"]
>>> browser.getControl("Save").click()Since we just selected an encoding that doesn’t work with the Latin-1
data we uploaded for the file, we’re told that that encoding is not
acceptable:>>> print browser.contents
<...Selected encoding cannot decode document...We need to select an encoding that actually makes sense for the data
that we’ve uploaded:>>> ctrl = browser.getControl(name="form.encoding")
>>> ctrl.value = ["iso-8859-1"]
>>> browser.getControl("Save").click()Now that the encoding has been saved, the document can be encoded and
edited, and the encoding selection will no longer be available on the
form:>>> browser.getControl(name="form.encoding")
Traceback (most recent call last):
...
LookupError: name 'form.encoding'...Since our selected encoding does not support all Unicode characters,
there is an option available to allow re-encoding of the document if
the content being saved after editing cannot be encoded in the
original encoding of the document. The value of this option defaults
to False since the user needs to be aware that the document encoding
may be modified:>>> browser.getControl(name="form.reencode").value
FalseIf we edit the text such that characters are included that cannot be
encoded in the current encoding and try to save our changes without
allowing re-encoding, we see a notification that the document can’t be
encoded in the original encoding and that re-encoding is needed:>>> ctrl = browser.getControl(name="form.text")
>>> ctrl.value = u"\u3060\u3051\u306e\u30b5\u30a4\u30c8".encode("utf-8")
>>> browser.getControl("Save").click()
>>> print browser.contents
<...Can't encode text in current encoding...At this point, we can select the “Re-encode” option to allow the text
to be saved in an encoding other than the original; this would allow
us to save any text:>>> browser.getControl(name="form.reencode").value = True
>>> browser.getControl("Save").click()
>>> print browser.contents
<...Updated on ...If we now take a look at the “Content Type” view for the file, we see
that the encoding has been updated to UTF-8:>>> browser.getLink("Content Type").click()
>>> browser.getControl(name="form.encoding").value
['utf-8']CHANGES2.4.2 (2014-04-17)Remove unneeded zope.app.authentication/debugskin/server test dependencies.Support for test output changed in zope.testbrowser 4.0.32.4.1 (2012-01-26)Fix path of CKEditor resources.2.4.0 (2012-01-26)Use CKEditor 3.6.2Using Python’sdoctestmodule instead of deprecatedzope.testing.doctest.2.3.0 (2011-02-22)Use CKEditor 3.5.22.2.0 (2010-11-19)Make the use of un-minified ckeditor source explicit2.1.0 (2010-05-25)Use CKEditor 3.2.1Added configuration to use un-minified version of CKEditor when using dev
mode.Fixed import that caused test failures.2.0.0 (2009-09-04)Add CKeditor 3.0 widget.1.2.0 (2009-07-06)Use FCKeditor 2.6.4.1Remove _samples directory and erect a barrier to its resurrection1.1.0 (2008-06-18)Use FCKeditor 2.6Use versioned directories for javascript to cache-bust1.0.1 (2007-11-02)Package data update.Updated code to work with packages in Zope 3.4 release.1.0.0 (2007-10-29)Initial release. |
zope.httpform | zope.httpformis a library that, given a WSGI or CGI environment
dictionary, will return a dictionary back containing converted
form/query string elements. The form and query string elements
contained in the environment are converted into simple Python types when
the form element names are decorated with special suffixes. For
example, in an HTML form that you’d like this library to process,
you might say:<form action=".">
Age : <input type="hidden" name="age:int" value="20"/>
<input type="submit" name="Submit"/>
</form>Likewise, in the query string of the URL, you could put:http://example.com/mypage?age:int=20In both of these cases, when provided the WSGI or CGI environment,
and asked to return a value, this library will return a dictionary
like so:{'age':20}This functionality has lived for a long time inside Zope’s publisher,
but now it has been factored into this small library, making it easier
to explain, test, and use.ContentsForm/Query String Element ParsingGotchasAcknowledgementsCHANGESVersion 1.0.2 (2009-07-24)Version 1.0.1 (2009-02-07)Version 1.0.0 (2009-02-06)Form/Query String Element Parsingzope.httpformprovides a way for you to specify form input types in
the form, rather than in your application code. Instead of converting
theagevariable to an integer in a controller or view, you can
indicate that it is an integer in the form itself:Age <input type="text" name="age:int" />The:intappended to the form input name tells this library to
convert the form input to an integer when it is invoked. If the
user of your form types something that cannot be converted to an
integer in the above case (such as “22 going on 23”) then this library
will raise a ValueError.Here is a list of the standard parameter converters.:booleanConverts a variable to true or false. Empty strings are evaluated as
false and non-empty strings are evaluated as true.:intConverts a variable to an integer.:longConverts a variable to a long integer.:floatConverts a variable to a floating point number.:stringConverts a variable to a string. Most variables are strings already,
so this converter is not often used except to simplify file uploads.:textConverts a variable to a string with normalized line breaks.
Different browsers on various platforms encode line endings
differently, so this script makes sure the line endings are
consistent, regardless of how they were encoded by the browser.:listConverts a variable to a Python list.:tupleConverts a variable to a Python tuple.:tokensConverts a string to a list by breaking it on white spaces.:linesConverts a string to a list by breaking it on new lines.:requiredRaises an exception if the variable is not present.:ignore_emptyExcludes the variable from the form data if the variable is an empty
string.These converters all work in more or less the same way to coerce a
form variable, which is a string, into another specific type.The:listand:tupleconverters can be used in combination with
other converters. This allows you to apply additional converters to
each element of the list or tuple. Consider this form:<form action=".">
<p>I like the following numbers</p>
<input type="checkbox" name="favorite_numbers:list:int"
value="1" /> One<br />
<input type="checkbox" name="favorite_numbers:list:int"
value="2" />Two<br />
<input type="checkbox" name="favorite_numbers:list:int"
value="3" />Three<br />
<input type="checkbox" name="favorite_numbers:list:int"
value="4" />Four<br />
<input type="checkbox" name="favorite_numbers:list:int"
value="5" />5<br />
<input type="submit" />
</form>By using the:listand:intconverters together, this library
will convert each selected item to an integer and then combine all
selected integers into a list namedfavorite_numbers.A more complex type of form conversion is to convert a series of
inputs intorecords. Records are structures that have
attributes. Using records, you can combine a number of form inputs
into one variable with attributes. The available record converters
are::recordConverts a variable to a record attribute.:recordsConverts a variable to a record attribute in a list of records.:defaultProvides a default value for a record attribute if the variable is
empty.:ignore_emptySkips a record attribute if the variable is empty.Here are some examples of how these converters are used:<form action=".">
First Name <input type="text" name="person.fname:record" /><br />
Last Name <input type="text" name="person.lname:record" /><br />
Age <input type="text" name="person.age:record:int" /><br />
<input type="submit" />
</form>If the information represented by this form post is passed tozope.httpform, the resulting dictionary will container one parameter,person. Thepersonvariable will have the attributesfname,lnameandage. Here’s an example of how you might usezope.httpformto process the form post (assuming you have a WSGI
or CGI environment in hand):from zope.httpform import parse
info = parse(environ, environ['wsgi.input'])
person = info['person']
full_name = "%s %s" % (person.fname, person.lname)
if person.age < 21:
return ("Sorry, %s. You are not old enough to adopt an "
"aardvark." % full_name)
return "Thanks, %s. Your aardvark is on its way." % full_nameTherecordsconverter works like therecordconverter except
that it produces a list of records, rather than just one. Here is
an example form:<form action=".">
<p>Please, enter information about one or more of your next of
kin.</p>
<p>
First Name <input type="text" name="people.fname:records" />
Last Name <input type="text" name="people.lname:records" />
</p>
<p>
First Name <input type="text" name="people.fname:records" />
Last Name <input type="text" name="people.lname:records" />
</p>
<p>
First Name <input type="text" name="people.fname:records" />
Last Name <input type="text" name="people.lname:records" />
</p>
<input type="submit" />
</form>If you callzope.httpform’s parse method with the information
from this form post, a dictionary will be returned from it with a
variable calledpeoplethat is a list of records. Each record will
havefnameandlnameattributes. Note the difference between therecordsconverter and thelist:recordconverter: the former would
create a list of records, whereas the latter would produce a single
record whose attributesfnameandlnamewould each be a list of
values.The order of combined modifiers does not matter; for example,:int:listis identical to:list:int.GotchasThe file pointer passed tozope.httpform.parse()will be
consumed. For all intents and purposes this means you should make a
tempfile copy of thewsgi.inputfile pointer before callingparse()if you intend to use the POST file input data in your
application.AcknowledgementsThis documentation was graciously donated by the team at
Agendaless Consulting. Thezope.httpformpackage is
expected to replace therepoze.montypackage.CHANGESVersion 1.0.2 (2009-07-24)Include package data in release.Default to UTF-8 decodingFixed a test failure on Python 2.6Version 1.0.1 (2009-02-07)Fixed some misleading documentation.Relaxed the requirement for REQUEST_METHOD because the zope.publisher
tests do not set it.Used documentation and design ideas from repoze.monty. Thanks,
Chris and Agendaless.Version 1.0.0 (2009-02-06)First release of zope.httpform. Extracted from zope.publisher 3.5.5. |
zope.httpformdate | This is a small library that extends thezope.httpformlibrary to
support date/time parsing. It provides a:dateconverter that uses
the parser from thezope.datetimelibrary to convert a variety
of date/time formats to a standarddatetime.datetimeobject.CHANGESVersion 1.0.1 (2009-07-24)Include package data in release.Version 1.0.0 (2009-02-07)First release of zope.httpformdate. Extracted from zope.app.publisher. |
zope.i18n | zope.i18nThis package implements several APIs related to internationalization and
localization.Locale objects for all locales maintained by the ICU project.Gettext-based message catalogs for message strings.Locale discovery for Web-based requests.CHANGES5.1 (2023-08-28)Include*.mofiles in release but remove them from repository.5.0 (2023-03-27)Add support for Python 3.11.Drop support for Python 2.7, 3.5, 3.6.Drop deprecated support for running the tests usingpython setup.py test.4.9.0 (2021-12-09)Fix date/time format for zh, sv, and es_US.
(#17)Fix problems withzope_i18n_compile_mo_filesearly assignment to
module variable inconfig.pyin a non-breaking way.
See alsoZope issue #994Add support for Python 3.10.4.8.0 (2021-09-07)Support character sets.
Example:sr@Latnandsr@Cyrlwill be added to languagesr(Serbian).
Seehttps://github.com/collective/plone.app.locales/issues/326You can choose which one to use by setting eithersr@Latnorsr@Cyrlin environment variablezope_i18n_allowed_languages.Support and test Python 3.8 and 3.9.
Full supported list is now: 2.7, 3.5, 3.6, 3.7, 3.8, 3.9, PyPy, PyPy3.4.7.0 (2019-07-10)Drop Python 3.4 support.Fix the signature ofIMessageCatalog.getPluralMessage(). Seeissue 41.4.6.2 (2019-02-19)FixNumberFormatto respect the thousand grouping given by the pattern.
Triple grouping was hardcoded, which is not true for all locales.4.6.1 (2018-10-24)Fixdefault_pluralagain if azope.i18n.messageid.Messageis
used withtranslate(). Seeissue 36.4.6.0 (2018-10-22)Usemsgid_pluralasdefault_pluralif not provided intranslate().4.5 (2018-10-19)Add support for pluralization.translate()now takes the
additional optional argumentsmsgid_plural,default_pluralandnumberin order to support it.4.4 (2018-10-05)Add support for Python 3.7.4.3.1 (2017-12-19)MakePlacelessSetupnot extendzope.testing.cleanup.CleanUp.
ExtendingCleanUpwas introduced in 4.3.0 but turned out to have
unexpected consequences. Seeissue 30.4.3.0 (2017-12-18)Ensure that all files are properly closed when compiling .mo files,
such as when theregisterTranslationsZCML directive is used.Remove the private_compatmodule and its utility function_uin favor of Unicode literals.TranslationDomainno longer extendsSimpleTranslationDomain.
It overrode every method and didn’t properly initialize the super
class.TranslationDomaincontinues to implementITranslationDomain.TranslationDomainandGettextMessageCatalognow ensure that
theirdomainandlanguageattributes are text in order to
match their respective interfaces. Byte strings (such as native
string literals on Python 2) are decoded using UTF-8.FixLocaleCalendar.getFirstWeekDayName. Previously it raised a
KeyError when theweekmapping contained an integer forfirstDayas documented.Reach 100% test coverage and maintain in through tox.ini and
coveralls.io.OverridevaluesinInheritingDictionary. Previously it
implemented a separatevaluemethod by mistake.Fix parsing times with a timezone. Previously it could raise aTypeError.4.2.0 (2017-05-23)Better error message on PO-File Syntax Errors. [SyZn]Add support for Python 3.5 and 3.6.Drop support for Python 2.6, 3.2 and 3.3.Support for formatting really small numbers, e.g. 1e-9. These numbers needs
special treatment, because standard str(x) collapses them to scientific
representation.Support for specifying rounding in NumberFormatter. This is required in some
cases, e.g. when you format a Decimal(‘0.9999’) that sould not be rounded.
Currently, formatting Decimal(‘0.99999’) will raise a TypeError if rounding
is not set to False4.1.0 (2015-11-06)interpolate()now works recursively, if the mapping has a value which is
azope.i18nmessageid.Messageitself.4.0.1 (2015-06-05)Add support for Python 3.2 and PyPy3.4.0.0 (2014-12-20)Add support for testing with Travis.Add explicit support for Python 3.4 and PyPy.4.0.0a4 (2013-02-18)Restore zope.i18n.testing.{setUp,PlacelessSetup} that got lost in 4.0.0a3.
These require zope.publisher, which is not ported to Python 3 yet, so I
haven’t added it back to install_requires in setup.py. User beware.4.0.0a3 (2013-02-15)Add support for Python 3.3.Log DEBUG when loading translations from directories.Replacezope.interface.implementsusage with equivalentzope.interface.implementerdecorator.Drop support for Python 2.4 and 2.5.3.8.0 (2012-03-15)Add optionaldomainattribute toregisterTranslationsdirective to
only load the specified translation domain. Allows to move catalogs to/usr/share/localeand avoid loading hundreds of unrelated domains.Include meta.zcml files in our own zcml configuration as needed, added a
test for our configure.zcml.Update zope.i18n.NAME_RE to be identical to zope.tal as required by the
comment next to it. Fixes #611746.3.7.4 (2010-07-08)Add missing test dependency onzope.testing.3.7.3 (2010-04-30)Remove of ‘zope.testing.doctestunit’ in favor of stdlib’s ‘doctest.3.7.2 (2009-12-14)It’s a critical error when theGetTextlibrary is unavailable
and compilation is required.Use getSiteManager rather than getGlobalSiteManager in ZCML (these
should be one in the same in any non-fancy setup, however if you’ve
hooked getSiteManager, you want the ZCML handler to use the hooked
version).3.7.1 (2009-08-07)Fix the interpackage translation domain merging feature to actually work.
We need to defer the merging into the ZCML handler execution phase, as the
utilities don’t exist yet during the ZCML parsing phase. Thx to Andreas
Zeidler for finding and fixing the issue in PlacelessTranslationService in
the first place.Fix translation domains translating a message for a different domain. In the
process, fix testMessageIDTranslateForDifferentDomain which seemed to work by
mistake as the “other” and “default” domains used the same catalog. This is
basically a reversion of 39991.3.7.0 (2009-03-18)Update data to CLDR 1.1. This introduces contextual month
and day names and different month/day name widths. More CLDR updates
are expected, see the “nadako-cldr” branch of zope.i18n.Addconfigure.zcmlthat registers standard negotiator utility and includeszope.i18n.localesconfiguration. This was previously done byzope.app.i18n.3.6.0 (2008-10-26)Fix a test failure in the compile mo file support.Move the zcml support into an extra. This reduces the dependencies of a
standard zope.i18n install by half a dozen packages.3.5.0 (2008-07-10)Feature: Add new top-level negotiate function, which can be used to
negotiate the language when the available languages are set globally viazope_i18n_allowed_languages.Feature: Add support for restricting the available languages. We support
an environment variable calledzope_i18n_allowed_languagesnow, which is
a list of comma or space separated language codes. If the environment
variable is set, the ZCML registration will only process those folders
which are in the allowed languages list.Feature: Add optional automatic compilation of mo files from po files.
You need to depend on thezope.i18n [compile]extra and set an environment
variable calledzope_i18n_compile_mo_filesto any True value to enable
this option.Feature: Re-use existing translation domains when registering new ones.
This allows multiple packages to register translations in the same domain.
If the same message exists in multiple catalogs the one registered first
will take precedence.Feature: Recursive translations of message strings with mappings
(https://bugs.launchpad.net/zope3/+bug/210177), thanks to Hermann
Himmelbauer for the inital patch.Bug: When parsing a date, the parsing pattern did not ensure that the line
started and ended with the matching pattern, so that ‘1/1/2007’ parsed into
‘1/1/20’ for example.3.4.0 (2007-10-02)Update meta-data. No code changes.3.4.0b5 (2007-08-15)Bug: Fix dependency onzope.componentto require it with the ‘zcml’
extra instead of requiringzope.securitydirectly.3.4.0b4 (2007-07-19)Bug: Number parsing was too forgiving, allowing non-numerical and/or
formatting characters before, after and within the number. The parsing is
more strict now.3.4.0b3 (2007-06-28)Bug: There was a bug in the parser that if no decimal place is given
you still had to type the decimal symbol. Corrected this problem (one
character ;-) and provided a test.3.4.0b2 (2007-06-25)Feature: Add ability to change the output type when parsing a
number.3.4.0b1 (?)Bug: Fix dependency onzope.securityto require a version that
does not have the hidden dependency onzope.testing.Note: Releases between 3.2.0 and 3.4.0b1 were not tracked as individual
packages. The changes can be reconstructed from the Zope 3 changelog.3.2.0 (2006-01-05)Corresponds to the verison of the zope.i18n package shipped as part of the
Zope 3.2.0 release.Add a picklable offset-based timezone to ‘pytz’, a la
zope.app.datetimeutils’. Added tests in ‘zope.i18n’ to show that we need
something like it, and then actually use it in ‘zope.18n.format’.Add support for parsing / formatting timezones using ‘pytz’ (new external
dependency).Implement remaining date/time formatters, including adding week
information to the calendar.3.0.0 (2004-11-07)Corresponds to the version of the zope.i18n package shipped as part of
the Zope X3.0.0 release. |
zope.i18nmessageid | zope.i18nmessageidTo translate any text, we must be able to discover the source domain
of the text. A source domain is an identifier that identifies a
project that produces program source strings. Source strings occur as
literals in python programs, text in templates, and some text in XML
data. The project implies a source language and an application
context.We can think of a source domain as a collection of messages and
associated translation strings.We often need to create unicode strings that will be displayed by
separate views. The view cannot translate the string without knowing
its source domain. A string or unicode literal carries no domain
information, therefore we use messages. Messages are unicode strings
which carry a translation source domain and possibly a default
translation. They are created by a message factory. The message
factory is created by callingMessageFactorywith the source
domain.This package provides facilities fordeclaringsuch messages within
program source text; translation of the messages is the responsiblitiy
of the ‘zope.i18n’ package.Please seehttp://zopei18nmessageid.readthedocs.org/en/latest/for the documentation.Changes6.1.0 (2023-10-05)Add support for Python 3.12.6.0.1 (2023-03-24)Drop dependency onsix.6.0.0 (2023-03-23)Drop support for Python 2.7, 3.5, 3.6.Add preliminary support for Python 3.12a5.5.1.1 (2022-11-17)Add support for building arm64 wheels on macOS.5.1.0 (2022-11-06)Added support for Python 3.9, 3.10 and 3.11.5.0.1 (2020-03-10)Remove deprecated use of setuptools features. Seeissue 22.5.0.0 (2019-11-12)Drop support for Python 3.4.Add support for Python 3.8.4.3.1 (2018-10-19)Fix a regression copying Message objects in the Python
implementation. Seeissue 14.4.3.0 (2018-10-18)Add attributes to support pluralization on a Message and update the
MessageFactory accordingly.4.2.0 (2018-10-05)Fix the possibility of a rare crash in the C extension when
deallocating items. Seeissue 7.Drop support for Python 3.3.Add support for Python 3.7.4.1.0 (2017-05-02)Drop support for Python 2.6 and 3.2.Add support for Python 3.5 and 3.6.Fix the C extension not being used in Python 3. Seeissue 4.Make the Python implementation of Message accept any object for thedefaultargument, just as the C extension does. This should be a
unicode or byte string. Seeissue 5.4.0.3 (2014-03-19)Add support for Python 3.4.Updateboostrap.pyto version 2.2.4.0.2 (2012-12-31)Flesh out PyPI Trove classifiers.4.0.1 (2012-11-21)Add support for Python 3.3.4.0.0 (2012-05-16)Automate generation of Sphinx HTML docs and running doctest snippets via tox.Remove use of ‘2to3’ and associated fixers when installing under Py3k.
The code is now in a “compatible subset” which supports Python 2.6, 2.7,
and 3.2, including PyPy 1.8 (the version compatible with the 2.7 language
spec).Bring unit test coverage to 100%.Move doctest examples into Sphinx documentation.Drop explicit support for Python 2.4 / 2.5 / 3.1.Add explicit support for PyPy.Add ‘setup.py dev’ alias (runssetup.py developplus installsnoseandcoverage).Add ‘setup.py docs’ alias (installsSphinxand dependencies).3.6.1 (2011-07-20)Correct metadata in this file for release date.3.6.0 (2011-07-20)Python 3 support.Suppress compiling C extensions on PyPy or Jython.Add a tox.ini (seehttp://tox.readthedocs.org/en/latest/) for easier
automated testing.3.5.3 (2010-08-10)Make compilation of C extension optional again; 3.5.1 broke this
inasmuch as this package become unusable on non-CPython platforms.
Making the compilation of the C extension optional again implied
removingsetup.pycode added in 3.5.1 which made the C extension
a setuptools “Feature” and readding code from 3.5.0 which overrides
the distutilsbuild_extcommand.Move pickle equality tests into a unittest.TestCase test to make it
easier to condition the tests on whether the C extension has been
compiled. This also makes the tests pass on Jython.3.5.2 (2010-04-30)Remove use of ‘zope.testing.doctestunit’ in favor of stdlib’s ‘doctest.3.5.1 (2010-04-10)LP #257657 / 489529: Fix memory leak in C extension.Fix the compilation of the C extension with python 2.6: refactored it as a
setuptools Feature.3.5.0 (2009-06-27)Make compilation of C extension optional.Add support to bootstrap on Jython.Change package’s mailing list address from zope3-dev at zope.org to
zope-dev at zope.org, because zope3-dev is now retired.Reformat change log to common formatting style.Update package description and docs a little.Remove old .cfg files for zpkg.3.4.3 (2007-09-26)Make PyPI the home URL.3.4.2 (2007-09-25)Move theZopeMessageFactoryfromzope.app.i18nto this package.3.4.0 (2007-07-19)Remove incorrect dependency.Create final release to reflect package status.3.2.0 (2006-01-05)Corresponds to the verison of the zope.i18nmessageid package shipped as
part of the Zope 3.2.0 release.Implement ‘zope.i18nmessageid.message’ as a C extension.Deprecate ‘zope.i18nmessageid.messageid’ APIs (‘MessageID’,
‘MessageIDFactory’) in favor of replacements in ‘zope.i18nmessageid.message’
(‘Message’, ‘MessageFactory’). Deprecated items are scheduled for removal
in Zope 3.3.3.0.0 (2004-11-07)Corresponds to the verison of the zope.i18nmessageid package shipped as
part of the Zope X3.0.0 release. |
zope.index | zope.indexThezope.indexpackage provides several indices for the Zope
catalog. These include:a field index (for indexing orderable values),a keyword index,a topic index,a text index (with support for lexicon, splitter, normalizer, etc.)Changes6.1 (2024-02-02)Add support for Python 3.12.Add preliminary support for Python 3.13 as of 3.13a3.Fix error inOkapiIndex._search_widsfor Python 3.10+, occurring when a
word is contained in more than 10 documents.#486.0 (2023-03-24)Add support for Python 3.11.Add preliminary support for Python 3.12a5.Drop support for Python 2.7, 3.5, 3.6.5.2.1 (2022-09-15)Disable unsafe math optimizations in C code. Seepull request 40.5.2.0 (2022-04-06)Add support for Python 3.10.5.1.0 (2021-07-19)Add support for Python 3.9.Build aarch64 wheels.5.0.0 (2019-11-12)Fixzope.index.text.ricecode.decode_deltas(...,[]). Seeissue 22.Drop support for Python 3.4.Add support for Python 3.8.4.4.0 (2018-10-05)Drop support for Python 3.3.Add support for Python 3.7.SortingIndexMixin.sortnow just
returns instead of raisingStopIterationas required byPEP 479. Seeissue 20.Docs are now hosted athttps://zopeindex.readthedocs.io/Drop support forsetup.py test.Remove some internal test scripts that were never ported to Python 3.Reach and maintain 100% test coverage.4.3.0 (2017-04-24)Noneare now valid values in a field index. This requires BTrees
>= 4.4.1.AllowTypeErrorto propagate from a field index when the value
cannot be stored in a BTree. Previously it was silently ignored
because it was expected that these were usuallyNone.Add support for Python 3.6. Seeissue 8.Make the C implementation of the text index’s score function
(zope.text.index.okascore) importable under Python 3. Previously
we would fall back to a pure-Python implementation. Seeissue 14.Packaging: Distributemanylinuxwheels and Windows wheels.4.2.0 (2016-06-10)Drop support for Python 2.6.Add support for Python 3.5.4.1.0 (2014-12-27)Add support for PyPy. (PyPy3 is pending release of a fix for:https://bitbucket.org/pypy/pypy/issue/1946)Add support for Python 3.4.Add support for testing on Travis.4.0.1 (2013-02-28)Add the forgotten dependency onsix.
Fixeshttps://github.com/zopefoundation/zope.index/issues/1.4.0.0 (2013-02-25)Add support for Python 3.3.Replace deprecatedzope.interface.implementsusage with equivalentzope.interface.implementerdecorator.Drop support for Python 2.4 and 2.5.3.6.4 (2012-03-12)Insure proper unindex behavior if index_doc is called with a empty sequence.Use the standard Python doctest module instead of zope.testing.doctest3.6.3 (2011-12-03)KeywordIndex: Minor optimization; use __nonzero__ instead of __len__
to avoid loading the full TreeSet.3.6.2 (2011-12-03)KeywordIndex: Store docids in TreeSet rather than a Set when the
number of documents matching a word reaches a configurable
threshold (default 64). The rule is applied to individual words at
indexing time, but you can call the new optimize method to optimize
all the words in an index at once. Designed to fix LP #881950.3.6.1 (2010-07-08)TextIndex: reuse the lexicon from the underlying Okapi / Cosine
index, if passed. (LP #232516)Lexicon: avoid raising an exception when indexing None. (LP #598776)3.6.0 (2009-08-03)Improve test readability and reached 100% test coverage.Fix a broken optimization in okascore.c: it was passing a Python
float to the PyInt_AS_LONG() macro. This resulted in wrong scores,
especially on 64 bit platforms, where all scores typically ended up
being zero.Change okascore.c to produce the same results as its Python
equivalent, reducing the brittleness of the text index tests.3.5.2 (2009-06-09)Port okascore.c optimization used in okapiiindex from Zope2 catalog
implementation. This module is compiled conditionally, based on
whether your environment has a working C compiler.Don’t uselen(self._docweight)in okapiindex _search_wids method
(obtaining the length of a BTree is very expensive at scale).
Instead use self.documentCount(). Also a Zope2 port.3.5.1 (2009-02-27)The baseindex, okapiindex, and lexicon used plain counters for various
lengths, which is unsuitable for production applications.
Backport code from Zope2 indexes which opportunistically replaces the
counters with BTree.Length objects.Backport non-insane version of baseindex._del_wordinfo from
Zope2 text index. This improves deletion performance by
several orders of magnitude.Don’t modify given query dictionary in the KeywordIndex.apply method.Move FieldIndex’s sorting functionality to a mixin class so it can
be reused by zc.catalog’s ValueIndex.3.5.0 (2008-12-30)Remove zope.testing from dependencies, as it’s not really needed.Define IIndexSort interface for indexes that support sorting.Implement sorting for FieldIndex (adapted from repoze.catalog/ZCatalog).Add anapplymethod for KeywordIndex/TopicIndex, making them
implement IIndexSearch that can be useful in catalog.Optimize thesearchmethod of KeywordIndex/TopicIndex by using
multiunion for theoroperator and sorting before intersection forand.IMPORTANT: KeywordIndex/TopicIndex now use IFSets instead of IISets.
This makes it more compatible with other indexes (for example, when
using in catalog). This change can lead to problems, if your code somehow
depends on the II nature of sets, as it was before.Also, FilteredSets used to use IFSets as well, if you have any
FilteredSets pickled in the database, you need to migrate them to
IFSets yourself. You can do it like that:filter._ids = filter.family.IF.Set(filter._ids)Wherefilteris an instance of FilteredSet.IMPORTANT: KeywordIndex are now non-normalizing. Because
it can be useful for non-string keywords, where case-normalizing
doesn’t make any sense. Instead, it provides thenormalizemethod that can be overriden by subclasses to provide some
normalization.The CaseInsensitiveKeywordIndex class is now provided that
do case-normalization for string-based keywords. The old
CaseSensitiveKeywordIndex is gone, applications should use
KeywordIndex for that.Looks like the KeywordIndex/TopicIndex was sort of abadonware
and wasn’t used by application developers, so after some
discussion we decided to refactor them to make them more
usable, optimal and compatible with other indexes and catalog.Porting application from old KeywordIndex/TopicIndex to new
ones are rather easy and explained above, so we believe that
it isn’t a problem. Please, [email protected]@zope.orgmailing lists, if you have any problems
with migration.Thanks Chris McDonough of repoze for supporting and useful code.3.4.1 (2007-09-28)Fix bug in package metadata (wrong homepage URL).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.index from
Zope 3.4.0a1 |
zope.interface | zope.interfaceThis package is intended to be independently reusable in any Python
project. It is maintained by theZope Toolkit project.This package provides an implementation of “object interfaces” for Python.
Interfaces are a mechanism for labeling objects as conforming to a given
API or contract. So, this package can be considered as implementation of
theDesign By Contractmethodology support in Python.For detailed documentation, please seehttps://zopeinterface.readthedocs.io/en/latest/Changes6.2 (2024-02-16)Add preliminary support for Python 3.13 as of 3.13a3.Add support to use the pipe (|) syntax fortyping.Union.
(#280)6.1 (2023-10-05)Build Linux binary wheels for Python 3.12.Add support for Python 3.12.Fix building of the docs for non-final versions.6.0 (2023-03-17)Build Linux binary wheels for Python 3.11.Drop support for Python 2.7, 3.5, 3.6.Fix test deprecation warning on Python 3.11.Add preliminary support for Python 3.12 as of 3.12a5.Drop:zope.interface.implementszope.interface.implementsOnlyzope.interface.classProvides5.5.2 (2022-11-17)Add support for building arm64 wheels on macOS.5.5.1 (2022-11-03)Add support for final Python 3.11 release.5.5.0 (2022-10-10)Add support for Python 3.10 and 3.11 (as of 3.11.0rc2).Add missing Trove classifier showing support for Python 3.9.Add some more entries tozope.interface.interfaces.__all__.Disable unsafe math optimizations in C code. Seepull request 262.5.4.0 (2021-04-15)Make the C implementation of the__providedBy__descriptor stop
ignoring all errors raised when accessing the instance’s__provides__. Now it behaves like the Python version and only
catchesAttributeError. The previous behaviour could lead to
crashing the interpreter in cases of recursion and errors. Seeissue 239.Update therepr()andstr()of various objects to be shorter
and more informative. In many cases, therepr()is now something
that can be evaluated to produce an equal object. For example, what
was previously printed as<implementedBy builtins.list>is now
shown asclassImplements(list, IMutableSequence, IIterable). Seeissue 236.MakeDeclaration.__add__(as inimplementedBy(Cls) + ISomething) try harder to preserve a consistent resolution order
when the two arguments share overlapping pieces of the interface
inheritance hierarchy. Previously, the right hand side was always
put at the end of the resolution order, which could easily produce
invalid orders. Seeissue 193.5.3.0 (2020-03-21)No changes from 5.3.0a15.3.0a1 (2021-03-18)Improve the repr ofzope.interface.Providesto remove ambiguity
about what is being provided. This is especially helpful diagnosing
IRO issues.Allow subclasses ofBaseAdapterRegistry(includingAdapterRegistryandVerifyingAdapterRegistry) to have
control over the data structures. This allows persistent
implementations such as those based on ZODB to choose more scalable
options (e.g., BTrees instead of dicts). Seeissue 224.Fix a reference counting issue inBaseAdapterRegistrythat could
lead to references to interfaces being kept around even when all
utilities/adapters/subscribers providing that interface have been
removed. This is mostly an issue for persistent implementations.
Note that this only corrects the issue moving forward, it does not
solve any already corrupted reference counts. Seeissue 227.Add the methodBaseAdapterRegistry.rebuild(). This can be used
to fix the reference counting issue mentioned above, as well as to
update the data structures when custom data types have changed.Add the interface methodIAdapterRegistry.subscribed()and
implementationBaseAdapterRegistry.subscribed()for querying
directly registered subscribers. Seeissue 230.Add the maintenance methodComponents.rebuildUtilityRegistryFromLocalCache(). Most users
will not need this, but it can be useful if theComponents.utilitiesregistry is suspected to be out of sync with theComponentsobject itself (this might happen to persistentComponentsimplementations in the face of bugs).Fix theProvidesandClassProvidesdescriptors to stop
allowing redundant interfaces (those already implemented by the
underlying class or meta class) to produce an inconsistent
resolution order. This is similar to the change in@implementerin 5.1.0, and resolves inconsistent resolution orders withzope.proxyandzope.location. Seeissue 207.5.2.0 (2020-11-05)Add documentation sectionPersistency and Equality(#218).Create arm64 wheels.Add support for Python 3.9.5.1.2 (2020-10-01)Make sure to call each invariant only once when validating invariants.
Previously, invariants could be called multiple times because when an
invariant is defined in an interface, it’s found by in all interfaces
inheriting from that interface. Seepull request 215.5.1.1 (2020-09-30)Fix the method definitions ofIAdapterRegistry.subscribe,subscriptionsandsubscribers. Previously, they all were
defined to accept anamekeyword argument, but subscribers have
no names and the implementation of that interface did not accept
that argument. Seeissue 208.Fix a potential reference leak in the C optimizations. Previously,
applications that dynamically created uniqueSpecificationobjects (e.g., used@implementeron dynamic classes) could
notice a growth of small objects over time leading to increased
garbage collection times. Seeissue 216.Caution!This leak could prevent interfaces used as the bases of
other interfaces from being garbage collected. Those interfaces
will now be collected.One way in which this would manifest was thatweakref.refobjects (and things built upon them, likeWeak[Key|Value]Dictionary) would continue to have access to
the original object even if there were no other visible
references to Python and the original objectshouldhave been
collected. This could be especially problematic for theWeakKeyDictionarywhen combined with dynamic or local
(created in the scope of a function) interfaces, since interfaces
are hashed based just on their name and module name. See the
linked issue for an example of a resultingKeyError.Note that such potential errors are not new, they are just once
again a possibility.5.1.0 (2020-04-08)Make@implementer(*iface)andclassImplements(cls, *iface)ignore redundant interfaces. If the class already implements an
interface through inheritance, it is no longer redeclared
specifically forcls. This solves many instances of inconsistent
resolution orders, while still allowing the interface to be declared
for readability and maintenance purposes. Seeissue 199.Remove all bareexcept:statements. Previously, when accessing
special attributes such as__provides__,__providedBy__,__class__and__conform__, this package wrapped such access
in a bareexcept:statement, meaning that many errors could pass
silently; typically this would result in a fallback path being taken
and sometimes (like withprovidedBy()) the result would be
non-sensical. This is especially true when those attributes are
implemented with descriptors. Now, onlyAttributeErroris
caught. This makes errors more obvious.Obviously, this means that some exceptions will be propagated
differently than before. In particular,RuntimeErrorraised by
Acquisition in the case of circular containment will now be
propagated. Previously, when adapting such a broken object, aTypeErrorwould be the common result, but now it will be a more
informativeRuntimeError.In addition, ZODB errors likePOSKeyErrorcould now be
propagated where previously they would ignored by this package.Seeissue 200.Require that the second argument (bases) toInterfaceClassis
a tuple. This only matters when directly usingInterfaceClassto
create new interfaces dynamically. Previously, an individual
interface was allowed, but did not work correctly. Now it is
consistent withtypeand requires a tuple.Let interfaces define custom__adapt__methods. This implements
the other side of thePEP 246adaptation protocol: objects being
adapted could already implement__conform__if they know about
the interface, and now interfaces can implement__adapt__if
they know about particular objects. There is no performance penalty
for interfaces that do not supply custom__adapt__methods.This includes the ability to add new methods, or override existing
interface methods using the [email protected] 3.Make the internal singleton object returned by APIs likeimplementedByanddirectlyProvidedByfor objects that
implement or provide no interfaces more immutable. Previously an
internal cache could be mutated. Seeissue 204.5.0.2 (2020-03-30)Ensure that objects that implement no interfaces (such as direct
subclasses ofobject) still includeInterfaceitself in
their__iro___and__sro___. This fixes adapter registry
lookups for such objects when the adapter is registered forInterface. Seeissue 197.5.0.1 (2020-03-21)Ensure the resolution order forInterfaceClassis consistent.
Seeissue 192.Ensure the resolution order forcollections.OrderedDictis
consistent on CPython 2. (It was already consistent on Python 3 and PyPy).Fix the handling of theZOPE_INTERFACE_STRICT_IROenvironment
variable. Previously,ZOPE_INTERFACE_STRICT_ROwas read, in
contrast with the documentation. Seeissue 194.5.0.0 (2020-03-19)Make an internal singleton object returned by APIs likeimplementedByanddirectlyProvidedByimmutable. Previously,
it was fully mutable and allowed changing its__bases___. That
could potentially lead to wrong results in pathological corner
cases. Seeissue 158.Support thePURE_PYTHONenvironment variable at runtime instead
of just at wheel build time. A value of 0 forces the C extensions to
be used (even on PyPy) failing if they aren’t present. Any other
value forces the Python implementation to be used, ignoring the C
extensions. SeePR 151.Cache the result of__hash__method inInterfaceClassas a
speed optimization. The method is called very often (i.e several
hundred thousand times during Plone 5.2 startup). Because the hash value never
changes it can be cached. This improves test performance from 0.614s
down to 0.575s (1.07x faster). In a real world Plone case a reindex
index came down from 402s to 320s (1.26x faster). SeePR 156.Change the C classesSpecificationBaseand its subclassClassProvidesBaseto store implementation attributes in their structures
instead of their instance dictionaries. This eliminates the use of
an undocumented private C API function, and helps make some
instances require less memory. SeePR 154.Reduce memory usage in other ways based on observations of usage
patterns in Zope (3) and Plone code bases.Specifications with no dependents are common (more than 50%) so
avoid allocating aWeakKeyDictionaryunless we need it.Likewise, tagged values are relatively rare, so don’t allocate a
dictionary to hold them until they are used.Use__slots___or the C equivalenttp_membersin more
common places. Note that this removes the ability to set arbitrary
instance variables on certain objects.
SeePR 155.The changes in this release resulted in a 7% memory reduction after
loading about 6,000 modules that define about 2,200 interfaces.Caution!Details of many private attributes have changed, and external use
of those private attributes may break. In particular, the
lifetime and default value of_v_attrshas changed.Remove support for hashing uninitialized interfaces. This could only
be done by subclassingInterfaceClass. This has generated a
warning since it was first added in 2011 (3.6.5). Please call theInterfaceClassconstructor or otherwise set the appropriate
fields in your subclass before attempting to hash or sort it. Seeissue 157.Remove unneeded override of the__hash__method fromzope.interface.declarations.Implements. Watching a reindex index
process in ZCatalog with on a Py-Spy after 10k samples the time for.adapter._lookupwas reduced from 27.5s to 18.8s (~1.5x faster).
Overall reindex index time shrunk from 369s to 293s (1.26x faster).
SeePR 161.Make the Python implementation closer to the C implementation by
ignoring all exceptions, not justAttributeError, during (parts
of) interface adaptation. Seeissue 163.Micro-optimization in.adapter._lookup,.adapter._lookupAlland.adapter._subscriptions: By loadingcomponents.getinto
a local variable before entering the loop a bytcode “LOAD_FAST 0
(components)” in the loop can be eliminated. In Plone, while running
all tests, average speedup of the “owntime” of_lookupis ~5x.
SeePR 167.Add__all__declarations to all modules. This helps tools that
do auto-completion and documentation and results in less cluttered
results. Wildcard (“*”) are not recommended and may be affected. Seeissue 153.FixverifyClassandverifyObjectfor builtin types likedictthat have methods taking an optional, unnamed argument with
no default value likedict.pop. On PyPy3, the verification is
strict, but on PyPy2 (as on all versions of CPython) those methods
cannot be verified and are ignored. Seeissue 118.Update the common interfacesIEnumerableMapping,IExtendedReadMapping,IExtendedWriteMapping,IReadSequenceandIUniqueMemberWriteSequenceto no longer
require methods that were removed from Python 3 on Python 3, such as__setslice___. Now,dict,listandtupleproperly
verify asIFullMapping,ISequenceandIReadSequence,respectively on all versions of Python.Add human-readable__str___and__repr___toAttributeandMethod. These contain the name of the defining interface
and the attribute. For methods, it also includes the signature.Change the error strings raised byverifyObjectandverifyClass. They now include more human-readable information
and exclude extraneous lines and spaces. Seeissue 170.Caution!This will break consumers (such as doctests) that
depended on the exact error messages.MakeverifyObjectandverifyClassreport all errors, if the
candidate object has multiple detectable violations. Previously they
reported only the first error. Seeissue.Like the above, this will break consumers depending on the exact
output of error messages if more than one error is present.Addzope.interface.common.collections,zope.interface.common.numbers, andzope.interface.common.io.
These modules define interfaces based on the ABCs defined in the
standard librarycollections.abc,numbersandiomodules, respectively. Importing these modules will make the
standard library concrete classes that are registered with those
ABCs declare the appropriate interface. Seeissue 138.Addzope.interface.common.builtins. This module defines
interfaces of common builtin types, such asITextStringandIByteString,IDict, etc. These interfaces extend the
appropriate interfaces fromcollectionsandnumbers, and the
standard library classes implement them after importing this module.
This is intended as a replacement for third-party packages likedolmen.builtins.
Seeissue 138.MakeprovidedBy()andimplementedBy()respectsuperobjects. For instance, if classDerivedimplementsIDerivedand extendsBasewhich in turn implementsIBase, thenprovidedBy(super(Derived, derived))will return[IBase].
Previously it would have returned[IDerived](in general, it
would previously have returned whatever would have been returned
withoutsuper).Along with this change, adapter registries will unpacksuperobjects into their__self___before passing it to the factory.
Together, this means thatcomponent.getAdapter(super(Derived, self), ITarget)is now meaningful.Seeissue 11.Fix a potential interpreter crash in the low-level adapter
registry lookup functions. See issue 11.Adopt Python’s standardC3 resolution orderto compute the__iro__and__sro__of interfaces, with tweaks to support
additional cases that are common in interfaces but disallowed for
Python classes. Previously, an ad-hoc ordering that made no
particular guarantees was used.This has many beneficial properties, including the fact that base
interface and base classes tend to appear near the end of the
resolution order instead of the beginning. The resolution order in
general should be more predictable and consistent.Caution!In some cases, especially with complex interface inheritance
trees or when manually providing or implementing interfaces, the
resulting IRO may be quite different. This may affect adapter
lookup.The C3 order enforces some constraints in order to be able to
guarantee a sensible ordering. Older versions of zope.interface did
not impose similar constraints, so it was possible to create
interfaces and declarations that are inconsistent with the C3
constraints. In that event, zope.interface will still produce a
resolution order equal to the old order, but it won’t be guaranteed
to be fully C3 compliant. In the future, strict enforcement of C3
order may be the default.A set of environment variables and module constants allows
controlling several aspects of this new behaviour. It is possible to
request warnings about inconsistent resolution orders encountered,
and even to forbid them. Differences between the C3 resolution order
and the previous order can be logged, and, in extreme cases, the
previous order can still be used (this ability will be removed in
the future). For details, see the documentation forzope.interface.ro.Make inherited tagged values in interfaces respect the resolution
order (__iro__), as method and attribute lookup does. Previously
tagged values could give inconsistent results. Seeissue 190.AddgetDirectTaggedValue(and related methods) to interfaces to
allow accessing tagged values irrespective of inheritance. Seeissue 190.Ensure thatInterfaceis always the last item in the__iro__and__sro__. This is usually the case, but if classes that do
not implement any interfaces are part of a class inheritance
hierarchy,Interfacecould be assigned too high a priority.
Seeissue 8.Implement sorting, equality, and hashing in C forInterfaceobjects. In micro benchmarks, this makes those operations 40% to 80%
faster. This translates to a 20% speed up in querying adapters.Note that this changes certain implementation details. In
particular,InterfaceClassnow has a non-default metaclass, and
it is enforced that__module__in instances ofInterfaceClassis read-only.SeePR 183.4.7.2 (2020-03-10)Remove deprecated use of setuptools features. Seeissue 30.4.7.1 (2019-11-11)Use Python 3 syntax in the documentation. Seeissue 119.4.7.0 (2019-11-11)Drop support for Python 3.4.ChangequeryTaggedValue,getTaggedValue,getTaggedValueTagsin interfaces. They now include inherited
values by following__bases__. SeePR 144.Caution!This may be a breaking change.Add support for Python 3.8.4.6.0 (2018-10-23)Add support for Python 3.7FixverifyObjectfor class objects with staticmethods on
Python 3. Seeissue 126.4.5.0 (2018-04-19)Drop support for 3.3, avoid accidental dependence breakage via setup.py.
SeePR 110.Allow registering and unregistering instance methods as listeners.
Seeissue 12andPR 102.Synchronize and simplify zope/__init__.py. Seeissue 1144.4.3 (2017-09-22)Avoid exceptions when the__annotations__attribute is added to
interface definitions with Python 3.x type hints. Seeissue 98.Fix the possibility of a rare crash in the C extension when
deallocating items. Seeissue 100.4.4.2 (2017-06-14)Fix a regression storingzope.component.persistentregistry.PersistentRegistryinstances.
Seeissue 85.Fix a regression that could lead to the utility registration cache
ofComponentsgetting out of sync. Seeissue 93.4.4.1 (2017-05-13)Simplify the caching of utility-registration data. In addition to
simplification, avoids spurious test failures when checking for
leaks in tests with persistent registries. Seepull 84.RaiseValueErrorwhen non-text names are passed to adapter registry
methods: prevents corruption of lookup caches.4.4.0 (2017-04-21)Avoid a warning from the C compiler.
(https://github.com/zopefoundation/zope.interface/issues/71)Add support for Python 3.6.4.3.3 (2016-12-13)Correct typos and ReST formatting errors in documentation.Add API documentation for the adapter registry.Ensure that theLICENSE.txtfile is included in built wheels.Fix C optimizations broken on Py3k. See the Python bug at:http://bugs.python.org/issue15657(https://github.com/zopefoundation/zope.interface/issues/60)4.3.2 (2016-09-05)Fix equality testing ofimplementedByobjects and proxies.
(https://github.com/zopefoundation/zope.interface/issues/55)4.3.1 (2016-08-31)Support Components subclasses that are not hashable.
(https://github.com/zopefoundation/zope.interface/issues/53)4.3.0 (2016-08-31)Add the ability to sort the objects returned byimplementedBy.
This is compatible with the way interface classes sort so they can
be used together in ordered containers like BTrees.
(https://github.com/zopefoundation/zope.interface/issues/42)Makesetuptoolsa hard dependency ofsetup.py.
(https://github.com/zopefoundation/zope.interface/issues/13)Change a linear algorithm (O(n)) inComponents.registerUtilityandComponents.unregisterUtilityinto a dictionary lookup (O(1)) for
hashable components. This substantially improves the time taken to
manipulate utilities in large registries at the cost of some
additional memory usage. (https://github.com/zopefoundation/zope.interface/issues/46)4.2.0 (2016-06-10)Add support for Python 3.5Drop support for Python 2.6 and 3.2.4.1.3 (2015-10-05)Fix installation without a C compiler on Python 3.5
(https://github.com/zopefoundation/zope.interface/issues/24).4.1.2 (2014-12-27)Add support for PyPy3.Remove unittest assertions deprecated in Python3.x.Addzope.interface.document.asReStructuredText, which formats the
generated text for an interface using ReST double-backtick markers.4.1.1 (2014-03-19)Add support for Python 3.4.4.1.0 (2014-02-05)Updateboostrap.pyto version 2.2.Add@named(name)declaration, that specifies the component name, so it
does not have to be passed in during registration.4.0.5 (2013-02-28)Fix a bug where a decorated method caused false positive failures onverifyClass().4.0.4 (2013-02-21)Fix a bug that was revealed by porting zope.traversing. During a loop, the
loop body modified a weakref dict causing aRuntimeErrorerror.4.0.3 (2012-12-31)Fleshed out PyPI Trove classifiers.4.0.2 (2012-11-21)Add support for Python 3.3.Restored ability to install the package in the absence ofsetuptools.LP #1055223: Fix test which depended on dictionary order and failed randomly
in Python 3.3.4.0.1 (2012-05-22)Drop explicitDeprecationWarningsfor “class advice” APIS (these
APIs are still deprecated under Python 2.x, and still raise an exception
under Python 3.x, but no longer cause a warning to be emitted under
Python 2.x).4.0.0 (2012-05-16)Automated build of Sphinx HTML docs and running doctest snippets via tox.Deprecate the “class advice” APIs fromzope.interface.declarations:implements,implementsOnly, andclassProvides. In their place,
prefer the equivalent class decorators:@implementer,@implementer_only, and@provider. Code which uses the deprecated
APIs will not work as expected under Py3k.Remove use of ‘2to3’ and associated fixers when installing under Py3k.
The code is now in a “compatible subset” which supports Python 2.6, 2.7,
and 3.2, including PyPy 1.8 (the version compatible with the 2.7 language
spec).Drop explicit support for Python 2.4 / 2.5 / 3.1.Add support for PyPy.Add support for continuous integration usingtoxandjenkins.Add ‘setup.py dev’ alias (runssetup.py developplus installsnoseandcoverage).Add ‘setup.py docs’ alias (installsSphinxand dependencies).Replace all unittest coverage previously accomplished via doctests with
unittests. The doctests have been moved into adocssection, managed
as a Sphinx collection.LP #910987: Ensure that the semantics of thelookupmethod ofzope.interface.adapter.LookupBaseare the same in both the C and
Python implementations.LP #900906: Avoid exceptions due to tne new__qualname__attribute
added in Python 3.3 (see PEP 3155 for rationale). Thanks to Antoine
Pitrou for the patch.3.8.0 (2011-09-22)New modulezope.interface.registry. This is code moved fromzope.component.registrywhich implements a basic nonperistent component
registry aszope.interface.registry.Components. This class was moved
fromzope.componentto make porting systems (such as Pyramid) that rely
only on a basic component registry to Python 3 possible without needing to
port the entirety of thezope.componentpackage. Backwards
compatibility import shims have been left behind inzope.component, so
this change will not break any existing code.Newtests_requiredependency:zope.eventto test events sent by
Components implementation. Thezope.interfacepackage does not have a
hard dependency onzope.event, but ifzope.eventis importable, it
will send component registration events when methods of an instance ofzope.interface.registry.Componentsare called.New interfaces added to supportzope.interface.registry.Componentsaddition:ComponentLookupError,Invalid,IObjectEvent,ObjectEvent,IComponentLookup,IRegistration,IUtilityRegistration,IAdapterRegistration,ISubscriptionAdapterRegistration,IHandlerRegistration,IRegistrationEvent,RegistrationEvent,IRegistered,Registered,IUnregistered,Unregistered,IComponentRegistry, andIComponents.No longer Python 2.4 compatible (tested under 2.5, 2.6, 2.7, and 3.2).3.7.0 (2011-08-13)Move changes from 3.6.2 - 3.6.5 to a new 3.7.x release line.3.6.7 (2011-08-20)Fix sporadic failures on x86-64 platforms in tests of rich comparisons
of interfaces.3.6.6 (2011-08-13)LP #570942: Now correctly compare interfaces from different modules but
with the same names.N.B.: This is a less intrusive / destabilizing fix than the one applied in
3.6.3: we only fix the underlying cmp-alike function, rather than adding
the other “rich comparison” functions.Revert to software as released with 3.6.1 for “stable” 3.6 release branch.3.6.5 (2011-08-11)LP #811792: work around buggy behavior in some subclasses ofzope.interface.interface.InterfaceClass, which invoke__hash__before initializing__module__and__name__. The workaround
returns a fixed constant hash in such cases, and issues aUserWarning.LP #804832: Under PyPy,zope.interfaceshould not build its C
extension. Also, prevent attempting to build it under Jython.Add a tox.ini for easier xplatform testing.Fix testing deprecation warnings issued when tested under Py3K.3.6.4 (2011-07-04)LP 804951: InterfaceClass instances were unhashable under Python 3.x.3.6.3 (2011-05-26)LP #570942: Now correctly compare interfaces from different modules but
with the same names.3.6.2 (2011-05-17)Moved detailed documentation out-of-line from PyPI page, linking instead tohttp://docs.zope.org/zope.interface.Fixes for small issues when running tests under Python 3.2 usingzope.testrunner.LP # 675064: Specify return value type for C optimizations module init
under Python 3: undeclared value caused warnings, and segfaults on some
64 bit architectures.setup.py now raises RuntimeError if you don’t have Distutils installed when
running under Python 3.3.6.1 (2010-05-03)A non-ASCII character in the changelog made 3.6.0 uninstallable on
Python 3 systems with another default encoding than UTF-8.Fix compiler warnings under GCC 4.3.3.3.6.0 (2010-04-29)LP #185974: Clear the cache used bySpecificaton.getinsideSpecification.changed. Thanks to Jacob Holm for the patch.Add support for Python 3.1. Contributors:Lennart Regebro
Martin v Loewis
Thomas Lotze
Wolfgang SchnerringThe 3.1 support is completely backwards compatible. However, the implements
syntax used under Python 2.X does not work under 3.X, since it depends on
how metaclasses are implemented and this has changed. Instead it now supports
a decorator syntax (also under Python 2.X):class Foo:
implements(IFoo)
...can now also be written:@implementer(IFoo):
class Foo:
...There are 2to3 fixers available to do this change automatically in the
zope.fixers package.Python 2.3 is no longer supported.3.5.4 (2009-12-23)Use the standard Python doctest module instead of zope.testing.doctest, which
has been deprecated.3.5.3 (2009-12-08)Fix an edge case: make providedBy() work when a class has ‘__provides__’ in
its __slots__ (seehttp://thread.gmane.org/gmane.comp.web.zope.devel/22490)3.5.2 (2009-07-01)BaseAdapterRegistry.unregister, unsubscribe: Remove empty portions of
the data structures when something is removed. This avoids leaving
references to global objects (interfaces) that may be slated for
removal from the calling application.3.5.1 (2009-03-18)verifyObject: use getattr instead of hasattr to test for object attributes
in order to let exceptions other than AttributeError raised by properties
propagate to the callerAdd Sphinx-based documentation building to the package buildout
configuration. Use thebin/docscommand after buildout.Improve package description a bit. Unify changelog entries formatting.Change package’s mailing list address to zope-dev at zope.org as
zope3-dev at zope.org is now retired.3.5.0 (2008-10-26)Fix declaration of _zope_interface_coptimizations, it’s not a top level
package.Add a DocTestSuite for odd.py module, so their tests are run.Allow to bootstrap on Jython.Fixhttps://bugs.launchpad.net/zope3/3.3/+bug/98388: ISpecification
was missing a declaration for __iro__.Add optional code optimizations support, which allows the building
of C code optimizations to fail (Jython).Replace_flattenwith a non-recursive implementation, effectively making
it 3x faster.3.4.1 (2007-10-02)Fix a setup bug that prevented installation from source on systems
without setuptools.3.4.0 (2007-07-19)Final release for 3.4.0.3.4.0b3 (2007-05-22)When checking whether an object is already registered, use identity
comparison, to allow adding registering with picky custom comparison methods.3.3.0.1 (2007-01-03)Made a reference to OverflowWarning, which disappeared in Python
2.5, conditional.3.3.0 (2007/01/03)New FeaturesRefactor the adapter-lookup algorithim to make it much simpler and faster.Also, implement more of the adapter-lookup logic in C, making
debugging of application code easier, since there is less
infrastructre code to step through.Treat objects without interface declarations as if they
declared that they providezope.interface.Interface.Add a number of richer new adapter-registration interfaces
that provide greater control and introspection.Add a new interface decorator to zope.interface that allows the
setting of tagged values on an interface at definition time (see
zope.interface.taggedValue).Bug FixesA bug in multi-adapter lookup sometimes caused incorrect adapters to
be returned.3.2.0.2 (2006-04-15)Fix packaging bug: ‘package_dir’ must be arelativepath.3.2.0.1 (2006-04-14)Packaging change: suppress inclusion of ‘setup.cfg’ in ‘sdist’ builds.3.2.0 (2006-01-05)Corresponds to the version of the zope.interface package shipped as part of
the Zope 3.2.0 release.3.1.0 (2005-10-03)Corresponds to the version of the zope.interface package shipped as part of
the Zope 3.1.0 release.Made attribute resolution order consistent with component lookup order,
i.e. new-style class MRO semantics.Deprecate ‘isImplementedBy’ and ‘isImplementedByInstancesOf’ APIs in
favor of ‘implementedBy’ and ‘providedBy’.3.0.1 (2005-07-27)Corresponds to the version of the zope.interface package shipped as part of
the Zope X3.0.1 release.Fix a bug reported by James Knight, which caused adapter registries
to fail occasionally to reflect declaration changes.3.0.0 (2004-11-07)Corresponds to the version of the zope.interface package shipped as part of
the Zope X3.0.0 release. |
zope.intid | zope.intidThis package provides an API to create integer ids for any object. Later
objects can be looked up by their id as well. This functionality is commonly
used in situations where dealing with objects is undesirable, such as in
search indices or any code that needs an easy hash of an object.Documentation is hosted athttp://zopeintid.readthedocs.ioChanges5.0 (2023-02-21)Add support for Python 3.9, 3.10, 3.11.Drop support for Python 2.7, 3.5, 3.6.Drop support for deprecatedpython setup.py test.4.4.0 (2021-03-19)Fixed deprecation warning forzope.site.hooksin tests.Add support for Python 3.7 and 3.8.Drop support for Python 3.4.Fix incorrect import ofzope.interface.interfaces.IComponentLookupin tests.4.3.0 (2017-07-26)Add support for Python 3.6.Drop support for Python 3.3.4.2.0 (2016-12-08)Raise more informative KeyError subclasses from the utility when intids
or objects cannot be found. This distinguishes them from errors
raised by normal dictionaries or BTrees, and is useful in unit
testing or when persisting intids or sharing them among processes
for later or concurrent use.PropagatePOSKeyErrorfromqueryIdinstead of returning the
default object. This exception indicates a corrupt database, not a
missing object. ThequeryObjectfunction already behaved this way.Stop depending on ZODB for anything except testing.Add support for Python 3.5 and PyPy3 5.2.Drop support for Python 2.6.4.1.0 (2014-12-27)Add support for PyPy (PyPy3 blocked on PyPy3-compatiblezodbpickle).Add support for Python 3.4.4.0.0 (2014-12-20)Add support for testing on Travis.4.0.0a1 (2013-02-22)Add support for Python 3.3.Replace deprecatedzope.interface.implementsusage with equivalentzope.interface.implementerdecorator.Drop support for Python 2.4 and 2.5.Bug fix: ensure that the IntId utility never generates ids greater
than the maxint of the BTree family being used.3.7.2 (2009-12-27)Use the zope.component API in favor of ztapi.Removezope.app.testingdependency.3.7.1 (2009-05-18)Remove dependencies onzope.container. Instead importObject*Eventclasses fromzope.lifecycleeventand importIContainedfromzope.location. In order to be able to do
this, depend onzope.lifecycleevent>=3.5.2 andzope.location>=3.5.4.Remove a dependency onzope.container.contained.Contained(this is a dumb base class that defines __parent__ and __name__
as None and declares that the class implements IContained).3.7.0 (2009-02-01)Split out this package fromzope.app.intid. The latter one
now only contains browser views and compatibility imports while
whole IntId functionality is moved here. |
zope.introspector | No description available on PyPI. |
zope.introspectorui | zope.introspectoruiWhat is zope.introspectorui?zope.introspectoruiis a set of views for the information objects provided
by zope.introspector.Installing zope.introspectoruizope.introspectoruiis provided as an Python egg on cheeseshop and set
up viazc.buildoutYou may have setuptools already installed for your system Python. In
that case, you may need to upgrade it first because buildout requires
a very recent version:$ sudo easy_install -U setuptoolsIf this command fails because easy_install is not available, there is
a good chance you do not have setuptools available for your system
Python. If so, there is no problem because setuptools will be
installed locally by buildout.Becausezope.introspectoruiis a developer tool, you normally use it
by including the package thesetup.pyfile of your own
package. There will most probably a section calledinstall_requireswhere you add ‘zope.introspector’ like this:...
install_requires=['setuptools',
# Add extra requirements here
'zope.introspectorui',
...
],Inzc.buildoutbased package setups you can ‘activate’ usage ofzope.introspectoruiafterwards simply by (re)runningbin/buildout.CHANGES0.2 (2009-01-29)Add explicit dependency to zope.location and clean up ZCML activation.0.1 (2008-10-24)Initial Release |
zope.keyreference | zope.keyreferenceObject references that support stable comparison and hashes.Documentation can be found athttps://zopekeyreference.readthedocs.ioChanges6.0 (2023-04-25)Drop support for Python 2.7, 3.5, 3.6.Add support for Python 3.11.Make the tests compatible withzope.testing >= 5.5.0.0 (2022-03-25)Remove__cmp__methods. Since the implementation of the rich
comparison methods (__eq__, etc) in 4.0a1, the interpreter won’t
call__cmp__, even on Python 2. Seeissue 10.Add support for Python 3.8, 3.9, and 3.10.Drop support for Python 3.4.4.2.0 (2018-10-26)Add support for Python 3.5, 3.6, and 3.7.Drop support for Python 2.6 and 3.3.4.1.0 (2014-12-27)Add support for PyPy (PyPy3 blocked on PyPy3-compatiblezodbpickle).Add support for Python 3.4.4.0.0 (2014-12-20)Add support for testing on Travis.4.0.0a2 (2013-02-25)Ensure that theSimpleKeyReferenceimplementation (used for testing)
also implements rich comparison properly.4.0.0a1 (2013-02-22)Add support for Python 3.3.Replace deprecatedzope.component.adaptsusage with equivalentzope.component.adapterdecorator.Replace deprecatedzope.interface.implementsusage with equivalentzope.interface.implementerdecorator.Drop support for Python 2.4 and 2.5.3.6.4 (2011-11-30)Fix tests broken by removal ofzope.testingfrom test dependencies:
avoid theZODB3module that needs it.3.6.3 (2011-11-29)Prefer the standard libraries doctest module to the one fromzope.testing.3.6.2 (2009-09-15)Make the tests pass with ZODB3.9, which changed the repr() of the persistent
classes.3.6.1 (2009-02-01)Load keyreferences, pickled by old zope.app.keyreference even
if its not installed anymore (so don’t break if one updates a
project that don’t directly depends on zope.app.keyreference).3.6.0 (2009-01-31)Renamezope.app.keyreferencetozope.keyreference. |
zope.kgs | ===============================Zope 3 Controlled Package Index===============================This package has been developed to support the maintenance of a stable set ofZope project distributions. It manages the controlled packages configurationfile and supports the generation of buildout configuration files that can beused by developers.Another use of this package is to use it for testing new distributions againstthe index. Here is the workflow for testing a new package against stable set:1. Install the correct version of this package.(a) Download the version of this package that manages the stable set thatyou are interested in. Currently only the trunk exists, which managesthe Zope 3.4 release::$ svn co svn://svn.zope.org/repos/main/zope.release/trunk zope3.4$ cd zope3.4(b) Bootstrap the checkout::$ python ./bootstrap.py(c) Run buildout to create the scripts::$ ./bin/buildout(d) Run the ``buildout.cfg`` generation script to build a configurationfile that can be used for testing:$ ./bin/generate-buildout2. From the generated configuration file, you can now build a testingenvironment.(a) Enter the test directory and create a buildout:$ cd test$ python ../bootstrap.py$ ./bin/buildout(b) Run all the tests to verify that all tests are initially passing:$ ./bin/test -vpc13. Modify the ``buildout.cfg`` to look for your the new distribution to betested:(a) Comment out the "index" option. This needs to be done, so that the newpackage is going to be picked up.(b) Change the version number of the package of interest in the "versions"section.Alternative:(a) Check out the new distribution from SVN.(b) Add a "develop path/to/my/package" line in the "buildout" section of``buildout.cfg``.4. Run the tests, making sure that they all pass.5. Modify ``controlled-packages.cfg`` by adding the new version of the packageto the package's version list.6. Generate all files again and upload them:$ cd ..$ ./bin/generate-buildout$ ./bin/generate-versions$ ./bin/uploadOnce the files are uploaded, a crontab-job, running every minute, willdetect the changes in ``controlled-pages.cfg`` and will generate the newcontrolled package pages.Note: I think the process is still a tiny bit too long. I probably write ascript that makes testing a new version of a package easier, but let's seewhether this process is workable first.===============Known Good Sets===============This package provides a set of scripts and tools to manage Good-Known-Sets, orshort KGSs. A KGS is a set of package distributions that are known to workwell together. You can verify this, for example, by running all the tests ofall the packages at once.Let me show you how a typical controlled packages configuration file lookslike:>>> import tempfile>>> cfgFile = tempfile.mktemp('-cp.cfg')>>> open(cfgFile, 'w').write('''\... [DEFAULT]... tested = true...... [KGS]... name = zope-dev... version = 1.2.0... date = 2009-01-01... changelog = CHANGES.txt... announcement = ANNOUNCEMENT.txt... files =... zope-dev-1.2.0.tgz... zope-dev-1.2.0.zip... zope-dev-1.2.0.exe...... [packageA]... versions = 1.0.0... 1.0.1...... [packageB]... versions = 1.2.3... test-extras = test...... [packageC]... # Do not test this package.... tested = false... versions = 4.3.1... ''')As you can see, this file uses an INI-style format. The "DEFAULT" section isspecial, as it will insert the specified options into all other sections asdefault. The "KGS" section specifies some global information about the KGS,such as the name of the KGS. Since this section references several externalfiles, we should quickly create those.>>> import os>>> dir = os.path.dirname(cfgFile)>>> open(os.path.join(dir, 'CHANGES.txt'), 'w').write('''\... =======... Changes... =======...... packageA... ========...... Version 1.0.0... -------------...... * Initial Release... ''')>>> open(os.path.join(dir, 'ANNOUNCEMENT.txt'), 'w').write('''\... =======================... zope-dev 1.2.0 Released... =======================...... The announcement text!... ''')>>> open(os.path.join(dir, 'zope-dev-1.2.0.tgz'), 'w').write('tgz')>>> open(os.path.join(dir, 'zope-dev-1.2.0.exe'), 'w').write('exe')All other sections refer to package names. Currently each package sectionsupports two options. The "versions" option lists all versions that are knownto work in the KGS. Those versions should *always* only be bug fixes to thefirst listed version. The second option, "tested", specifies whether thepackage should be part of the KGS test suite. By default, we want all packagesto be tested, but some packages require very specific test setups that cannotbe easily reproduced _[1], so we turn off those tests.You can also stack controlled package configurations on top of eachother. Base configurations can be specified using the `extends` option:>>> import tempfile>>> cfgFile2 = tempfile.mktemp('-cp.cfg')>>> open(cfgFile2, 'w').write('''\... [DEFAULT]... tested = true...... [KGS]... name = grok-dev... version = 0.1.0... extends = %s...... [packageA]... versions = 1.0.2...... [packageD]... versions = 2.2.3... 2.2.4... ''' %cfgFile)As you can see, you can completely override another package's versionspecification as well.Generating the configuration file and managing it is actually the hardpart. Let's now see what we can do with it... [1]: This is usually due to bugs in setuptools or buildout, such as PYCfiles not containing the correct reference to their PY file.Generate Versions-----------------One of the easiest scripts, is the version generation. This script willgenerate a "versions" section that is compatible with buildout.>>> versionsFile = tempfile.mktemp('-versions.cfg')>>> from zope.kgs import version>>> version.main((cfgFile, versionsFile))>>> print open(versionsFile, 'r').read()[versions]packageA = 1.0.1packageB = 1.2.3packageC = 4.3.1Let's now ensure that the versions also work for the extended configuration:>>> versionsFile2 = tempfile.mktemp('-versions.cfg')>>> version.main((cfgFile2, versionsFile2))>>> print open(versionsFile2, 'r').read()[versions]packageA = 1.0.2packageB = 1.2.3packageC = 4.3.1packageD = 2.2.4Generate Buildout-----------------In order to be able to test the KGS, you can also generate a full buildoutfile that will create and install a testrunner over all packages for you:>>> buildoutFile = tempfile.mktemp('-buildout.cfg')>>> from zope.kgs import buildout>>> buildout.main((cfgFile, buildoutFile))>>> print open(buildoutFile, 'r').read()[buildout]parts = testversions = versions<BLANKLINE>[test]recipe = zc.recipe.testrunnereggs = packageApackageB [test]<BLANKLINE>[versions]packageA = 1.0.1packageB = 1.2.3packageC = 4.3.1<BLANKLINE>Let's make sure that the buildout generation also honors the extensions:>>> buildoutFile2 = tempfile.mktemp('-buildout.cfg')>>> buildout.main((cfgFile2, buildoutFile2))>>> print open(buildoutFile2, 'r').read()[buildout]parts = testversions = versions<BLANKLINE>[test]recipe = zc.recipe.testrunnereggs = packageApackageB [test]packageD<BLANKLINE>[versions]packageA = 1.0.2packageB = 1.2.3packageC = 4.3.1packageD = 2.2.4<BLANKLINE>Flat Links Pages----------------We can also create a flat links page that can be used in the`dependency_links` argument in your `setup.py` file. Since this moduleaccesses the original PyPI to ask for the download locations and filenames, wehave to create a controlled packages configuration file that contains realpackages with real version numbers:>>> cfgFileReal = tempfile.mktemp('-cp.cfg')>>> open(cfgFileReal, 'w').write('''\... [DEFAULT]... tested = true...... [KGS]... name = zope-dev... version = 3.4.0b2...... [PIL]... versions = 1.1.6...... [zope.component]... versions = 3.4.0...... [zope.interface]... versions = 3.4.0... 3.4.1...... [z3c.formdemo]... versions = 1.1.0... ''')Let's now create the links page:>>> linksFile = tempfile.mktemp('-links.html')>>> from zope.kgs import link>>> link.main((cfgFileReal, linksFile))>>> print open(linksFile, 'r').read()<html><head><title>Links for the "zope-dev" KGS (version 3.4.0b2)</title></head><body><h1>Links for the "zope-dev" KGS (version 3.4.0b2)</h1><a href="http://pypi.python.org/packages/2.4/z/z3c.formdemo/z3c.formdemo-1.1.0-py2.4.egg#md5=9d605bd559ea33ac57ce11f5c80fa3d3">z3c.formdemo-1.1.0-py2.4.egg</a><br/><a href="http://pypi.python.org/packages/source/z/z3c.formdemo/z3c.formdemo-1.1.0.tar.gz#md5=f224a49cea737112284f74b859e3eed0">z3c.formdemo-1.1.0.tar.gz</a><br/><a href="http://pypi.python.org/packages/2.4/z/zope.component/zope.component-3.4.0-py2.4.egg#md5=c0763e94912e4a8ac1e321a068c916ba">zope.component-3.4.0-py2.4.egg</a><br/><a href="http://pypi.python.org/packages/source/z/zope.component/zope.component-3.4.0.tar.gz#md5=94afb57dfe605d7235ff562d1eaa3bed">zope.component-3.4.0.tar.gz</a><br/><a href="http://pypi.python.org/packages/source/z/zope.interface/zope.interface-3.4.0.tar.gz#md5=0be9fd80b7bb6bee520e56eba7d29c90">zope.interface-3.4.0.tar.gz</a><br/><a href="http://pypi.python.org/packages/2.4/z/zope.interface/zope.interface-3.4.0-py2.4-win32.egg#md5=3fa5e992271375eac597622d8e2fd5ec">zope.interface-3.4.0-py2.4-win32.egg</a><br/><a href="http://pypi.python.org/packages/source/z/zope.interface/zope.interface-3.4.1.tar.gz#md5=b085f4a774adab688e037ad32fbbf08e">zope.interface-3.4.1.tar.gz</a><br/></body></html>PPIX Support------------You can also use the KGS to limit the available packages in a package indexgenerated ``zc.mirrorcheeseshopslashsimple``. This script also uses PyPI tolook up distribution file, so wave to use the real configuration file again.Let's create the pages:>>> indexDir = tempfile.mkdtemp('-ppix')>>> from zope.kgs import ppix>>> ppix.main((cfgFileReal, indexDir))The index contains one directory per package. So let's have a look:>>> import os>>> sorted(os.listdir(indexDir))['PIL', 'z3c.formdemo', 'zope.component', 'zope.interface']Each directory contains a single "index.html" file with the download links:>>> pkgDir = os.path.join(indexDir, 'zope.component')>>> sorted(os.listdir(pkgDir))['index.html']>>> pkgIndex = os.path.join(pkgDir, 'index.html')>>> print open(pkgIndex, 'r').read()<html><head><title>Links for "zope.component"</title></head><body><h1>Links for "zope.component"</h1><a href="http://pypi.python.org/packages/2.4/z/zope.component/zope.component-3.4.0-py2.4.egg#md5=c0763e94912e4a8ac1e321a068c916ba">zope.component-3.4.0-py2.4.egg</a><br/><a href="http://pypi.python.org/packages/source/z/zope.component/zope.component-3.4.0.tar.gz#md5=94afb57dfe605d7235ff562d1eaa3bed">zope.component-3.4.0.tar.gz</a><br/></body></html>PIL is an interesting case, because it does not upload its distribution filesyet, at least not for version 1.1.6:>>> pkgIndex = os.path.join(indexDir, 'PIL', 'index.html')>>> print open(pkgIndex, 'r').read()<html><head><title>Links for PIL</title></head><body><h1>Links for PIL</h1><a href='http://www.pythonware.com/products/pil' rel="homepage">1.1.5 home_page</a><br/><a href='http://effbot.org/zone/pil-changes-115.htm' rel="download">1.1.5 download_url</a><br/><a href='http://www.pythonware.com/products/pil' rel="homepage">1.1.5a2 home_page</a><br/><a href='http://effbot.org/zone/pil-changes-115.htm' rel="download">1.1.5a2 download_url</a><br/><a href='http://www.pythonware.com/products/pil' rel="homepage">1.1.5a1 home_page</a><br/><a href='http://effbot.org/zone/pil-changes-115.htm' rel="download">1.1.5a1 download_url</a><br/><a href='http://www.pythonware.com/products/pil/' rel="homepage">1.1.4 home_page</a><br/><a href='http://www.pythonware.com/products/pil/' rel="homepage">1.1.3 home_page</a><br/><a href='http://www.pythonware.com/downloads/Imaging-1.1.3.tar.gz' rel="download">1.1.3 download_url</a><br/><a href='http://www.pythonware.com/products/pil' rel="homepage">1.1.6 home_page</a><br/><a href='http://effbot.org/downloads/#Imaging' rel="download">1.1.6 download_url</a><br/></body></html>Optionally, you can also specify the `-i` option to generate an overview:>>> ppix.main(('-i', cfgFileReal, indexDir))>>> sorted(os.listdir(indexDir))['PIL', 'index.html', 'z3c.formdemo', 'zope.component', 'zope.interface']Let's now look at the file:>>> indexPage = os.path.join(indexDir, 'index.html')>>> print open(indexPage, 'r').read()<html><head><title>Simple Index for the "zope-dev" KGS (version 3.4.0b2)</title></head><body><h1>Simple Index for the "zope-dev" KGS (version 3.4.0b2)</h1><a href="PIL">PIL</a><br/><a href="z3c.formdemo">z3c.formdemo</a><br/><a href="zope.component">zope.component</a><br/><a href="zope.interface">zope.interface</a><br/></body></html>Allowing exisitng package pages to be overwritten and making the main indexpage an optional feature makes it possible to use this script for two usecases: (1) Merge the constraints into a PPIX index created by``zc.mirrorcheeseshopslashsimple``, and (2) create a standalone index whichonly provides the packages of the KGS.Getting the Latest Versions---------------------------When updating the KGS, it is often useful to know for which packages have newreleases.>>> from zope.kgs import latest>>> latest.main((cfgFileReal,))z3c.formdemo: 1.1.1, 1.1.2, 1.2.0, 1.3.0, 1.3.0b1, 1.4.0, ...However, it is often desired only to show new minor versions; in this case, wecan pass an option to exclude all versions that have a different majorversion:>>> latest.main(('-m', cfgFileReal))z3c.formdemo: 1.1.1, 1.1.2Sometimes you're only interested in changes that apply to a single package,and you won't want to wait for the script to query all of the others>>> latest.main(('-m', cfgFileReal, 'zope.app.server'))>>> latest.main(('-m', cfgFileReal, 'z3c.formdemo'))z3c.formdemo: 1.1.1, 1.1.2Extracting Change Information-----------------------------When releasing a version of the KGS, it is desirable to produce a list ofchanges since the last release. Changes are commonly compared to an olderversion.>>> cfgFileRealOrig = tempfile.mktemp('-cp.cfg')>>> open(cfgFileRealOrig, 'w').write('''\... [DEFAULT]... tested = true...... [KGS]... name = zope-dev... version = 3.4.0b1...... [PIL]... versions = 1.1.6...... [zope.component]... versions = 3.4.0...... [zope.interface]... versions = 3.4.0... ''')Let's now produce the changes:>>> from zope.kgs import change>>> change.main((cfgFileReal, cfgFileRealOrig))Processing ('PIL', '1.1.6')Processing ('z3c.formdemo', '1.1.0')Processing ('zope.component', '3.4.0')Processing ('zope.interface', '3.4.1')===PIL===<BLANKLINE>No changes or information not found.<BLANKLINE>============z3c.formdemo============<BLANKLINE>1.1.0 (unknown)---------------<BLANKLINE>- Feature: New "SQL Message" demo shows how ``z3c.form`` can be used withnon-object data. Specificically, this small application demonstrates using aGadfly database using pure SQL calls without any ORM.<BLANKLINE>- Feature: New "Address Book" demo that demonstrates more complex use cases,such as subforms, composite widgets, and mappings/lists<BLANKLINE><BLANKLINE>==============zope.component==============<BLANKLINE>3.4.0 (2007-09-29)------------------<BLANKLINE>No further changes since 3.4.0a1.<BLANKLINE><BLANKLINE>==============zope.interface==============<BLANKLINE>3.4.1 (unknown)---------------<BLANKLINE>Fixed a setup bug that prevented installation from source on systemswithout setuptools.<BLANKLINE>3.4.0 (unknown)---------------<BLANKLINE>Final release for 3.4.0.<BLANKLINE><BLANKLINE>You can also create the changes without an original file, in which case onlythe versions listed in the current KGS are considered.>>> change.main((cfgFileReal,))Processing ('PIL', '1.1.6')Processing ('z3c.formdemo', '1.1.0')Processing ('zope.component', '3.4.0')Processing ('zope.interface', '3.4.1')===PIL===<BLANKLINE>No changes or information not found.<BLANKLINE>============z3c.formdemo============<BLANKLINE>1.1.0 (unknown)---------------<BLANKLINE>- Feature: New "SQL Message" demo shows how ``z3c.form`` can be used withnon-object data. Specificically, this small application demonstrates using aGadfly database using pure SQL calls without any ORM.<BLANKLINE>- Feature: New "Address Book" demo that demonstrates more complex use cases,such as subforms, composite widgets, and mappings/lists<BLANKLINE><BLANKLINE>==============zope.component==============<BLANKLINE>3.4.0 (2007-09-29)------------------<BLANKLINE>No further changes since 3.4.0a1.<BLANKLINE><BLANKLINE>==============zope.interface==============<BLANKLINE>3.4.1 (unknown)---------------<BLANKLINE>Fixed a setup bug that prevented installation from source on systemswithout setuptools.<BLANKLINE>3.4.0 (unknown)---------------<BLANKLINE>Final release for 3.4.0.<BLANKLINE><BLANKLINE>The Site Generator------------------The easiest way to publish the KGS is via a directory published by a Webserver. Whenever a new `controlled-packages.cfg` file is uploaded, a script isrun that generates all the files. I usually set up a crontab job to dothis. The site generator script acts upon a directory, in which it assumes a`controlled-packages.cfg` file was placed:>>> siteDir = tempfile.mkdtemp()>>> cfgFileSite = os.path.join(siteDir, 'controlled-packages.cfg')>>> import shutil>>> shutil.copy(cfgFileReal, cfgFileSite)>>> from zope.kgs import site>>> site.main(['-s', siteDir])Let's have a look at the generated files:>>> from pprint import pprint>>> pprint(sorted(os.listdir(siteDir)))['3.4.0b2', 'index.html', 'intro.html', 'resources']>>> sorted(os.listdir(os.path.join(siteDir, '3.4.0b2')))['ANNOUNCEMENT.html', 'CHANGES.html','buildout.cfg', 'controlled-packages.cfg', 'index', 'index.html','links.html', 'minimal', 'versions.cfg']>>> sorted(os.listdir(os.path.join(siteDir, '3.4.0b2', 'minimal')))['PIL', 'index.html', 'z3c.formdemo', 'zope.component', 'zope.interface']If you try to generate the site again without adding the controlled packagesconfig file to the site directory again, it will simply return:>>> site.main(['-s', siteDir])Basic Parser API----------------The ``kgs.py`` module provides a simple class that parses the KGSconfiguration file and provides all data in an object-oriented manner.>>> from zope.kgs import kgsThe class is simply instnatiated using the path to the config file:>>> myKGS = kgs.KGS(cfgFile)>>> myKGS<KGS 'zope-dev'>The name, version and date of the KGS is available via:>>> myKGS.name'zope-dev'>>> myKGS.version'1.2.0'>>> myKGS.datedatetime.date(2009, 1, 1)When the changelog and/or announcement files are available, the KGS referencesthe absolute path:>>> myKGS.changelog'.../CHANGES.txt'>>> myKGS.announcement'.../ANNOUNCEMENT.txt'The same is true for other release-related files:>>> myKGS.files('.../zope-dev-1.2.0.tgz','.../zope-dev-1.2.0.exe')The packages are available under `packages`:>>> myKGS.packages[<Package 'packageA'>, <Package 'packageB'>, <Package 'packageC'>]Each package is also an object:>>> pkgA = myKGS.packages[0]>>> pkgA<Package 'packageA'>>>> pkgA.name'packageA'>>> pkgA.versions['1.0.0', '1.0.1']>>> pkgA.testedTrueAs we have seen in the scripts above, the KGS class also supports the`entends` option. Thus, let's load the KGS for the config file 2:>>> myKGS2 = kgs.KGS(cfgFile2)>>> myKGS2<KGS 'grok-dev'>>>> myKGS2.name'grok-dev'>>> myKGS2.packages[<Package 'packageA'>,<Package 'packageB'>,<Package 'packageC'>,<Package 'packageD'>]=======CHANGES=======1.2.0 (2009-07-24)------------------- Add ability to specify the extra-includes for running tests.1.1.0 (2009-02-01)------------------- Added '--no-links', '--no-index', and '--no-minimal-index' options to thesite generation sctipt to make it faster.- Generating list of latest versions does not fail anymore, if downloading andparsing of the index page fails.- Update links to PyPI web sites.1.0.1 (2009-01-29)------------------- Fix documentation in all scripts, fixing missing imports and incorrectwording.- The package should depend on `python-dateutl` and not `datetutil`, since thelatter is not available in PyPI anymore.1.0.0 (2009-01-29)------------------- Initial version as ``zope.kgs``.* A script that extracts the relevant part of the changelog of each packagein the KGS.* A script that lists all versions of a package released after the latestversion listed in the KGS.* A script that manages the generation of the entire KGS site.+ Generates generic and version-specific pages.+ Page generation is template-based for easy customization.* Generate `links.html` file which lists all controlled packages files.* Features copied from ``zope.release``:+ Parser for KGS configuration files.+ Generate `versions.cfg` and `buildout.cfg` script.* Features copied from ``zc.mirrorcheeseshopslashsimple``:+ Generate new index pages for the controlled packages. |
zope.lifecycleevent | zope.lifecycleeventOverviewIn a loosely-coupled system, events can be used by parts of the system
toinform each otherabout relevant occurrences. Thezope.eventpackage (optionally together withzope.interfaceandzope.component) provides a generic mechanism to dispatch objects
representing those events to interested subscribers (e.g., functions).
This package defines a specific set of event objects and API functions
for describing the life-cycle of objects in the system: object
creation, object modification, and object removal.Documentation is hosted athttps://zopelifecycleevent.readthedocs.ioChanges5.0 (2023-07-06)Drop support for Python 2.7, 3.5, 3.6.Add support for Python 3.11.4.4 (2022-05-09)Add support for Python 3.8, 3,9, 3.10.Drop support for Python 3.4.4.3 (2018-10-05)Add support for Python 3.7.4.2.0 (2017-07-12)Add support for Python 3.5 and 3.6.Drop support for Python 2.6 and 3.3.Documentation is hosted athttps://zopelifecycleevent.readthedocs.io4.1.0 (2014-12-27)Add support for PyPy3.Add support for Python 3.4.4.0.3 (2013-09-12)Drop the dependency onzope.componentas the interface and
implementation ofObjectEventis now inzope.interface.
Retained the dependency for the tests.Fix:.movedtried to notify the wrong event.4.0.2 (2013-03-08)Add Trove classifiers indicating CPython and PyPy support.4.0.1 (2013-02-11)Addtox.ini.4.0.0 (2013-02-11)Test coverage at 100%.Add support for Python 3.3 and PyPy.Replace deprecatedzope.interface.implementsusage with equivalentzope.interface.implementerdecorator.Drop support for Python 2.4 and 2.5.3.7.0 (2011-03-17)Add convenience functions to parallelzope.lifecycleevent.modifiedfor the other events defined in this package.3.6.2 (2010-09-25)Add not declared, but needed test dependency onzope.component [test].3.6.1 (2010-04-30)Remove dependency on undeclaredzope.testing.doctest.3.6.0 (2009-12-29)Refactor tests to losezope.annotationandzope.dublincoreas
dependencies.3.5.2 (2009-05-17)CopyIObjectMovedEvent,IObjectAddedEvent,IObjectRemovedEventinterfaces andObjectMovedEvent,ObjectAddedEventandObjectRemovedEventclasses here
fromzope.container(plus tests). The intent is to allow packages
that rely on these interfaces or the event classes to rely onzope.lifecycleevent(which has few dependencies) instead ofzope.container(which has many).3.5.1 (2009-03-09)Remove deprecated code and therefore dependency onzope.deferredimport.Change package’s mailing list address to zope-dev at zope.org, as
zope3-dev at zope.org is now retired.Update package’s description and documentation.3.5.0 (2009-01-31)Remove old module declarations from classes.Usezope.containerinstead ofzope.app.container.3.4.0 (2007-09-01)Initial release as an independent package |
zope.location | zope.locationIn Zope 3, “locations” are special objects that have a structural
location, indicated with__name__and__parent__attributes.Seezope.containerfor a useful extension of this concept to “containers.”Documentation is hosted athttps://zopelocation.readthedocs.io/en/latest/Changes5.0 (2023-05-25)Drop support for Python 2.7, 3.5, 3.6.4.3 (2022-11-29)Add support for Python 3.8, 3.9, 3.10, 3.11.Drop support for Python 3.4.4.2 (2018-10-09)Add support for Python 3.7.4.1.0 (2017-08-03)Drop support for Python 2.6, 3.2 and 3.3.Add a page to the docs on hackingzope.location.Note additional documentation dependencies.Add support for Python 3.5 and 3.6.Remove internal_compatimplementation module.4.0.3 (2014-03-19)Add Python 3.4 support.Updateboostrap.pyto version 2.2.4.0.2 (2013-03-11)Change the behavior ofLocationProxy’s__setattr__()to correctly
behave when dealing with the pure Python version of theProxyBaseclass. Also added a test suite that fully tests the pure Python proxy
version of theLocationProxyclass.4.0.1 (2013-02-19)Add Python 3.3 support.4.0.0 (2012-06-07)Remove backward-compatibility imports:zope.copy.clone(aliased aszope.location.pickling.locationCopy)zope.copy.CopyPersistent(aliased aszope.location.pickling.CopyPersistent).zope.site.interfaces.IPossibleSite(aliased aszope.location.interfaces.IPossibleSite).Add Python 3.2 support.Makezope.componentdependency optional. Use thecomponentextra
to force its installation (or just require it directly). Ifzope.componentis not present, this package defines theISiteinterface itself, and omits adapter registrations from its ZCML.Add support for PyPy.Add support for continuous integration usingtoxandjenkins.Bring unit test coverage to 100%.Add Sphinx documentation: moved doctest examples to API reference.Add ‘setup.py docs’ alias (installsSphinxand dependencies).Add ‘setup.py dev’ alias (runssetup.py developplus installsnoseandcoverage).Replace deprecatedzope.component.adaptsusage with equivalentzope.component.adapterdecorator.Replace deprecatedzope.interface.implementsusage with equivalentzope.interface.implementerdecorator.Drop support for Python 2.4 and 2.5.3.9.1 (2011-08-22)Add zcml extra as well as a test for configure.zcml.3.9.0 (2009-12-29)Move LocationCopyHook related tests to zope.copy and remove a test
dependency on that package.3.8.2 (2009-12-23)Fix a typo in the configure.zcml.3.8.1 (2009-12-23)Remove dependency on zope.copy: the LocationCopyHook adapter is registered
only if zope.copy is available.Use the standard Python doctest module instead of zope.testing.doctest, which
has been deprecated.3.8.0 (2009-12-22)Adjust to testing output caused by new zope.schema.3.7.1 (2009-11-18)Move the IPossibleSite and ISite interfaces to zope.component as they are
dealing with zope.component’s concept of a site, but not with location.3.7.0 (2009-09-29)Add getParent() to ILocationInfo and moved the actual implementation here
from zope.traversal.api, analogous to getParents().Actually remove deprecated PathPersistent class from
zope.location.pickling.Move ITraverser back to zope.traversing where it belongs conceptually. The
interface had been moved to zope.location to invert the package
interdependency but is no longer used here.3.6.0 (2009-08-27)New feature release: deprecate locationCopy, CopyPersistent and
PathPersistent from zope.location.pickling. These changes were already part
of the 3.5.3 release, which was erroneously numbered as a bugfix relese.Remove dependency on zope.deferredimport, directly import deprecated modules
without using it.3.5.5 (2009-08-15)Add zope.deferredimport as a dependency as it’s used directly by
zope.location.pickling.3.5.4 (2009-05-17)AddIContainedinterface tozope.location.interfacesmodule.
This interface was moved fromzope.container(afterzope.container3.8.2); consumers ofIContainedmay now
depend on zope.location rather than zope.container to reduce
dependency cycles.3.5.3 (2009-02-09)Use new zope.copy package for implementing location copying. Thus
there’s changes in thezope.locaton.picklingmodule:ThelocationCopyandCopyPersistentwas removed in prefer
to their equivalents in zope.copy. Deprecated backward-compatibility
imports provided.The module now provides azope.copy.interfaces.ICopyHookadapter
forILocationobjects that replaces the old CopyPersistent
functionality of checking for the need to clone objects based on
their location.3.5.2 (2009-02-04)Split RootPhysicallyLocatable adapter back from LocationPhysicallyLocatable,
because the IRoot object may not always provide ILocation and the code
for the root object is also simplier. It’s basically a copy of the
RootPhysicallyLocatable adapter from zope.traversing version 3.5.0 and
below withgetParentsmethod added (returns an empty list).3.5.1 (2009-02-02)Improve test coverage.The newgetParentsmethod was extracted fromzope.traversingand added to ILocationInfo interface in the previous release. Custom
ILocationInfo implementations should make sure they have this method
as well. That method is already used inzope.traversing.api.getParentsfunction.MakegetNameof LocationPhysicallyLocatable always return empty
string for the IRoot object, like RootPhysicallyLocatable fromzope.traversingdid. So, now LocationPhysicallyLocatable is
fully compatible with RootPhysicallyLocatable, making the latter one
obsolete.Change package mailing list address to zope-dev at zope.org instead
of retired zope3-dev at zope.org.3.5.0 (2009-01-31)Reverse the dependency between zope.location and zope.traversing. This
also causes the dependency to various other packages go away.3.4.0 (2007-10-02)Initial release independent of the main Zope tree. |
zope.locking | Advisory exclusive locks, shared locks, and freezes (locked to no-one).The zope.locking package provides three main features:advisory exclusive locks for individual objects;advisory shared locks for individual objects; andfrozen objects (locked to no one).Locks and freezes by themselves are advisory tokens and inherently
meaningless. They must be given meaning by other software, such as a security
policy.This package approaches these features primarily from the perspective of a
system API, largely free of policy; and then provides a set of adapters for
more common interaction with users, with some access policy. We will first
look at the system API, and then explain the policy and suggested use of the
provided adapters.ContentsAdvisory exclusive locks, shared locks, and freezes (locked to no-one).System APIExclusive LocksShared LocksEndableFreezesFreezesUser API, Adapters and SecurityTokenBrokerslocklockSharedfreezegetTokenHandlersExclusiveLockHandlersSharedLockHandlersWarningsIntended Security ConfigurationRandom ThoughtsChanges2.1.0 (2020-04-15)2.0.0 (2018-01-23)1.2.2 (2011-01-31)1.2.1 (2010-01-20)1.2 (2009-11-23)1.11.1b1.01.0bSystem APIThe central approach for the package is that locks and freeze tokens must be
created and then registered by a token utility. The tokens will not work
until they have been registered. This gives the ability to definitively know,
and thus manipulate, all active tokens in a system.The first object we’ll introduce, then, is the TokenUtility: the utility that
is responsible for the registration and the retrieving of tokens.>>> from zope import component, interface
>>> from zope.locking import interfaces, utility, tokens
>>> util = utility.TokenUtility()
>>> from zope.interface.verify import verifyObject
>>> verifyObject(interfaces.ITokenUtility, util)
TrueThe utility only has a few methods–get,iterForPrincipalId,__iter__, andregister–which we will look at below. It is expected to be
persistent, and the included implementation is in fact persistent.Persistent,
and expects to be installed as a local utility. The utility needs a
connection to the database before it can register persistent tokens.>>> from zope.locking.testing import Demo
>>> lock = tokens.ExclusiveLock(Demo(), 'Fantomas')
>>> util.register(lock)
Traceback (most recent call last):
...
AttributeError: 'NoneType' object has no attribute 'add'>>> conn = get_connection()
>>> conn.add(util)If the token provides IPersistent, the utility will add it to its connection.>>> lock._p_jar is None
True>>> lock = util.register(lock)
>>> lock._p_jar is util._p_jar
True>>> lock.end()
>>> lock = util.register(lock)The standard token utility can accept tokens for any object that is adaptable
to IKeyReference.>>> import datetime
>>> import pytz
>>> before_creation = datetime.datetime.now(pytz.utc)
>>> demo = Demo()Now, with an instance of the demo class, it is possible to register lock and
freeze tokens for demo instances with the token utility.As mentioned above, the general pattern for making a lock or freeze token is
to create it–at which point most of its methods and attributes are
unusable–and then to register it with the token utility. After registration,
the lock is effective and in place.The TokenUtility can actually be used with anything that implements
zope.locking.interfaces.IAbstractToken, but we’ll look at the four tokens that
come with the zope.locking package: an exclusive lock, a shared lock, a
permanent freeze, and an endable freeze.Exclusive LocksExclusive locks are tokens that are owned by a single principal. No principal
may be added or removed: the lock token must be ended and another started for
another principal to get the benefits of the lock (whatever they have been
configured to be).Here’s an example of creating and registering an exclusive lock: the principal
with an id of ‘john’ locks the demo object.>>> lock = tokens.ExclusiveLock(demo, 'john')
>>> res = util.register(lock)
>>> res is lock
TrueThe lock token is now in effect. Registering the token (the lock) fired an
ITokenStartedEvent, which we’ll look at now.(Note that this example uses an events list to look at events that have fired.
This is simply a list whoseappendmethod has been added as a subscriber
to the zope.event.subscribers list. It’s included as a global when this file
is run as a test.)>>> from zope.component.eventtesting import events
>>> ev = events[-1]
>>> verifyObject(interfaces.ITokenStartedEvent, ev)
True
>>> ev.object is lock
TrueNow that the lock token is created and registered, the token utility knows
about it. The utilitiesgetmethod simply returns the active token for an
object or None–it never returns an ended token, and in fact none of the
utility methods do.>>> util.get(demo) is lock
True
>>> util.get(Demo()) is None
TrueNote thatgetaccepts alternate defaults, like a dictionary.get:>>> util.get(Demo(), util) is util
TrueTheiterForPrincipalIdmethod returns an iterator of active locks for the
given principal id.>>> list(util.iterForPrincipalId('john')) == [lock]
True
>>> list(util.iterForPrincipalId('mary')) == []
TrueThe util’s__iter__method simply iterates over all active (non-ended)
tokens.>>> list(util) == [lock]
TrueThe token utility disallows registration of multiple active tokens for the
same object.>>> util.register(tokens.ExclusiveLock(demo, 'mary'))
... # doctest: +ELLIPSIS
Traceback (most recent call last):
...
zope.locking.interfaces.RegistrationError: ...
>>> util.register(tokens.SharedLock(demo, ('mary', 'jane')))
... # doctest: +ELLIPSIS
Traceback (most recent call last):
...
zope.locking.interfaces.RegistrationError: ...
>>> util.register(tokens.Freeze(demo))
... # doctest: +ELLIPSIS
Traceback (most recent call last):
...
zope.locking.interfaces.RegistrationError: ...It’s also worth looking at the lock token itself. The registered lock token
implements IExclusiveLock.>>> verifyObject(interfaces.IExclusiveLock, lock)
TrueIt provides a number of capabilities. Arguably the most important attribute is
whether the token is in effect or not:ended. This token is active, so it
has not yet ended:>>> lock.ended is None
TrueWhen it does end, the ended attribute is a datetime in UTC of when the token
ended. We’ll demonstrate that below.Later, thecreation,expiration,duration, andremaining_durationwill
be important; for now we merely note their existence.>>> before_creation <= lock.started <= datetime.datetime.now(pytz.utc)
True
>>> lock.expiration is None # == forever
True
>>> lock.duration is None # == forever
True
>>> lock.remaining_duration is None # == forever
TrueTheendmethod and the related ending and expiration attributes are all part
of the IEndable interface–an interface that not all tokens must implement,
as we will also discuss later.>>> interfaces.IEndable.providedBy(lock)
TrueThecontextand__parent__attributes point to the locked object–demo in
our case.contextis the intended standard API for obtaining the object,
but__parent__is important for the Zope 3 security set up, as discussed
towards the end of this document.>>> lock.context is demo
True
>>> lock.__parent__ is demo # important for security
TrueRegistering the lock with the token utility set the utility attribute and
initialized the started attribute to the datetime that the lock began. The
utility attribute should never be set by any code other than the token
utility.>>> lock.utility is util
TrueTokens always provide aprincipal_idsattribute that provides an iterable of
the principals that are part of a token. In our case, this is an exclusive
lock for ‘john’, so the value is simple.>>> sorted(lock.principal_ids)
['john']The only method on a basic token like the exclusive lock isend. Calling it
without arguments permanently and explicitly ends the life of the token.>>> lock.end()Like registering a token, ending a token fires an event.>>> ev = events[-1]
>>> verifyObject(interfaces.ITokenEndedEvent, ev)
True
>>> ev.object is lock
TrueIt affects attributes on the token. Again, the most important of these is
ended, which is now the datetime of ending.>>> lock.ended >= lock.started
True
>>> lock.remaining_duration == datetime.timedelta()
TrueIt also affects queries of the token utility.>>> util.get(demo) is None
True
>>> list(util.iterForPrincipalId('john')) == []
True
>>> list(util) == []
TrueDon’t try to end an already-ended token.>>> lock.end()
Traceback (most recent call last):
...
zope.locking.interfaces.EndedErrorThe other way of ending a token is with an expiration datetime. As we’ll see,
one of the most important caveats about working with timeouts is that a token
that expires because of a timeout does not fire any expiration event. It
simply starts providing theexpirationvalue for theendedattribute.>>> one = datetime.timedelta(hours=1)
>>> two = datetime.timedelta(hours=2)
>>> three = datetime.timedelta(hours=3)
>>> four = datetime.timedelta(hours=4)
>>> lock = util.register(tokens.ExclusiveLock(demo, 'john', three))
>>> lock.duration
datetime.timedelta(seconds=10800)
>>> three >= lock.remaining_duration >= two
True
>>> lock.ended is None
True
>>> util.get(demo) is lock
True
>>> list(util.iterForPrincipalId('john')) == [lock]
True
>>> list(util) == [lock]
TrueThe expiration time of an endable token is always the creation date plus the
timeout.>>> lock.expiration == lock.started + lock.duration
True
>>> ((before_creation + three) <=
... (lock.expiration) <= # this value is the expiration date
... (before_creation + four))
TrueExpirations can be changed while a lock is still active, using any of
theexpiration,remaining_durationordurationattributes. All changes
fire events. First we’ll change the expiration attribute.>>> lock.expiration = lock.started + one
>>> lock.expiration == lock.started + one
True
>>> lock.duration == one
True
>>> ev = events[-1]
>>> verifyObject(interfaces.IExpirationChangedEvent, ev)
True
>>> ev.object is lock
True
>>> ev.old == lock.started + three
TrueNext we’ll change the duration attribute.>>> lock.duration = four
>>> lock.duration
datetime.timedelta(seconds=14400)
>>> four >= lock.remaining_duration >= three
True
>>> ev = events[-1]
>>> verifyObject(interfaces.IExpirationChangedEvent, ev)
True
>>> ev.object is lock
True
>>> ev.old == lock.started + one
TrueNow we’ll hack our code to make it think that it is two hours later, and then
check and modify the remaining_duration attribute.>>> def hackNow():
... return (datetime.datetime.now(pytz.utc) +
... datetime.timedelta(hours=2))
...
>>> import zope.locking.utils
>>> oldNow = zope.locking.utils.now
>>> zope.locking.utils.now = hackNow # make code think it's 2 hours later
>>> lock.duration
datetime.timedelta(seconds=14400)
>>> two >= lock.remaining_duration >= one
True
>>> lock.remaining_duration -= one
>>> one >= lock.remaining_duration >= datetime.timedelta()
True
>>> three + datetime.timedelta(minutes=1) >= lock.duration >= three
True
>>> ev = events[-1]
>>> verifyObject(interfaces.IExpirationChangedEvent, ev)
True
>>> ev.object is lock
True
>>> ev.old == lock.started + four
TrueNow, we’ll hack our code to make it think that it’s a day later. It is very
important to remember that a lock ending with a timeout ends silently–that
is, no event is fired.>>> def hackNow():
... return (
... datetime.datetime.now(pytz.utc) + datetime.timedelta(days=1))
...
>>> zope.locking.utils.now = hackNow # make code think it is a day later
>>> lock.ended == lock.expiration
True
>>> util.get(demo) is None
True
>>> util.get(demo, util) is util # alternate default works
True
>>> lock.remaining_duration == datetime.timedelta()
True
>>> lock.end()
Traceback (most recent call last):
...
zope.locking.interfaces.EndedErrorOnce a lock has ended, the timeout can no longer be changed.>>> lock.duration = datetime.timedelta(days=2)
Traceback (most recent call last):
...
zope.locking.interfaces.EndedErrorWe’ll undo the hacks, and also end the lock (that is no longer ended once
the hack is finished).>>> zope.locking.utils.now = oldNow # undo the hack
>>> lock.end()Make sure to register tokens. Creating a lock but not registering it puts it
in a state that is not fully initialized.>>> lock = tokens.ExclusiveLock(demo, 'john')
>>> lock.started # doctest: +ELLIPSIS
Traceback (most recent call last):
...
zope.locking.interfaces.UnregisteredError: ...
>>> lock.ended # doctest: +ELLIPSIS
Traceback (most recent call last):
...
zope.locking.interfaces.UnregisteredError: ...Shared LocksShared locks are very similar to exclusive locks, but take an iterable of one
or more principals at creation, and can have principals added or removed while
they are active.In this example, also notice a convenient characteristic of the TokenUtilityregistermethod: it also returns the token, so creation, registration, and
variable assignment can be chained, if desired.>>> lock = util.register(tokens.SharedLock(demo, ('john', 'mary')))
>>> ev = events[-1]
>>> verifyObject(interfaces.ITokenStartedEvent, ev)
True
>>> ev.object is lock
TrueHere, principals with ids of ‘john’ and ‘mary’ have locked the demo object.
The returned token implements ISharedLock and provides a superset of the
IExclusiveLock capabilities. These next operations should all look familiar
from the discussion of the ExclusiveLock tokens above.>>> verifyObject(interfaces.ISharedLock, lock)
True
>>> lock.context is demo
True
>>> lock.__parent__ is demo # important for security
True
>>> lock.utility is util
True
>>> sorted(lock.principal_ids)
['john', 'mary']
>>> lock.ended is None
True
>>> before_creation <= lock.started <= datetime.datetime.now(pytz.utc)
True
>>> lock.expiration is None
True
>>> lock.duration is None
True
>>> lock.remaining_duration is None
True
>>> lock.end()
>>> lock.ended >= lock.started
TrueAs mentioned, though, the SharedLock capabilities are a superset of the
ExclusiveLock ones. There are two extra methods:addandremove. These
are able to add and remove principal ids as shared owners of the lock token.>>> lock = util.register(tokens.SharedLock(demo, ('john',)))
>>> sorted(lock.principal_ids)
['john']
>>> lock.add(('mary',))
>>> sorted(lock.principal_ids)
['john', 'mary']
>>> lock.add(('alice',))
>>> sorted(lock.principal_ids)
['alice', 'john', 'mary']
>>> lock.remove(('john',))
>>> sorted(lock.principal_ids)
['alice', 'mary']
>>> lock.remove(('mary',))
>>> sorted(lock.principal_ids)
['alice']Adding and removing principals fires appropriate events, as you might expect.>>> lock.add(('mary',))
>>> sorted(lock.principal_ids)
['alice', 'mary']
>>> ev = events[-1]
>>> verifyObject(interfaces.IPrincipalsChangedEvent, ev)
True
>>> ev.object is lock
True
>>> sorted(ev.old)
['alice']
>>> lock.remove(('alice',))
>>> sorted(lock.principal_ids)
['mary']
>>> ev = events[-1]
>>> verifyObject(interfaces.IPrincipalsChangedEvent, ev)
True
>>> ev.object is lock
True
>>> sorted(ev.old)
['alice', 'mary']Removing all participants in a lock ends the lock, making it ended.>>> lock.remove(('mary',))
>>> sorted(lock.principal_ids)
[]
>>> lock.ended >= lock.started
True
>>> ev = events[-1]
>>> verifyObject(interfaces.IPrincipalsChangedEvent, ev)
True
>>> ev.object is lock
True
>>> sorted(ev.old)
['mary']
>>> ev = events[-2]
>>> verifyObject(interfaces.ITokenEndedEvent, ev)
True
>>> ev.object is lock
TrueAs you might expect, trying to add (or remove!) users from an ended lock is
an error.>>> lock.add(('john',))
Traceback (most recent call last):
...
zope.locking.interfaces.EndedError
>>> lock.remove(('john',))
Traceback (most recent call last):
...
zope.locking.interfaces.EndedErrorThe token utility keeps track of shared lock tokens the same as exclusive lock
tokens. Here’s a quick summary in code.>>> lock = util.register(tokens.SharedLock(demo, ('john', 'mary')))
>>> util.get(demo) is lock
True
>>> list(util.iterForPrincipalId('john')) == [lock]
True
>>> list(util.iterForPrincipalId('mary')) == [lock]
True
>>> list(util) == [lock]
True
>>> util.register(tokens.ExclusiveLock(demo, 'mary'))
... # doctest: +ELLIPSIS
Traceback (most recent call last):
...
zope.locking.interfaces.RegistrationError: ...
>>> util.register(tokens.SharedLock(demo, ('mary', 'jane')))
... # doctest: +ELLIPSIS
Traceback (most recent call last):
...
zope.locking.interfaces.RegistrationError: ...
>>> util.register(tokens.Freeze(demo))
... # doctest: +ELLIPSIS
Traceback (most recent call last):
...
zope.locking.interfaces.RegistrationError: ...
>>> lock.end()Timed expirations work the same as with exclusive locks. We won’t repeat that
here, though look in the annoying.txt document in this package for the actual
repeated tests.EndableFreezesAn endable freeze token is similar to a lock token except that it grants the
‘lock’ to no one.>>> token = util.register(tokens.EndableFreeze(demo))
>>> verifyObject(interfaces.IEndableFreeze, token)
True
>>> ev = events[-1]
>>> verifyObject(interfaces.ITokenStartedEvent, ev)
True
>>> ev.object is token
True
>>> sorted(token.principal_ids)
[]
>>> token.end()Endable freezes are otherwise identical to exclusive locks. See annoying.txt
for the comprehensive copy-and-paste tests duplicating the exclusive lock
tests. Notice that an EndableFreeze will never be a part of an iterable of
tokens by principal: by definition, a freeze is associated with no principals.FreezesFreezes are similar to EndableFreezes, except they are not endable. They are
intended to be used by system level operations that should permanently disable
certain changes, such as changes to the content of an archived object version.Creating them is the same…>>> token = util.register(tokens.Freeze(demo))
>>> verifyObject(interfaces.IFreeze, token)
True
>>> ev = events[-1]
>>> verifyObject(interfaces.ITokenStartedEvent, ev)
True
>>> ev.object is token
True
>>> sorted(token.principal_ids)
[]But they can’t go away…>>> token.end()
Traceback (most recent call last):
...
AttributeError: 'Freeze' object has no attribute 'end'They also do not have expirations, duration, remaining durations, or ended
dates. They are permanent, unless you go into the database to muck with
implementation-specific data structures.There is no API way to end a Freeze. We’ll need to make a new object for the
rest of our demonstrations, and this token will exist through the
remaining examples.>>> old_demo = demo
>>> demo = Demo()User API, Adapters and SecurityThe API discussed so far makes few concessions to some of the common use cases
for locking. Here are some particular needs as yet unfulfilled by the
discussion so far.It should be possible to allow and deny per object whether users may
create and register tokens for the object.It should often be easier to register an endable token than a permanent
token.All users should be able to unlock or modify some aspects of their own
tokens, or remove their own participation in shared tokens; but it should be
possible to restrict access to ending tokens that users do not own (often
called “breaking locks”).In the context of the Zope 3 security model, the first two needs are intended
to be addressed by the ITokenBroker interface, and associated adapter; the last
need is intended to be addressed by the ITokenHandler, and associated
adapters.TokenBrokersToken brokers adapt an object, which is the object whose tokens are
brokered, and uses this object as a security context. They provide a few
useful methods:lock,lockShared,freeze, andget. The TokenBroker
expects to be a trusted adapter.lockThe lock method creates and registers an exclusive lock. Without arguments,
it tries to create it for the user in the current interaction.This won’t work without an interaction, of course. Notice that we start the
example by registering the utility. We would normally be required to put the
utility in a site package, so that it would be persistent, but for this
demonstration we are simplifying the registration.>>> component.provideUtility(util, provides=interfaces.ITokenUtility)>>> import zope.interface.interfaces
>>> @interface.implementer(zope.interface.interfaces.IComponentLookup)
... @component.adapter(interface.Interface)
... def siteManager(obj):
... return component.getGlobalSiteManager()
...
>>> component.provideAdapter(siteManager)>>> from zope.locking import adapters
>>> component.provideAdapter(adapters.TokenBroker)
>>> broker = interfaces.ITokenBroker(demo)
>>> broker.lock()
Traceback (most recent call last):
...
ValueError
>>> broker.lock('joe')
Traceback (most recent call last):
...
zope.locking.interfaces.ParticipationErrorIf we set up an interaction with one participation, the lock will have a
better chance.>>> import zope.security.interfaces
>>> @interface.implementer(zope.security.interfaces.IPrincipal)
... class DemoPrincipal(object):
... def __init__(self, id, title=None, description=None):
... self.id = id
... self.title = title
... self.description = description
...
>>> joe = DemoPrincipal('joe')
>>> import zope.security.management
>>> @interface.implementer(zope.security.interfaces.IParticipation)
... class DemoParticipation(object):
... def __init__(self, principal):
... self.principal = principal
... self.interaction = None
...
>>> zope.security.management.endInteraction()
>>> zope.security.management.newInteraction(DemoParticipation(joe))>>> token = broker.lock()
>>> interfaces.IExclusiveLock.providedBy(token)
True
>>> token.context is demo
True
>>> token.__parent__ is demo
True
>>> sorted(token.principal_ids)
['joe']
>>> token.started is not None
True
>>> util.get(demo) is token
True
>>> token.end()You can only specify principals that are in the current interaction.>>> token = broker.lock('joe')
>>> sorted(token.principal_ids)
['joe']
>>> token.end()
>>> broker.lock('mary')
Traceback (most recent call last):
...
zope.locking.interfaces.ParticipationErrorThe method can take a duration.>>> token = broker.lock(duration=two)
>>> token.duration == two
True
>>> token.end()If the interaction has more than one principal, a principal (in the
interaction) must be specified.>>> mary = DemoPrincipal('mary')
>>> participation = DemoParticipation(mary)
>>> zope.security.management.getInteraction().add(participation)
>>> broker.lock()
Traceback (most recent call last):
...
ValueError
>>> broker.lock('susan')
Traceback (most recent call last):
...
zope.locking.interfaces.ParticipationError
>>> token = broker.lock('joe')
>>> sorted(token.principal_ids)
['joe']
>>> token.end()
>>> token = broker.lock('mary')
>>> sorted(token.principal_ids)
['mary']
>>> token.end()
>>> zope.security.management.endInteraction()lockSharedThelockSharedmethod has similar characteristics, except that it can handle
multiple principals.Without an interaction, principals are either not found, or not part of the
interaction:>>> broker.lockShared()
Traceback (most recent call last):
...
ValueError
>>> broker.lockShared(('joe',))
Traceback (most recent call last):
...
zope.locking.interfaces.ParticipationErrorWith an interaction, the principals get the lock by default.>>> zope.security.management.newInteraction(DemoParticipation(joe))>>> token = broker.lockShared()
>>> interfaces.ISharedLock.providedBy(token)
True
>>> token.context is demo
True
>>> token.__parent__ is demo
True
>>> sorted(token.principal_ids)
['joe']
>>> token.started is not None
True
>>> util.get(demo) is token
True
>>> token.end()You can only specify principals that are in the current interaction.>>> token = broker.lockShared(('joe',))
>>> sorted(token.principal_ids)
['joe']
>>> token.end()
>>> broker.lockShared(('mary',))
Traceback (most recent call last):
...
zope.locking.interfaces.ParticipationErrorThe method can take a duration.>>> token = broker.lockShared(duration=two)
>>> token.duration == two
True
>>> token.end()If the interaction has more than one principal, all are included, unless some
are singled out.>>> participation = DemoParticipation(mary)
>>> zope.security.management.getInteraction().add(participation)
>>> token = broker.lockShared()
>>> sorted(token.principal_ids)
['joe', 'mary']
>>> token.end()
>>> token = broker.lockShared(('joe',))
>>> sorted(token.principal_ids)
['joe']
>>> token.end()
>>> token = broker.lockShared(('mary',))
>>> sorted(token.principal_ids)
['mary']
>>> token.end()
>>> zope.security.management.endInteraction()freezeThefreezemethod allows users to create an endable freeze. It has no
requirements on the interaction. It should be protected carefully, from a
security perspective.>>> token = broker.freeze()
>>> interfaces.IEndableFreeze.providedBy(token)
True
>>> token.context is demo
True
>>> token.__parent__ is demo
True
>>> sorted(token.principal_ids)
[]
>>> token.started is not None
True
>>> util.get(demo) is token
True
>>> token.end()The method can take a duration.>>> token = broker.freeze(duration=two)
>>> token.duration == two
True
>>> token.end()getThegetmethod is exactly equivalent to the token utility’s get method:
it returns the current active token for the object, or None. It is useful
for protected code, since utilities typically do not get security assertions,
and this method can get its security assertions from the object, which is
often the right place.Again, the TokenBroker does embody some policy; if it is not good policy for
your application, build your own interfaces and adapters that do.TokenHandlersTokenHandlers are useful for endable tokens with one or more principals–that
is, locks, but not freezes. They are intended to be protected with a lower
external security permission then the usual token methods and attributes, and
then impose their own checks on the basis of the current interaction. They are
very much policy, and other approaches may be useful. They are intended to be
registered as trusted adapters.For exclusive locks and shared locks, then, we have token handlers.
Generally, token handlers give access to all of the same capabilities as their
corresponding tokens, with the following additional constraints and
capabilities:expiration,duration, andremaining_durationall may be set only if
all the principals in the current interaction are owners of the wrapped
token; andreleaseremoves some or all of the principals in the interaction if all
the principals in the current interaction are owners of the wrapped token.Note thatendis unaffected: this is effectively “break lock”, whilereleaseis effectively “unlock”. Permissions should be set accordingly.Shared lock handlers have two additional methods that are discussed in their
section.ExclusiveLockHandlersGiven the general constraints described above, exclusive lock handlers will
generally only allow access to their special capabilities if the operation
is in an interaction with only the lock owner.>>> zope.security.management.newInteraction(DemoParticipation(joe))
>>> component.provideAdapter(adapters.ExclusiveLockHandler)
>>> lock = broker.lock()
>>> handler = interfaces.IExclusiveLockHandler(lock)
>>> verifyObject(interfaces.IExclusiveLockHandler, handler)
True
>>> handler.__parent__ is lock
True
>>> handler.expiration is None
True
>>> handler.duration = two
>>> lock.duration == two
True
>>> handler.expiration = handler.started + three
>>> lock.expiration == handler.started + three
True
>>> handler.remaining_duration = two
>>> lock.remaining_duration <= two
True
>>> handler.release()
>>> handler.ended >= handler.started
True
>>> lock.ended >= lock.started
True
>>> lock = util.register(tokens.ExclusiveLock(demo, 'mary'))
>>> handler = interfaces.ITokenHandler(lock) # for joe's interaction still
>>> handler.duration = two # doctest: +ELLIPSIS
Traceback (most recent call last):
...
zope.locking.interfaces.ParticipationError: ...
>>> handler.expiration = handler.started + three # doctest: +ELLIPSIS
Traceback (most recent call last):
...
zope.locking.interfaces.ParticipationError: ...
>>> handler.remaining_duration = two # doctest: +ELLIPSIS
Traceback (most recent call last):
...
zope.locking.interfaces.ParticipationError: ...
>>> handler.release() # doctest: +ELLIPSIS
Traceback (most recent call last):
...
zope.locking.interfaces.ParticipationError: ...
>>> lock.end()SharedLockHandlersShared lock handlers let anyone who is an owner of a token set the expiration,
duration, and remaining_duration values. This is a ‘get out of the way’ policy
that relies on social interactions to make sure all the participants are
represented as they want. Other policies could be written in other adapters.>>> component.provideAdapter(adapters.SharedLockHandler)
>>> lock = util.register(tokens.SharedLock(demo, ('joe', 'mary')))
>>> handler = interfaces.ITokenHandler(lock) # for joe's interaction still
>>> verifyObject(interfaces.ISharedLockHandler, handler)
True
>>> handler.__parent__ is lock
True
>>> handler.expiration is None
True
>>> handler.duration = two
>>> lock.duration == two
True
>>> handler.expiration = handler.started + three
>>> lock.expiration == handler.started + three
True
>>> handler.remaining_duration = two
>>> lock.remaining_duration <= two
True
>>> sorted(handler.principal_ids)
['joe', 'mary']
>>> handler.release()
>>> sorted(handler.principal_ids)
['mary']
>>> handler.duration = two # doctest: +ELLIPSIS
Traceback (most recent call last):
...
zope.locking.interfaces.ParticipationError: ...
>>> handler.expiration = handler.started + three # doctest: +ELLIPSIS
Traceback (most recent call last):
...
zope.locking.interfaces.ParticipationError: ...
>>> handler.remaining_duration = two # doctest: +ELLIPSIS
Traceback (most recent call last):
...
zope.locking.interfaces.ParticipationError: ...
>>> handler.release() # doctest: +ELLIPSIS
Traceback (most recent call last):
...
zope.locking.interfaces.ParticipationError: ...The shared lock handler adds two additional methods to a standard handler:joinandadd. They do similar jobs, but are separate to allow separate
security settings for each. Thejoinmethod lets some or all of the
principals in the current interaction join.>>> handler.join()
>>> sorted(handler.principal_ids)
['joe', 'mary']
>>> handler.join(('susan',))
Traceback (most recent call last):
...
zope.locking.interfaces.ParticipationErrorTheaddmethod lets any principal ids be added to the lock, but all
principals in the current interaction must be a part of the lock.>>> handler.add(('susan',))
>>> sorted(handler.principal_ids)
['joe', 'mary', 'susan']
>>> handler.release()
>>> handler.add('jake') # doctest: +ELLIPSIS
Traceback (most recent call last):
...
zope.locking.interfaces.ParticipationError: ...
>>> lock.end()
>>> zope.security.management.endInteraction()WarningsThe token utility will register a token for an object if it can. It does not
check to see if it is actually the local token utility for the given object.
This should be arranged by clients of the token utility, and verified
externally if desired.Tokens are stored as keys in BTrees, and therefore must be orderable
(i.e., they must implement __cmp__).Intended Security ConfigurationUtilities are typically unprotected in Zope 3–or more accurately, have
no security assertions and are used with no security proxy–and the token
utility expects to be so. As such, the broker and handler objects are
expected to be the objects used by view code, and so associated with security
proxies. All should have appropriate __parent__ attribute values. The
ability to mutate the tokens–end,addandremovemethods, for
instance–should be protected with an administrator-type permission such as
‘zope.Security’. Setting the timeout properties on the token should be
protected in the same way. Setting the handlers attributes can have a less
restrictive setting, since they calculate security themselves on the basis of
lock membership.On the adapter, theendmethod should be protected with the same or
similar permission. Calling methods such as lock and lockShared should be
protected with something like ‘zope.ManageContent’. Getting attributes should
be ‘zope.View’ or ‘zope.Public’, and unlocking and setting the timeouts, since
they are already protected to make sure the principal is a member of the lock,
can probably be ‘zope.Public’.These settings can be abused relatively easily to create an insecure
system–for instance, if a user can get an adapter to IPrincipalLockable for
another principal–but are a reasonable start.>>> broker.__parent__ is demo
True
>>> handler.__parent__ is lock
TrueRandom ThoughtsAs a side effect of the design, it is conceivable that multiple lock utilities
could be in use at once, governing different aspects of an object; however,
this may never itself be of use.Changes2.1.0 (2020-04-15)Fix DeprecationWarnings for ObjectEvent.Add support for Python 3.7 and 3.8.Drop support for Python 3.3 and 3.4.2.0.0 (2018-01-23)Python 3 compatibility.Note: The browser views and related code where removed. You need to provide
those in application-level code now.Package the zcml files.Updated dependencies.Revived from svn.zope.org1.2.2 (2011-01-31)Consolidate duplicate evolution code.Split generations config into its own zcml file.1.2.1 (2010-01-20)Bug fix: the generation added in 1.2 did not properly clean up
expired tokens, and could leave the token utility in an inconsistent
state.1.2 (2009-11-23)Bug fix: tokens were stored in a manner that prevented them from
being cleaned up properly in the utility’s _principal_ids mapping.
Make zope.locking.tokens.Token orderable to fix this, as tokens
are stored as keys in BTrees.Add a zope.app.generations Schema Manager to clean up any lingering
tokens due to this bug. Token utilities not accessible through the
component registry can be cleaned up manually with
zope.locking.generations.fix_token_utility.TokenUtility’s register method will now add the token to the utility’s
database connection if the token provides IPersistent.Clean up the tests and docs and move some common code to testing.py.Fix some missing imports.1.1(series for Zope 3.4; eggs)1.1bconverted to use eggs1.0(series for Zope 3.3; no dependencies on Zope eggs)1.0bInitial non-dev release |
zope.login | zope.loginThis package provides login helpers forzope.publisherbased on the concepts ofzope.authentication.
This includes support for HTTP password logins and FTP logins.Documentation is hosted athttps://zopelogin.readthedocs.ioChanges3.0 (2023-08-23)Drop support for Python 2.7, 3.5, 3.6.Add support for Python 3.11.2.2 (2022-04-29)Add support for Python 3.7, 3.8, 3.9, 3.10.2.1.0 (2017-09-01)Add support for Python 3.5 and 3.6.Drop support for Python 2.6 and 3.3.Host documentation athttps://zopelogin.readthedocs.io/2.0.0 (2014-12-24)Add support for PyPy and PyPy3.Add support for Python 3.4.Add support for testing on Travis.Add support for Python 3.3.Replace deprecatedzope.interface.implementsusage with equivalentzope.interface.implementerdecorator.Drop support for Python 2.4 and 2.5.1.0.0 (2009-12-31)Extracted BasicAuthAdapter and FTPAuth adapters from zope.publisher. They
should have never gone into that package in the first place. |
zope_lrr_analyzer | Table of contentsIntroductionHow to useResultsSingle entry meaningAuthorsChangelog0.5 (2016-06-13)0.4 (2012-12-06)0.3 (2012-11-15)0.2 (2012-09-19)0.1 (2012-04-27)IntroductionThis project adds to your system a new utility command:zope_lrr_analyzer. This utility only works with
Zope instance logs withhaufe.requestmonitoringinstalled (and where themonitoring long running requests hookis enabled).So, yourinstance.logmust be filled by entries like this:------
2012-03-27T15:58:19 WARNING RequestMonitor.DumpTrace Long running request
Request 28060 "/VirtualHostBase/http/www.mysite.com:80/mysiteid/VirtualHostRoot/myrequest/..." running in thread 1133545792 since 10.7206499577s
Python call stack (innermost first)
...
lot of lines, depends on Python traceback
...
Module ZPublisherEventsBackport.patch, line 80, in publish
Module ZPublisher.Publish, line 202, in publish_module_standard
Module ZPublisher.Publish, line 401, in publish_module
Module ZServer.PubCore.ZServerPublisher, line 25, in __init__
<BLANKLINE>The utility will help you to parse long running request collecting some statistical data.How to useUsage: zope_lrr_analyzer [options] logfile [logfile…]Analyze Zope instance log with haufe.requestmonitoring entriesOptions:--versionshow program’s version number and exit-h,--helpshow this help message and exit-sSTART_FROM,--start=START_FROMstart analysis after a given date/time (format like
“YYYY-MM-DD HH:MM:SS”)-eEND_AT,--end=END_ATstop analysis at given date/time (format like “YYYY-
MM-DD HH:MM:SS”)-lLOG_SIZE,--log-size=LOG_SIZEkeep only an amount of slow requests. Default is: no
limit.-iINCLUDE_REGEX,--include=INCLUDE_REGEXa regexp expression that a calling path must match or
will be discarded. Can be called multiple times,
expanding the set-tTRACEBACK_INCLUDE_REGEX,--traceback-include=TRACEBACK_INCLUDE_REGEXa regexp expression that the Python traceback must
match or will be discarded. Can be called multiple
times, expanding the set-r,--keep-request-idUse request and thread ids to handle every match as a
different entryResultsLet’s explain the results:Stats from 2012-11-14 00:02:07 to 2012-11-15 09:55:41 (347 LRR catched)
...
----
2 /VirtualHostBase/http/yoursite.com:80/siteid/VirtualHostRoot/foo/bar
25 - 3654.05561542 (1:00:54.055615) - from 2012-11-15 07:48:10 to 2012-11-15 08:45:29
----
1 /VirtualHostBase/http/yoursite.com:80/siteid/VirtualHostRoot/baz
77 - 16029.3731236 (4:27:09.373124) - from 2012-11-15 07:43:55 to 2012-11-15 08:45:30You’ll get a rank of slowest request paths (top one is fastest, last one is slowest).
The order is done by collecting all request’s performed to the same path and then getting the total time.This mean that a request called only once that needs 30 seconds is faster that another path
that only requires 10 seconds, but is called ten times (30x1 < 10x10).If you use also the--keep-request-idoption, every request is count as a separate entry,
so the output change a little:Stats from 2012-04-27 00:02:07 to 2012-04-27 16:55:41 (347 LRR catched)
...
----
2 /VirtualHostBase/http/yoursite.com:80/siteid/VirtualHostRoot/foo/bar
1510.2860291 (0:25:10.286029) - from 2012-09-19 08:36:27 to 2012-09-19 09:01:22
----
1 /VirtualHostBase/http/yoursite.com:80/siteid/VirtualHostRoot/baz
1750.49365091 (0:29:10.493651) - from 2012-09-19 08:30:34 to 2012-09-19 09:00:58Single entry meaningEvery entry gives that kind of data:Entry position Called path
| |
1 /VirtualHostBase/http/yoursite.com:80/siteid/VirtualHostRoot/...
15 - 171.913325071 (0:02:51.913325) - from 2012-09-19 08:30:34 to 2012-09-19 09:00:58
| | | | |
Times called | Time needed (human readable) | |
| | Slow request end date
Time needed (in seconds) Slow request start dateWhen--keep-request-idused:Entry position Called path
| |
1 /VirtualHostBase/http/yoursite.com:80/siteid/VirtualHostRoot/...
1750.49365091 (0:29:10.493651) - from 2012-09-19 08:30:34 to 2012-09-19 09:00:58
| | | |
Time needed (in seconds) | Slow request start date |
| |
Time needed (human readable) Slow request end datePlease note that the “Time needed” info is machine computation time.AuthorsThis product was developed by RedTurtle Technology team.Changelog0.5 (2016-06-13)Display info about total count of catched LRR
[keul]Can now use-sand-eas a date string (no time needed)
[keul]0.4 (2012-12-06)added the--traceback-includeoption
[keul]0.3 (2012-11-15)Always display the start and end date of the request
(not only if-roption is given)
[keul]0.2 (2012-09-19)added the--keep-request-idoption
[keul]also store (and display if-roption is given) the start and end request time
[keul]0.1 (2012-04-27)First release |
zopemetadatamaker | Table of contentsMain ideazopemetadatamakerHow to useComplete list of optionsWhat to put in the .metadata contentChangelogMain ideaOldZope2products were heavily based onskinsresources. A lot of additional information for those
resources are taken from.metadatafile, so commonly if you have a:my_icon.gif…you will want to have also a:my_icon.gif.metadataIn old Zope/Plone installation (let me say “before Varnish begin to be a Plone standard”) you can use those
metadata for performing associations withHttpCacheobjects, making the user browser to perform some
cache of resources:[default]
title=my_icon.gif
cache=HTTPCachezopemetadatamakerThis product will install for you a new executable:zopemetadatamaker. Using this you can automatically create
your.metadatafiles. when you have a lot of static images, css and javascript files this can save you some times,
for example: you downloaded a big Javascript library with a lot of sub-directories inside and other related resources.How to useThe basic use of the command is something like this:zopemetadatamaker *.gifThis will create for you all “.metadata” related to all gif file found in the current directory. You need to know that:you must provide at least one filter pattersthe directory where files are searched is the current working directory (but you can customize this, see below).Complete list of optionsHere the full documentation:Usage: zopemetadatamaker [options] pattern [patterns]
Bulk creation of .metadata files for Zope skins resources
Options:
--version show program's version number and exit
-h, --help show this help message and exit
-c METADATA, --content=METADATA
choose a metadata text different from default; use
quoting for multiline input
-d, --default print default metadata (if --content is not provided),
then exit
-p PATHS, --path=PATHS
directories path where to look for metadata. You can
use this multiple times. Default is the current
working directory
--dry-run dry run, simply print what I would like to do
-f, --force force .metadata creation; if another one exists it
will be replaced
-r, --recursive search and create recursively inside subdirsWhat to put in the .metadata contentThe default metadata content is like this:[default]
title=%(filename)s
cache=HTTPCacheThe%(filename)ssection will be replaced with the original file name. You can use this, or omit it, when
defining you custom.metadata.I use this default content because it is the minimal “cache” information forPlone CMSstatic resouces.Changelog0.1.0 (2011-04-04)Initial release |
zope.mimetype | zope.mimetypeThis package provides a way to work with MIME content types. There
are several interfaces defined here, many of which are used primarily
to look things up based on different bits of information.See complete documentation athttps://zopemimetype.readthedocs.io/en/latest/Changes3.1 (2024-02-08)Add support for Python 3.12.3.0 (2023-02-27)Add support for Python 3.9, 3.10, 3.11.Drop support for Python 2.7, 3.5, 3.6.Drop support for deprecatedpython setup.py test.2.5.1 (2021-04-15)Fix test compatibility with zope.interface 5.4.2.5.0 (2020-03-30)Add support for Python 3.8.Drop support for Python 3.4.Ensure all objects have consistent interface resolution orders. Seeissue 17.2.4.0 (2018-10-16)Add support for Python 3.7.Fix DeprecationWarnings forIObjectEventandObjectEventby
importing them fromzope.interface.interfaces. Seeissue 14.2.3.2 (2018-07-30)Documentation was moved tohttps://zopemimetype.readthedocs.ioFix an AttributeError accessing thepreferredCharsetof anICodecTermwhen noICodecPreferredCharsetwas registered.Reach and automatically require 100% test coverage.2.3.1 (2018-01-09)Only try to register the browser stuff in the ZCA whenzope.formlibis
available as it breaks otherwise.2.3.0 (2017-09-28)Drop support for Python 3.3.Move the dependencies onzope.browser,zope.publisherandzope.formlib(only needed to use thesourceandwidgetmodules) into a newbrowserextra.
SeePR 8.2.2.0 (2017-04-24)Fixissue 6:typegetter.smartMimeTypeGuesserwould raiseTypeErroron Python 3
when the data wasbytesand thecontent_typewastext/html.Add support for Python 3.6.2.1.0 (2016-08-09)Add support for Python 3.5.Drop support for Python 2.6.Fix configuring the package via its included ZCML on Python 3.2.0.0 (2014-12-24)Add support for PyPy and PyPy3.Add support for Python 3.4.Restore the ability to writefrom zope.mimetype import types.Makeconfigure.zcmlrespect the renaming of thetypesmodule
so that it can be loaded.2.0.0a1 (2013-02-27)Add support for Python 3.3.Replace deprecatedzope.component.adaptsusage with equivalentzope.component.adapterdecorator.Replace deprecatedzope.interface.implementsusage with equivalentzope.interface.implementerdecorator.Renamezope.mimetype.typestozope.mimetype.mtypes.Drop support for Python 2.4 and 2.5.1.3.1 (2010-11-10)No longer dependg onzope.app.forminconfigure.zcmlby usingzope.formlibinstead, where the needed interfaces are living now.1.3.0 (2010-06-26)Add testing dependency onzope.component[test].Use zope.formlib instead of zope.app.form.browser for select widget.Conform to repository policy.1.2.0 (2009-12-26)Convert functional tests to unit tests and get rid of all extra test
dependencies as a result.Use the ITerms interface from zope.browser.Declare missing dependencies, resolved direct dependency on
zope.app.publisher.Import content-type parser fromzope.contenttype, adding a dependency on
that package.1.1.2 (2009-05-22)No longer depend onzope.app.component.1.1.1 (2009-04-03)Fix wrong package version (version1.1.0was released as0.4.0atpypibut as1.1devatdownload.zope.org/distribution)Fix author email and home page address.1.1.0 (2007-11-01)Package data update.First public release.1.0.0 (2007-??-??)Initial release. |
zope.minmax | zope.minmaxThis package provides support for homogeneous values favoring maximum
or minimum (e.g., numbers) for ZODB conflict resolution.Seehttps://zopeminmax.readthedocs.iofor a detailed description.Changes2.3 (2022-08-30)Drop support for Python 3.4.Add support for Python 3.7, 3.8, 3.9, 3.10.Make theAbstractValueclass public inzope.minmax. It was
already documented to be public.2.2.0 (2017-08-14)Add support for Python 3.5 and 3.6.Drop support for Python 2.6 and 3.3.Bring unit test coverage to 100% (including branches).Convert doctests to Sphinx documentation, including building docs
and running doctest snippets undertox.Host documentation athttps://zopeminmax.readthedocs.io2.1.0 (2014-12-27)Add support for PyPy3.Add support Python 3.4.2.0.0 (2013-02-19)Add support for Python 3.3 and PyPy.Replace deprecatedzope.interface.implementsusage with equivalentzope.interface.implementerdecorator.Drop support for Python 2.4 and 2.5.1.1.2 (2009-09-24)Use the standard Python doctest module instead of the deprecated
zope.testing.doctest.1.1.1 (2009-09-09)Fix homepage link and mailing list address.1.1 (2007-10-02)Refactor package setup.1.0 (2007-09-28)No further changes since 1.0b21.0b2 (2007-07-09)Remove_p_independentmethod fromAbstractValueclass.1.0b1 (2007-07-03)Initial release. |
zope.mkzeoinstance | zope.mkzeoinstanceThis package provides a single script,mkzeoinstance, which creates
a standalone ZEO server instance.Changelog5.1.1 (2023-05-05)Makeblob_dirparameter added in 5.1 optional.
(#18)5.1 (2023-04-28)Add configuration option-bresp.--blobsfor passing blob directory
path. (#16)5.0 (2023-02-09)Drop support for Python 2.7, 3.4, 3.5, 3.6.Add support for Python 3.7, 3.8, 3.9, 3.10, 3.11.Drop support for running tests usingpython setup.py test.4.1 (2017-05-26)Fix generatedrunzeoandzeoctlscripts to run with ZEO 5.4.0 (2017-02-28)100% unit test coverage.Drop support for Python 2.6.Add support for Python 3.4, 3.5, and 3.6.Move dependency fromZODB3-> [zdaemon,ZODB,ZEO].
Even though this package doesn’t actually import anything from the last
two, the generated instance won’t be usable unless the host python
has them installed.3.9.6 (2014-12-23)Add support for testing on Travis, and with tox.3.9.5 (2011-10-31)Place the socket used by thezeoctlcontrol process to conmmunicate
with itsrunzeodaemaon in$INSTANCE_HOME/var, instead of$INSTANCE_HOME/etc(which would idealy not be writable by the process).
See:https://bugs.launchpad.net/zope.mkzeoinstance/+bug/1759813.9.4 (2010-04-22)Rename the script / packagemkzeoinstanceto avoid clashing with the
script bundled with ZODB.Add an option to spell the host interface to be listened on, as well as
the port the generated ZEO server configuration. Thanks to Igor Stroh
for the patch. See:https://bugs.launchpad.net/zodb/+bug/143361Fix generated templates to cope with the move ofzdaemoncode into
its own project.Fork from the version of themkzeoinstscript contained in
ZODB 3.9.4. |
zope.modulealias | Module AliasingThis package enables the developer to make one module available under a
different path.CHANGES3.4.0 (2007-10-02)Initial release independent of the main Zope tree. |
zopen.frs | frs.core is a pure python package for a simple file repository system(FRS).
FRS use a virtual file system which map to the physical disk using a
configuration file. FRS support trash box, metadata and attachments storge,
caching and more.做什么定义了一套虚拟的文件路径系统,可和实际的存储路径映射,避免直接和操作系统的文件系统打交道支持版本管理,可存储文件的历史版本。存放到(.frs目录中)支持缓存/数据转换,比如图片的各种大小的 格式转换和存储,word文件的html预览转换和存储支持垃圾箱,删除的文件可自动存放在垃圾箱里面三级目录映射网站 (zpath) -> FRS (vpath)FRS (vpath) -> ospath (path)准备文件系统上的文件找到临时文件夹: /tmp/frs>>> import os, tempfile, shutil
>>> temp_dir = tempfile.gettempdir() + '/frs'
>>> if os.path.exists(temp_dir):
... shutil.rmtree(temp_dir)
>>> os.mkdir(temp_dir)创建缓存文件夹: /tmp/frscache>>> cache = temp_dir + '/frscache'
>>> os.mkdir(cache)创建文件夹结构:/tmp/frs/d1/f11
/tmp/frs/lala/d2/d21
/tmp/frs/lala/d2/f21
>>> d1 = temp_dir + '/d1'
>>> os.mkdir(d1)
>>> f11 = d1 + '/f11'
>>> open(f11, 'w').write('hello')
>>> lala = temp_dir + '/lala'
>>> os.mkdir(lala)
>>> d2 = lala + '/d2'
>>> os.mkdir(d2)
>>> f21 = d2 + '/f21'
>>> open(f21, 'w').write('hello')
>>> d21 = d2 + '/d21'
>>> os.mkdir(d21)初始化得到一个:>>> frs_root = FRS()什么都没有:>>> frs_root.listdir('/')
[]Now we can mount some paths to the top folders:>>> frs_root.mount('d1', d1)
>>> frs_root.mount('d2', d2)同时设置缓存目录>>> frs_root.setCacheRoot(cache)通过配置文件初始化上面很麻烦,通过配置文件更简单配置文件:>>> config = """
... [cache]
... path = /tmp/frscache
...
... [root]
... aa = /tmp/a
... bb = /tmp/b
...
... [site]
... / = /aa
... """加载:>>> from zopen.frs import loadFRSFromConfig
>>> frs_root = loadFRSFromConfig(config)基本的文件系统功能>>> sorted(frs_root.listdir('/'))
['d1', 'd2']
>>> frs_root.isdir('/d1')
True
>>> frs_root.listdir('/d1')
['f11']
>>> frs_root.isdir('/d1/f1')
False
>>> sorted(frs_root.listdir('/d2'))
['d21', 'f21']
>>> frs_root.open('/d2/f21').read()
'hello'现在还不能跨区移动!>>> frs_root.move('/d2/f21', '/d1')
Traceback (most recent call last):
...
Exception: ...自动映射其实配置文件中可以在site栏目中配置的。也可以手工配置:>>> frs_root.mapSitepath2Vpath(u'/site1/members', u'/d2')
>>> frs_root.mapSitepath2Vpath(u'/site2/members', u'/d2')
>>> frs_root.mapSitepath2Vpath(u'/', u'/d1')我们看看根据站点路径自动计算的路径:>>> frs_root.sitepath2Vpath('/58080_1/zopen/project/1222/files/uncategoried/aaa.doc')
u'/d1/58080_1/zopen/project/1222/files/uncategoried/aaa.doc'2个站点可以指向同一文件的:>>> frs_root.sitepath2Vpath('/site1/members/aaa.doc')
u'/d2/aaa.doc'
>>> frs_root.sitepath2Vpath('/site2/members/aaa.doc')
u'/d2/aaa.doc' |
zope.optionalextension | zope.optionalextensionREADMEThis package provides a distutils extension for building optional C
extensions. It is intended for use in projects which have a Python reference
implementation of one or more features, and which can function without
needing any C extensions to be successfully compiled.Using the Command with baredistutilsIn thesetup.pyfor your package:from distutils.core import setup
setup(name='your.package',
...
command_packages = ['zope.optionalextension',
'distutils.command',
]
...
)You need to ensure thatzope.optionalextensionis installed first
yourself.Using the Command with baresetuptoolsIn thesetup.pyfor your package:from setuptools import setup
setup(name='your.package',
...
setup_requires=['zope.optionalextension'],
command_packages=['zope.optionalextension',
'distutils.command',
]
...
)zope.optionalextensionChangelog1.1 (2010-07-03)Make the package work as a distutilscommand_packagesplugin.1.0 (2010-07-03)Extracted fromzope.i18nmessageid3.5.0. |
zope.outputchecker | Output CheckersThis package provides various output checkers to be used in doctests.OutputChecker: Extends and combines lxml’sLHTMLOutputCheckerand
zope.testing’sRENormalizingchecker.CHANGES1.0.0 (2013-03-06)Initial release on PyPI.Improved lxml-based HTML output checker with RE-normalizing support. |
zope.pagetemplate | zope.pagetemplatePage Templates provide an elegant templating mechanism that achieves a
clean separation of presentation and application logic while allowing
for designers to work with templates in their visual editing tools
(FrontPage, Dreamweaver, GoLive, etc.).Page Templates are based ona Template Attribute Languagewith expressions provided byTALES. For a description
of their syntax, seethe reference documentation.For detailed documentation on the usage of this package, seehttps://zopepagetemplate.readthedocs.ioChanges5.1 (2024-02-08)Add support for Python 3.12.5.0 (2023-02-07)Add support forzope.untrustedpythonon Python 3. With it, Python
expressions are now protected. It is activated using theuntrustedextra.Add support for Python 3.11.Drop support for Python 2.7, 3.5, 3.6.4.6.0 (2021-11-04)Avoid traceback reference cycle inPageTemplate._cook.Add support for Python 3.9 and 3.10.4.5.0 (2020-02-10)Add support for Python 3.8.Drop support for Python 3.4.4.4.1 (2018-10-16)Fix DeprecationWarnings forComponentLookupErrorby
importing them fromzope.interface.interfaces. Seeissue 17.4.4 (2018-10-05)Add support for Python 3.7.Host documentation athttps://zopepagetemplate.readthedocs.io/4.3.0 (2017-09-04)Add support for Python 3.5 and 3.6.Drop support for Python 2.6, 3.2 and 3.3.Certain internal test support objects in thetestspackage were
removed or modified.TheTraversableModuleImporterproperly turnsImportErrorintoTraversalError. Previously it was catchingKeyError,
which cannot be raised.Reach 100% code coverage and maintain it through automated testing.4.2.1 (2015-06-06)Add support for Python 3.2.4.2.0 (2015-06-02)Allow short-circuit traversal for non-proxied dict subclasses. See:https://github.com/zopefoundation/zope.pagetemplate/pull/3.Add support for PyPy / PyPy3.4.1.0 (2014-12-27)Add support for Python 3.4.Add support for testing on Travis.4.0.4 (2013-03-15)Ensure thatZopePythonExprandPythonExprare separate classes even
whenzope.untrustedpythonis not available. Fixes a ZCML conflict error
inzope.app.pagetemplate.4.0.3 (2013-02-28)Only allowzope.untrustedpythonto be a dependency in Python 2.Fix buildout to work properly.4.0.2 (2013-02-22)Migrate fromzope.security.untrustedpythontozope.untrustedpython.Makezope.untrustedpythonan extra dependency. Without it, python
expressions are not protected, even though path expressions are still
security wrapped.Add support for Python 3.3.4.0.1 (2012-01-23)LP#732972: PageTemplateTracebackSupplement no longer passescheck_macro_expansion=Falseto old templates which do not
accept this argument.4.0.0 (2012-12-13)Replace deprecatedzope.interface.classProvidesusage with equivalentzope.interface.providerdecorator.Replace deprecatedzope.interface.implementsusage with equivalentzope.interface.implementerdecorator.Drop support for Python 2.4 and 2.5.PageTemplate.pt_render() has a new argument,check_macro_expansion,
defaulting to True.PageTemplateTracebackSupplement passescheck_macro_expansion=False, to
avoid LP#732972.3.6.3 (2011-09-21)Fix test assertions to be compatible withzope.tal3.6.3.6.2 (2011-09-21)Change interface for engine and program such that the return type of
thecookmethod is a tuple(program, macros). This follows
the interface for the TAL parser’sgetCodemethod.Fixes a legacy compatibility issue where code would expect an_v_macrosvolatile attribute which was missing.3.6.1 (2011-08-23)Fix issue with missing default value forstrictinsert.3.6.0 (2011-08-20)Replace StringIO stream class with a faster list-based implementation.Abstract out the template engine and program interfaces and allow
implementation replacement via a utility registration.Remove ancient copyright from test files (LP: #607228)3.5.2 (2010-07-08)FixPTRuntimeErrorexception messages to be consistent across Python
versions, and compatibile with the output under Python 2.4. (More
readable than the previous output under Python 2.6 as well.)3.5.1 (2010-04-30)Remove use ofzope.testing.doctestunitin favor of stdlib’s doctest.Add dependency on “zope.security [untrustedpython]” because theenginemodule uses it.3.5.0 (2009-05-25)Add test coverage reporting support.Move ‘engine’ module and related test scaffolding here fromzope.app.pagetemplatepackage.3.4.2 (2009-03-17)Remove old zpkg-related DEPENDENCIES.cfg file.Change package’s mailing list address to zope-dev at zope.org, as
zope3-dev at zope.org is now retired.Changecheeseshoptopypiin the packages’ homepage url.3.4.1 (2009-01-27)Fix test due to recent changes in zope.tal.3.4.0 (2007-10-02)Initial release independent of the Zope 3 tree.3.2.0 (2006-01-05)Corresponds to the version of the zope.pagetemplate package shipped
as part of the Zope 3.2.0 release.ZPTPage macro expansion: changed label text to match the corresponding
label in Zope 2 and activated the name spaces for macro expansion
in ‘read’. Seehttp://www.zope.org/Collectors/Zope3-dev/199Coding style cleanups.3.1.0 (2005-10-03)Corresponds to the version of the zope.pagetemplate package shipped
as part of the Zope 3.1.0 release.Fixed apidoc and Cookie, which were using wrong descriptor class
(changed to ‘property’). Seehttp://www.zope.org/Collectors/Zope3-dev/387Documentation / style / testing cleanups.3.0.0 (2004-11-07)Corresponds to the version of the zope.pagetemplate package shipped
as part of the Zope X3.0.0 release. |
zope.password | zope.passwordThis package provides a password manager mechanism. Password manager
is an utility object that can encode and check encoded
passwords.Documentation is hosted athttps://zopepassword.readthedocs.io/Changes4.4 (2022-09-01)Add support for Python 3.7, 3.8, 3.9, 3.10.Drop support for Python 3.4.4.3.1 (2017-09-01)Fix runningconfigure.zcmlwhenzope.securityis installed.
Seeissue 15.4.3.0 (2017-08-31)Added abcrypt-based password manager (available only if thebcryptlibrary is
importable). This manager can also check passwords that were encoded
withz3c.bcrypt. If
that package isnotinstalled, thenconfigure.zcmlwill
install this manager as a utility with both theBCRYPT(preferred) andbcryptnames for compatibility with it. (Seehttps://github.com/zopefoundation/zope.password/issues/10)Add abcrypt_kdfpassword manager. This allows tunable numbers
of rounds. Seehttps://github.com/zopefoundation/zope.password/issues/9Fix thezpasswdconsole script on Python 3.Update thezpasswdscript to useargparseinstead ofoptparse.Usehmac.compare_digestwhen checking passwords to
prevent timing analysis. This requires Python 2.7.7 or above.Add support for Python 3.6.Drop support for Python 3.3 and Python 2.7.6 and below.Drop support forpython setup.py test.4.2.0 (2016-07-07)Drop support for Python 2.6.Converted documentation to Sphinx, including testing doctest snippets
undertox.Add support for Python 3.5.4.1.0 (2014-12-27)Add support for PyPy. (PyPy3 is pending release of a fix for:https://bitbucket.org/pypy/pypy/issue/1946)Add supprt for Python 3.4.Add support for testing on Travis.4.0.2 (2013-03-11)Fix some final resource warnings.4.0.1 (2013-03-10)Fix test failures under Python 3.3 when warnings are enabled.4.0.0 (2013-02-21)Makezpasswda proper console script entry point.Addtox.iniandMANIFEST.in.Add support for Python 3.3Replace deprecatedzope.interface.implementsusage with equivalentzope.interface.implementerdecorator.Drop support for Python 2.4 and 2.5.Add a newIMatchingPasswordManagerinterface with a ‘match’ method,
which returns True if a given password hash was encdoded with the scheme
implemented by the specific manager. All managers in this package implement
this interface.Use “{SHA}” as the prefix for SHA1-encoded passwords to be compatible with
RFC 2307, but support matching against “{SHA1}” for backwards compatibility.Add a crypt password manager to fully support all methods named in RFC 2307.
It is contained in thelegacymodule however, to flag crypt’s status.Add a SMD5 (salted MD5) password manager to fully support all encoding
schemes implemented by OpenLDAP.Add a MySQLPASSWORD()(versions before 4.1) password manager, as also
found in Zope2’sAccessControl.AuthEncodingmodule.Remove the useless, cosmetic salt from the MD5 and SHA1 password managers,
and use base64 encoding instead of hexdigests. This makes the output of
these managers compatible with other MD5 and SHA1 hash implementations such
as RFC 2307 but doesn’t lower it’s security in any way. Checking passwords
against old, still ‘salted’ password hashes with hexdigests is still
supported.Use thestandard_base64encodemethod instead ofurl_base64encodeto maintain compatibility with LDAP.3.6.1 (2010-05-27)The SSHAPasswordManager.checkPassword() would not handle unicode input
(even if the string would only contain ascii characters). Now, theencoded_passwordinput will be encoded to ascii, which is deemed safe
as it should not contain non-ascii characters anyway.3.6.0 (2010-05-07)Removezope.testingdependency for tests.Update some copyright headers to comply to repository policy.Addzpasswdscript formerly hold in zope.app.server. Contrary to
former zpasswd script, which used “Plain Text” as default password
manager, now SSHA is used as default.3.5.1 (2009-03-14)Make security protection directives inconfigure.zcmlexecute only
ifzope.securityis installed. This will allow reuse of theconfigure.zcmlfile in environments withoutzope.security,
for example withrepoze.zcml.Add “Password Manager Names” vocabulary for use withzope.schemaandzope.component, like it was inzope.app.authentication.
It’s an optional feature so it doesn’t add hard dependency. We use
“vocabulary” extra to list dependencies needed for vocabulary functionality.3.5.0 (2009-03-06)First release. This package was splitted off fromzope.app.authenticationto separate password manager functionality that is greatly re-usable without
any bit ofzope.app.authenticationand to reduce its dependencies. |
zope.paste | zope.paste allows you to deploy the Zope 3 application server on any
WSGI-capable webserver usingPasteDeploy.zope.paste allows you to run Zope 3 on any WSGI-capable webserver
software usingPasteDeploy. For this you will no longer need a Zope
3 instance (though you can still have one), you won’t configure Zope 3
throughzope.confand won’t start it usingrunzopeorzopectl.Configuring the applicationzope.paste provides aPasteDeploy-compatible factory for Zope 3’s
WSGI publisher application and registers it in an entry point. We can
therefore create a very simple Zope 3 application in aPasteDeployconfiguration file (e.g.paste.ini):[app:main]
use = egg:zope.paste
site_definition = /path/to/site.zcml
file_storage = /path/to/Data.fs
devmode = onIn this case,/path/to/site.zcmlrefers to asite.zcmlas
known from a Zope 3 instance. You can, for example, putpaste.iniinto an existing Zope 3 instance, next tosite.zcml.Configuring the ZODB databaseInstead of referring to a ZODB FileStorage using thefile_storagesetting, you can also configure multiple or other ZODB database
backends in a ZConfig-style configuration file (much likezope.conf), e.g. the following configures a ZEO client:<zodb>
<zeoclient>
server localhost:8100
storage 1
cache-size 20MB
</zeoclient>
</zodb>Refer to this file frompaste.inithis way (and delete thefile_storagesetting):db_definition = db.confConfiguring the serverIn order to be able to use our Zope application, we only need to add a
server definition. We can use the one that comes with Paste orPasteScript, rather:[server:main]
use = egg:PasteScript#wsgiutils
host = 127.0.0.1
port = 8080Now we can start the application using thepastercommand that
comes withPasteScript:$ paster serve paste.iniWSGI middlewares can be configured like described above or on thePasteDeploywebsite.Multiple WSGI applications within Zope 3If you wanted to hostmorethan one WSGI application there are a
couple ways of doing it:Using acomposite applicationas described inPasteDeploy.Setting up extraIServerTypeutilities.I’m going to show you how to do the latter now.The trick here is that you have the option to use both thezserverand thetwistedWSGI servers.zope.pasteis just glue code, so we
defined aIServerTypeutility for each, and the only thing special
is that the utility name is passed on to the WSGI application factory.Here’s an excerpt from theconfigure.zcmlas found on this package:<configure zcml:condition="have zserver">
<utility
name="Paste.Main"
component="._server.http"
provides="zope.app.server.servertype.IServerType"
/>
</configure>
<configure zcml:condition="have twisted">
<utility
name="Paste.Main"
component="._twisted.http"
provides="zope.app.twisted.interfaces.IServerType"
/>
</configure>Depending on which server is available, the rightIServerTypeutility is registered. You are encouraged to use the same pattern when
defining yours.So suppose you want to have a second WSGI application. Here’s how you
could do it.Create a newIServerTypeutility. This excerpt could be added to
aconfigure.zcmlin your own package, or to a standalone file inetc/package_includes:<configure zcml:condition="have zserver">
<utility
name="Paste.Another"
component="zope.paste._server.http"
provides="zope.app.server.servertype.IServerType"
/>
</configure>
<configure zcml:condition="have twisted">
<utility
name="Paste.Another"
component="zope.paste._twisted.http"
provides="zope.app.twisted.interfaces.IServerType"
/>
</configure>Change yourzope.conffile to define a new server, using the
newly-createdPaste.Anotherutility:<server>
type Paste.Main
address 8080
</server>
<server>
type Paste.Another
address 8180
</server>Define a WSGI applicationPaste.Anotherinpaste.ini:[pipeline:Paste.Main]
pipeline = xslt main
[app:main]
paste.app_factory = zope.paste.application:zope_publisher_app_factory
[filter:xslt]
paste.filter_factory = xslfilter:filter_factory
[app:Paste.Another]
paste.app_factory = zope.paste.application:zope_publisher_app_factoryChange History1.1.0 (2022-11-21)Add support for Python 3.6, 3.7, 3.8, 3.9, 3.10, 3.11.Drop support for Python 2.7 and 3.5.1.0.0 (2017-01-04)Changed support from Python 3.3 to 3.5.Dropped Python 2.6 support.1.0.0a1 (2013-02-27)Added support for Python 3.3.Dropped support for Python 2.4 and 2.5.Removed support for employing WSGI middlewares inside a Zope 3
application. Only the script-based server startup is now supported.Added a new console script to run a paste-configured WSGI server and
application.Conform to standard ZF project layout.Added license and copyright file. Also fixed copyright statement in file
headers.AddedMANIFEST.inandtox.ini.0.4 (2012-08-21)Add this changelog, reconstructed from svn logs and release dates on
PyPI.Support a ‘features’ config option in the PasteDeploy INI file, which
can contain a space-separated list of feature names. These can be
tested for in ZCML files with the <directivezcml:condition=”havefeaturename”> syntax.Previously the only feature that could be enabled was ‘devmode’ and
it had its own option. For backwards compatibility,devmode = onadds a ‘devmode’ feature to the feature list.0.3 (2007-06-02)Release as an egg with explicit dependencies for zope.app packages.Buildoutify the source tree.0.2 (2007-05-29)Extended documentation.Added a real PasteDeploy application factory. This allows you to run
Zope 3 on any WSGI capable server, without integration code.Support for devmode.Support multiple databases through a config file (specify db_definition
instead of file_storage).Accept filenames relative to the location of the PasteDeploy INI file.0.1 (2006-01-25)Initial release. |
zope.pluggableauth | zope.pluggableauthBased onzope.authentication, this package provides a flexible and
pluggable authentication utility, and provides a number of common plugins.Pluggable-Authentication UtilityThe Pluggable-Authentication Utility (PAU) provides a framework for
authenticating principals and associating information with them. It uses
plugins and subscribers to get its work done.For a pluggable-authentication utility to be used, it should be
registered as a utility providing thezope.authentication.interfaces.IAuthenticationinterface.AuthenticationThe primary job of PAU is to authenticate principals. It uses two types of
plug-ins in its work:Credentials PluginsAuthenticator PluginsCredentials plugins are responsible for extracting user credentials from a
request. A credentials plugin may in some cases issue a ‘challenge’ to obtain
credentials. For example, a ‘session’ credentials plugin reads credentials
from a session (the “extraction”). If it cannot find credentials, it will
redirect the user to a login form in order to provide them (the “challenge”).Authenticator plugins are responsible for authenticating the credentials
extracted by a credentials plugin. They are also typically able to create
principal objects for credentials they successfully authenticate.Given a request object, the PAU returns a principal object, if it can. The PAU
does this by first iterating through its credentials plugins to obtain a
set of credentials. If it gets credentials, it iterates through its
authenticator plugins to authenticate them.If an authenticator succeeds in authenticating a set of credentials, the PAU
uses the authenticator to create a principal corresponding to the credentials.
The authenticator notifies subscribers if an authenticated principal is
created. Subscribers are responsible for adding data, especially groups, to
the principal. Typically, if a subscriber adds data, it should also add
corresponding interface declarations.Simple Credentials PluginTo illustrate, we’ll create a simple credentials plugin:>>> from zope import interface
>>> from zope.pluggableauth.authentication import interfaces>>> @interface.implementer(interfaces.ICredentialsPlugin)
... class MyCredentialsPlugin(object):
...
... def extractCredentials(self, request):
... return request.get('credentials')
...
... def challenge(self, request):
... pass # challenge is a no-op for this plugin
...
... def logout(self, request):
... pass # logout is a no-op for this pluginAs a plugin, MyCredentialsPlugin needs to be registered as a named utility:>>> myCredentialsPlugin = MyCredentialsPlugin()
>>> provideUtility(myCredentialsPlugin, name='My Credentials Plugin')Simple Authenticator PluginNext we’ll create a simple authenticator plugin. For our plugin, we’ll need
an implementation of IPrincipalInfo:>>> @interface.implementer(interfaces.IPrincipalInfo)
... class PrincipalInfo(object):
...
... def __init__(self, id, title, description):
... self.id = id
... self.title = title
... self.description = description
...
... def __repr__(self):
... return 'PrincipalInfo(%r)' % self.idOur authenticator uses this type when it creates a principal info:>>> @interface.implementer(interfaces.IAuthenticatorPlugin)
... class MyAuthenticatorPlugin(object):
...
... def authenticateCredentials(self, credentials):
... if credentials == 'secretcode':
... return PrincipalInfo('bob', 'Bob', '')
...
... def principalInfo(self, id):
... pass # plugin not currently supporting searchAs with the credentials plugin, the authenticator plugin must be registered
as a named utility:>>> myAuthenticatorPlugin = MyAuthenticatorPlugin()
>>> provideUtility(myAuthenticatorPlugin, name='My Authenticator Plugin')Configuring a PAUFinally, we’ll create the PAU itself:>>> from zope.pluggableauth import authentication
>>> pau = authentication.PluggableAuthentication('xyz_')and configure it with the two plugins:>>> pau.credentialsPlugins = ('My Credentials Plugin', )
>>> pau.authenticatorPlugins = ('My Authenticator Plugin', )Using the PAU to Authenticate>>> from zope.pluggableauth.factories import AuthenticatedPrincipalFactory
>>> provideAdapter(AuthenticatedPrincipalFactory)We can now use the PAU to authenticate a sample request:>>> from zope.publisher.browser import TestRequest
>>> print(pau.authenticate(TestRequest()))
NoneIn this case, we cannot authenticate an empty request. In the same way, we
will not be able to authenticate a request with the wrong credentials:>>> print(pau.authenticate(TestRequest(credentials='let me in!')))
NoneHowever, if we provide the proper credentials:>>> request = TestRequest(credentials='secretcode')
>>> principal = pau.authenticate(request)
>>> principal
Principal('xyz_bob')we get an authenticated principal.Multiple Authenticator PluginsThe PAU works with multiple authenticator plugins. It uses each plugin, in the
order specified in the PAU’s authenticatorPlugins attribute, to authenticate
a set of credentials.To illustrate, we’ll create another authenticator:>>> class MyAuthenticatorPlugin2(MyAuthenticatorPlugin):
...
... def authenticateCredentials(self, credentials):
... if credentials == 'secretcode':
... return PrincipalInfo('black', 'Black Spy', '')
... elif credentials == 'hiddenkey':
... return PrincipalInfo('white', 'White Spy', '')>>> provideUtility(MyAuthenticatorPlugin2(), name='My Authenticator Plugin 2')If we put it before the original authenticator:>>> pau.authenticatorPlugins = (
... 'My Authenticator Plugin 2',
... 'My Authenticator Plugin')Then it will be given the first opportunity to authenticate a request:>>> pau.authenticate(TestRequest(credentials='secretcode'))
Principal('xyz_black')If neither plugins can authenticate, pau returns None:>>> print(pau.authenticate(TestRequest(credentials='let me in!!')))
NoneWhen we change the order of the authenticator plugins:>>> pau.authenticatorPlugins = (
... 'My Authenticator Plugin',
... 'My Authenticator Plugin 2')we see that our original plugin is now acting first:>>> pau.authenticate(TestRequest(credentials='secretcode'))
Principal('xyz_bob')The second plugin, however, gets a chance to authenticate if first does not:>>> pau.authenticate(TestRequest(credentials='hiddenkey'))
Principal('xyz_white')Multiple Credentials PluginsAs with with authenticators, we can specify multiple credentials plugins. To
illustrate, we’ll create a credentials plugin that extracts credentials from
a request form:>>> @interface.implementer(interfaces.ICredentialsPlugin)
... class FormCredentialsPlugin:
...
... def extractCredentials(self, request):
... return request.form.get('my_credentials')
...
... def challenge(self, request):
... pass
...
... def logout(request):
... pass>>> provideUtility(FormCredentialsPlugin(),
... name='Form Credentials Plugin')and insert the new credentials plugin before the existing plugin:>>> pau.credentialsPlugins = (
... 'Form Credentials Plugin',
... 'My Credentials Plugin')The PAU will use each plugin in order to try and obtain credentials from a
request:>>> pau.authenticate(TestRequest(credentials='secretcode',
... form={'my_credentials': 'hiddenkey'}))
Principal('xyz_white')In this case, the first credentials plugin succeeded in getting credentials
from the form and the second authenticator was able to authenticate the
credentials. Specifically, the PAU went through these steps:Get credentials using ‘Form Credentials Plugin’Got ‘hiddenkey’ credentials using ‘Form Credentials Plugin’, try to
authenticate using ‘My Authenticator Plugin’Failed to authenticate ‘hiddenkey’ with ‘My Authenticator Plugin’, try
‘My Authenticator Plugin 2’Succeeded in authenticating with ‘My Authenticator Plugin 2’Let’s try a different scenario:>>> pau.authenticate(TestRequest(credentials='secretcode'))
Principal('xyz_bob')In this case, the PAU went through these steps:- Get credentials using 'Form Credentials Plugin'Failed to get credentials using ‘Form Credentials Plugin’, try
‘My Credentials Plugin’Got ‘scecretcode’ credentials using ‘My Credentials Plugin’, try to
authenticate using ‘My Authenticator Plugin’Succeeded in authenticating with ‘My Authenticator Plugin’Let’s try a slightly more complex scenario:>>> pau.authenticate(TestRequest(credentials='hiddenkey',
... form={'my_credentials': 'bogusvalue'}))
Principal('xyz_white')This highlights PAU’s ability to use multiple plugins for authentication:Get credentials using ‘Form Credentials Plugin’Got ‘bogusvalue’ credentials using ‘Form Credentials Plugin’, try to
authenticate using ‘My Authenticator Plugin’Failed to authenticate ‘boguskey’ with ‘My Authenticator Plugin’, try
‘My Authenticator Plugin 2’Failed to authenticate ‘boguskey’ with ‘My Authenticator Plugin 2’ –
there are no more authenticators to try, so lets try the next credentials
plugin for some new credentialsGet credentials using ‘My Credentials Plugin’Got ‘hiddenkey’ credentials using ‘My Credentials Plugin’, try to
authenticate using ‘My Authenticator Plugin’Failed to authenticate ‘hiddenkey’ using ‘My Authenticator Plugin’, try
‘My Authenticator Plugin 2’Succeeded in authenticating with ‘My Authenticator Plugin 2’ (shouts and
cheers!)Multiple Authenticator PluginsAs with the other operations we’ve seen, the PAU uses multiple plugins to
find a principal. If the first authenticator plugin can’t find the requested
principal, the next plugin is used, and so on.>>> @interface.implementer(interfaces.IAuthenticatorPlugin)
... class AnotherAuthenticatorPlugin:
...
... def __init__(self):
... self.infos = {}
... self.ids = {}
...
... def principalInfo(self, id):
... return self.infos.get(id)
...
... def authenticateCredentials(self, credentials):
... id = self.ids.get(credentials)
... if id is not None:
... return self.infos[id]
...
... def add(self, id, title, description, credentials):
... self.infos[id] = PrincipalInfo(id, title, description)
... self.ids[credentials] = idTo illustrate, we’ll create and register two authenticators:>>> authenticator1 = AnotherAuthenticatorPlugin()
>>> provideUtility(authenticator1, name='Authentication Plugin 1')>>> authenticator2 = AnotherAuthenticatorPlugin()
>>> provideUtility(authenticator2, name='Authentication Plugin 2')and add a principal to them:>>> authenticator1.add('bob', 'Bob', 'A nice guy', 'b0b')
>>> authenticator1.add('white', 'White Spy', 'Sneaky', 'deathtoblack')
>>> authenticator2.add('black', 'Black Spy', 'Also sneaky', 'deathtowhite')When we configure the PAU to use both searchable authenticators (note the
order):>>> pau.authenticatorPlugins = (
... 'Authentication Plugin 2',
... 'Authentication Plugin 1')we register the factories for our principals:>>> from zope.pluggableauth.factories import FoundPrincipalFactory
>>> provideAdapter(FoundPrincipalFactory)we see how the PAU uses both plugins:>>> pau.getPrincipal('xyz_white')
Principal('xyz_white')>>> pau.getPrincipal('xyz_black')
Principal('xyz_black')If more than one plugin know about the same principal ID, the first plugin is
used and the remaining are not delegated to. To illustrate, we’ll add
another principal with the same ID as an existing principal:>>> authenticator2.add('white', 'White Rider', '', 'r1der')
>>> pau.getPrincipal('xyz_white').title
'White Rider'If we change the order of the plugins:>>> pau.authenticatorPlugins = (
... 'Authentication Plugin 1',
... 'Authentication Plugin 2')we get a different principal for ID ‘white’:>>> pau.getPrincipal('xyz_white').title
'White Spy'Issuing a ChallengePart of PAU’s IAuthentication contract is to challenge the user for
credentials when its ‘unauthorized’ method is called. The need for this
functionality is driven by the following use case:A user attempts to perform an operation he is not authorized to perform.A handler responds to the unauthorized error by calling IAuthentication
‘unauthorized’.The authentication component (in our case, a PAU) issues a challenge to
the user to collect new credentials (typically in the form of logging in
as a new user).The PAU handles the credentials challenge by delegating to its credentials
plugins.Currently, the PAU is configured with the credentials plugins that don’t
perform any action when asked to challenge (see above the ‘challenge’ methods).To illustrate challenges, we’ll subclass an existing credentials plugin and
do something in its ‘challenge’:>>> class LoginFormCredentialsPlugin(FormCredentialsPlugin):
...
... def __init__(self, loginForm):
... self.loginForm = loginForm
...
... def challenge(self, request):
... request.response.redirect(self.loginForm)
... return TrueThis plugin handles a challenge by redirecting the response to a login form.
It returns True to signal to the PAU that it handled the challenge.We will now create and register a couple of these plugins:>>> provideUtility(LoginFormCredentialsPlugin('simplelogin.html'),
... name='Simple Login Form Plugin')>>> provideUtility(LoginFormCredentialsPlugin('advancedlogin.html'),
... name='Advanced Login Form Plugin')and configure the PAU to use them:>>> pau.credentialsPlugins = (
... 'Simple Login Form Plugin',
... 'Advanced Login Form Plugin')Now when we call ‘unauthorized’ on the PAU:>>> request = TestRequest()
>>> pau.unauthorized(id=None, request=request)we see that the user is redirected to the simple login form:>>> request.response.getStatus()
302
>>> request.response.getHeader('location')
'simplelogin.html'We can change the challenge policy by reordering the plugins:>>> pau.credentialsPlugins = (
... 'Advanced Login Form Plugin',
... 'Simple Login Form Plugin')Now when we call ‘unauthorized’:>>> request = TestRequest()
>>> pau.unauthorized(id=None, request=request)the advanced plugin is used because it’s first:>>> request.response.getStatus()
302
>>> request.response.getHeader('location')
'advancedlogin.html'Challenge ProtocolsSometimes, we want multiple challengers to work together. For example, the
HTTP specification allows multiple challenges to be issued in a response. A
challenge plugin can provide achallengeProtocolattribute that effectively
groups related plugins together for challenging. If a plugin returnsTruefrom its challenge and provides a non-None challengeProtocol, subsequent
plugins in the credentialsPlugins list that have the same challenge protocol
will also be used to challenge.Without a challengeProtocol, only the first plugin to succeed in a challenge
will be used.Let’s look at an example. We’ll define a new plugin that specifies an
‘X-Challenge’ protocol:>>> class XChallengeCredentialsPlugin(FormCredentialsPlugin):
...
... challengeProtocol = 'X-Challenge'
...
... def __init__(self, challengeValue):
... self.challengeValue = challengeValue
...
... def challenge(self, request):
... value = self.challengeValue
... existing = request.response.getHeader('X-Challenge', '')
... if existing:
... value += ' ' + existing
... request.response.setHeader('X-Challenge', value)
... return Trueand register a couple instances as utilities:>>> provideUtility(XChallengeCredentialsPlugin('basic'),
... name='Basic X-Challenge Plugin')>>> provideUtility(XChallengeCredentialsPlugin('advanced'),
... name='Advanced X-Challenge Plugin')When we use both plugins with the PAU:>>> pau.credentialsPlugins = (
... 'Basic X-Challenge Plugin',
... 'Advanced X-Challenge Plugin')and call ‘unauthorized’:>>> request = TestRequest()
>>> pau.unauthorized(None, request)we see that both plugins participate in the challenge, rather than just the
first plugin:>>> request.response.getHeader('X-Challenge')
'advanced basic'Pluggable-Authentication PrefixesPrincipal ids are required to be unique system wide. Plugins will often provide
options for providing id prefixes, so that different sets of plugins provide
unique ids within a PAU. If there are multiple pluggable-authentication
utilities in a system, it’s a good idea to give each PAU a unique prefix, so
that principal ids from different PAUs don’t conflict. We can provide a prefix
when a PAU is created:>>> pau = authentication.PluggableAuthentication('mypau_')
>>> pau.credentialsPlugins = ('My Credentials Plugin', )
>>> pau.authenticatorPlugins = ('My Authenticator Plugin', )When we create a request and try to authenticate:>>> pau.authenticate(TestRequest(credentials='secretcode'))
Principal('mypau_bob')Note that now, our principal’s id has the pluggable-authentication
utility prefix.We can still lookup a principal, as long as we supply the prefix:>> pau.getPrincipal('mypas_42')
Principal('mypas_42', "{'domain': 42}")
>> pau.getPrincipal('mypas_41')
OddPrincipal('mypas_41', "{'int': 41}")Principal FolderPrincipal folders contain principal-information objects that contain principal
information. We create an internal principal using theInternalPrincipalclass:>>> from zope.pluggableauth.plugins.principalfolder import InternalPrincipal
>>> p1 = InternalPrincipal('login1', '123', "Principal 1",
... passwordManagerName="SHA1")
>>> p2 = InternalPrincipal('login2', '456', "The Other One")and add them to a principal folder:>>> from zope.pluggableauth.plugins.principalfolder import PrincipalFolder
>>> principals = PrincipalFolder('principal.')
>>> principals['p1'] = p1
>>> principals['p2'] = p2AuthenticationPrincipal folders provide theIAuthenticatorPlugininterface. When we
provide suitable credentials:>>> from pprint import pprint
>>> principals.authenticateCredentials({'login': 'login1', 'password': '123'})
PrincipalInfo('principal.p1')We get back a principal id and supplementary information, including the
principal title and description. Note that the principal id is a concatenation
of the principal-folder prefix and the name of the principal-information object
within the folder.None is returned if the credentials are invalid:>>> principals.authenticateCredentials({'login': 'login1',
... 'password': '1234'})
>>> principals.authenticateCredentials(42)SearchPrincipal folders also provide the IQuerySchemaSearch interface. This
supports both finding principal information based on their ids:>>> principals.principalInfo('principal.p1')
PrincipalInfo('principal.p1')>>> principals.principalInfo('p1')and searching for principals based on a search string:>>> list(principals.search({'search': 'other'}))
['principal.p2']>>> list(principals.search({'search': 'OTHER'}))
['principal.p2']>>> list(principals.search({'search': ''}))
['principal.p1', 'principal.p2']>>> list(principals.search({'search': 'eek'}))
[]>>> list(principals.search({}))
[]If there are a large number of matches:>>> for i in range(20):
... i = str(i)
... p = InternalPrincipal('l'+i, i, "Dude "+i)
... principals[i] = p>>> pprint(list(principals.search({'search': 'D'})), width=25)
['principal.0',
'principal.1',
'principal.10',
'principal.11',
'principal.12',
'principal.13',
'principal.14',
'principal.15',
'principal.16',
'principal.17',
'principal.18',
'principal.19',
'principal.2',
'principal.3',
'principal.4',
'principal.5',
'principal.6',
'principal.7',
'principal.8',
'principal.9']We can use batching parameters to specify a subset of results:>>> pprint(list(principals.search({'search': 'D'}, start=17)))
['principal.7', 'principal.8', 'principal.9']>>> pprint(list(principals.search({'search': 'D'}, batch_size=5)), width=60)
['principal.0',
'principal.1',
'principal.10',
'principal.11',
'principal.12']>>> pprint(list(principals.search({'search': 'D'}, start=5, batch_size=5)),
... width=25)
['principal.13',
'principal.14',
'principal.15',
'principal.16',
'principal.17']There is an additional method that allows requesting the principal id
associated with a login id. The method raises KeyError when there is
no associated principal:>>> principals.getIdByLogin("not-there")
Traceback (most recent call last):
KeyError: 'not-there'If there is a matching principal, the id is returned:>>> principals.getIdByLogin("login1")
'principal.p1'Changing credentialsCredentials can be changed by modifying principal-information objects:>>> p1.login = 'bob'
>>> p1.password = 'eek'>>> principals.authenticateCredentials({'login': 'bob', 'password': 'eek'})
PrincipalInfo('principal.p1')>>> principals.authenticateCredentials({'login': 'login1',
... 'password': 'eek'})>>> principals.authenticateCredentials({'login': 'bob',
... 'password': '123'})It is an error to try to pick a login name that is already taken:>>> p1.login = 'login2'
Traceback (most recent call last):
...
ValueError: Principal Login already taken!If such an attempt is made, the data are unchanged:>>> principals.authenticateCredentials({'login': 'bob', 'password': 'eek'})
PrincipalInfo('principal.p1')Removing principalsOf course, if a principal is removed, we can no-longer authenticate it:>>> del principals['p1']
>>> principals.authenticateCredentials({'login': 'bob',
... 'password': 'eek'})Group FoldersGroup folders provide support for groups information stored in the ZODB. They
are persistent, and must be contained within the PAUs that use them.Like other principals, groups are created when they are needed.Group folders contain group-information objects that contain group information.
We create group information using theGroupInformationclass:>>> import zope.pluggableauth.plugins.groupfolder
>>> g1 = zope.pluggableauth.plugins.groupfolder.GroupInformation("Group 1")>>> groups = zope.pluggableauth.plugins.groupfolder.GroupFolder('group.')
>>> groups['g1'] = g1Note that when group-info is added, a GroupAdded event is generated:>>> from zope.pluggableauth import interfaces
>>> from zope.component.eventtesting import getEvents
>>> getEvents(interfaces.IGroupAdded)
[<GroupAdded 'group.g1'>]Groups are defined with respect to an authentication service. Groups
must be accessible via an authentication service and can contain
principals accessible via an authentication service.To illustrate the group interaction with the authentication service,
we’ll create a sample authentication service:>>> from zope import interface
>>> from zope.authentication.interfaces import IAuthentication
>>> from zope.authentication.interfaces import PrincipalLookupError
>>> from zope.security.interfaces import IGroupAwarePrincipal
>>> from zope.pluggableauth.plugins.groupfolder import setGroupsForPrincipal>>> @interface.implementer(IGroupAwarePrincipal)
... class Principal:
... def __init__(self, id, title='', description=''):
... self.id, self.title, self.description = id, title, description
... self.groups = []>>> class PrincipalCreatedEvent:
... def __init__(self, authentication, principal):
... self.authentication = authentication
... self.principal = principal>>> from zope.pluggableauth.plugins import principalfolder>>> @interface.implementer(IAuthentication)
... class Principals:
... def __init__(self, groups, prefix='auth.'):
... self.prefix = prefix
... self.principals = {
... 'p1': principalfolder.PrincipalInfo('p1', '', '', ''),
... 'p2': principalfolder.PrincipalInfo('p2', '', '', ''),
... 'p3': principalfolder.PrincipalInfo('p3', '', '', ''),
... 'p4': principalfolder.PrincipalInfo('p4', '', '', ''),
... }
... self.groups = groups
... groups.__parent__ = self
...
... def getAuthenticatorPlugins(self):
... return [('principals', self.principals), ('groups', self.groups)]
...
... def getPrincipal(self, id):
... if not id.startswith(self.prefix):
... raise PrincipalLookupError(id)
... id = id[len(self.prefix):]
... info = self.principals.get(id)
... if info is None:
... info = self.groups.principalInfo(id)
... if info is None:
... raise PrincipalLookupError(id)
... principal = Principal(self.prefix+info.id,
... info.title, info.description)
... setGroupsForPrincipal(PrincipalCreatedEvent(self, principal))
... return principalThis class doesn’t really implement the fullIAuthenticationinterface, but
it implements thegetPrincipalmethod used by groups. It works very much
like the pluggable authentication utility. It creates principals on demand. It
callssetGroupsForPrincipal, which is normally called as an event subscriber,
when principals are created. In order forsetGroupsForPrincipalto find out
group folder, we have to register it as a utility:>>> from zope.pluggableauth.interfaces import IAuthenticatorPlugin
>>> from zope.component import provideUtility
>>> provideUtility(groups, IAuthenticatorPlugin)We will create and register a new principals utility:>>> principals = Principals(groups)
>>> provideUtility(principals, IAuthentication)Now we can set the principals on the group:>>> g1.principals = ['auth.p1', 'auth.p2']
>>> g1.principals
('auth.p1', 'auth.p2')Adding principals fires an event.>>> getEvents(interfaces.IPrincipalsAddedToGroup)[-1]
<PrincipalsAddedToGroup ['auth.p1', 'auth.p2'] 'auth.group.g1'>We can now look up groups for the principals:>>> groups.getGroupsForPrincipal('auth.p1')
('group.g1',)Note that the group id is a concatenation of the group-folder prefix
and the name of the group-information object within the folder.If we delete a group:>>> del groups['g1']then the groups folder loses the group information for that group’s
principals:>>> groups.getGroupsForPrincipal('auth.p1')
()but the principal information on the group is unchanged:>>> g1.principals
('auth.p1', 'auth.p2')It also fires an event showing that the principals are removed from the group
(g1 is group information, not a zope.security.interfaces.IGroup).>>> getEvents(interfaces.IPrincipalsRemovedFromGroup)[-1]
<PrincipalsRemovedFromGroup ['auth.p1', 'auth.p2'] 'auth.group.g1'>Adding the group sets the folder principal information. Let’s use a
different group name:>>> groups['G1'] = g1>>> groups.getGroupsForPrincipal('auth.p1')
('group.G1',)Here we see that the new name is reflected in the group information.An event is fired, as usual.>>> getEvents(interfaces.IPrincipalsAddedToGroup)[-1]
<PrincipalsAddedToGroup ['auth.p1', 'auth.p2'] 'auth.group.G1'>In terms of member events (principals added and removed from groups), we have
now seen that events are fired when a group information object is added and
when it is removed from a group folder; and we have seen that events are fired
when a principal is added to an already-registered group. Events are also
fired when a principal is removed from an already-registered group. Let’s
quickly see some more examples.>>> g1.principals = ('auth.p1', 'auth.p3', 'auth.p4')
>>> getEvents(interfaces.IPrincipalsAddedToGroup)[-1]
<PrincipalsAddedToGroup ['auth.p3', 'auth.p4'] 'auth.group.G1'>
>>> getEvents(interfaces.IPrincipalsRemovedFromGroup)[-1]
<PrincipalsRemovedFromGroup ['auth.p2'] 'auth.group.G1'>
>>> g1.principals = ('auth.p1', 'auth.p2')
>>> getEvents(interfaces.IPrincipalsAddedToGroup)[-1]
<PrincipalsAddedToGroup ['auth.p2'] 'auth.group.G1'>
>>> getEvents(interfaces.IPrincipalsRemovedFromGroup)[-1]
<PrincipalsRemovedFromGroup ['auth.p3', 'auth.p4'] 'auth.group.G1'>Groups can contain groups:>>> g2 = zope.pluggableauth.plugins.groupfolder.GroupInformation("Group Two")
>>> groups['G2'] = g2
>>> g2.principals = ['auth.group.G1']>>> groups.getGroupsForPrincipal('auth.group.G1')
('group.G2',)>>> old = getEvents(interfaces.IPrincipalsAddedToGroup)[-1]
>>> old
<PrincipalsAddedToGroup ['auth.group.G1'] 'auth.group.G2'>Groups cannot contain cycles:>>> g1.principals = ('auth.p1', 'auth.p2', 'auth.group.G2')
... # doctest: +NORMALIZE_WHITESPACE
Traceback (most recent call last):
...
zope.pluggableauth.plugins.groupfolder.GroupCycle: ('auth.group.G2', ['auth.group.G2', 'auth.group.G1'])Trying to do so does not fire an event.>>> getEvents(interfaces.IPrincipalsAddedToGroup)[-1] is old
TrueThey need not be hierarchical:>>> ga = zope.pluggableauth.plugins.groupfolder.GroupInformation("Group A")
>>> groups['GA'] = ga>>> gb = zope.pluggableauth.plugins.groupfolder.GroupInformation("Group B")
>>> groups['GB'] = gb
>>> gb.principals = ['auth.group.GA']>>> gc = zope.pluggableauth.plugins.groupfolder.GroupInformation("Group C")
>>> groups['GC'] = gc
>>> gc.principals = ['auth.group.GA']>>> gd = zope.pluggableauth.plugins.groupfolder.GroupInformation("Group D")
>>> groups['GD'] = gd
>>> gd.principals = ['auth.group.GA', 'auth.group.GB']>>> ga.principals = ['auth.p1']Group folders provide a very simple search interface. They perform
simple string searches on group titles and descriptions.>>> list(groups.search({'search': 'gro'})) # doctest: +NORMALIZE_WHITESPACE
['group.G1', 'group.G2',
'group.GA', 'group.GB', 'group.GC', 'group.GD']>>> list(groups.search({'search': 'two'}))
['group.G2']They also support batching:>>> list(groups.search({'search': 'gro'}, 2, 3))
['group.GA', 'group.GB', 'group.GC']If you don’t supply a search key, no results will be returned:>>> list(groups.search({}))
[]Identifying groupsThe function,setGroupsForPrincipal, is a subscriber to
principal-creation events. It adds any group-folder-defined groups to
users in those groups:>>> principal = principals.getPrincipal('auth.p1')>>> principal.groups
['auth.group.G1', 'auth.group.GA']Of course, this applies to groups too:>>> principal = principals.getPrincipal('auth.group.G1')
>>> principal.id
'auth.group.G1'>>> principal.groups
['auth.group.G2']In addition to setting principal groups, thesetGroupsForPrincipalfunction also declares theIGroupinterface on groups:>>> [iface.__name__ for iface in interface.providedBy(principal)]
['IGroup', 'IGroupAwarePrincipal']>>> [iface.__name__
... for iface in interface.providedBy(principals.getPrincipal('auth.p1'))]
['IGroupAwarePrincipal']Special groupsTwo special groups, Authenticated, and Everyone may apply to users
created by the pluggable-authentication utility. There is a
subscriber, specialGroups, that will set these groups on any non-group
principals if IAuthenticatedGroup, or IEveryoneGroup utilities are
provided.Lets define a group-aware principal:>>> import zope.security.interfaces
>>> @interface.implementer(zope.security.interfaces.IGroupAwarePrincipal)
... class GroupAwarePrincipal(Principal):
... def __init__(self, id):
... Principal.__init__(self, id)
... self.groups = []If we notify the subscriber with this principal, nothing will happen
because the groups haven’t been defined:>>> prin = GroupAwarePrincipal('x')
>>> event = interfaces.FoundPrincipalCreated(42, prin, {})
>>> zope.pluggableauth.plugins.groupfolder.specialGroups(event)
>>> prin.groups
[]Now, if we define the Everybody group:>>> import zope.authentication.interfaces
>>> @interface.implementer(zope.authentication.interfaces.IEveryoneGroup)
... class EverybodyGroup(Principal):
... pass>>> everybody = EverybodyGroup('all')
>>> provideUtility(everybody, zope.authentication.interfaces.IEveryoneGroup)Then the group will be added to the principal:>>> zope.pluggableauth.plugins.groupfolder.specialGroups(event)
>>> prin.groups
['all']Similarly for the authenticated group:>>> @interface.implementer(
... zope.authentication.interfaces.IAuthenticatedGroup)
... class AuthenticatedGroup(Principal):
... pass>>> authenticated = AuthenticatedGroup('auth')
>>> provideUtility(authenticated, zope.authentication.interfaces.IAuthenticatedGroup)Then the group will be added to the principal:>>> prin.groups = []
>>> zope.pluggableauth.plugins.groupfolder.specialGroups(event)
>>> prin.groups.sort()
>>> prin.groups
['all', 'auth']These groups are only added to non-group principals:>>> prin.groups = []
>>> interface.directlyProvides(prin, zope.security.interfaces.IGroup)
>>> zope.pluggableauth.plugins.groupfolder.specialGroups(event)
>>> prin.groups
[]And they are only added to group aware principals:>>> @interface.implementer(zope.security.interfaces.IPrincipal)
... class SolitaryPrincipal:
... id = title = description = ''>>> event = interfaces.FoundPrincipalCreated(42, SolitaryPrincipal(), {})
>>> zope.pluggableauth.plugins.groupfolder.specialGroups(event)
>>> prin.groups
[]Member-aware groupsThe groupfolder includes a subscriber that gives group principals the
zope.security.interfaces.IGroupAware interface and an implementation thereof.
This allows groups to be able to get and set their members.Given an info object and a group…>>> @interface.implementer(
... zope.pluggableauth.plugins.groupfolder.IGroupInformation)
... class DemoGroupInformation(object):
... def __init__(self, title, description, principals):
... self.title = title
... self.description = description
... self.principals = principals
...
>>> i = DemoGroupInformation(
... 'Managers', 'Taskmasters', ('joe', 'jane'))
...
>>> info = zope.pluggableauth.plugins.groupfolder.GroupInfo(
... 'groups.managers', i)
>>> @interface.implementer(IGroupAwarePrincipal)
... class DummyGroup(object):
... def __init__(self, id, title='', description=''):
... self.id = id
... self.title = title
... self.description = description
... self.groups = []
...
>>> principal = DummyGroup('foo')
>>> zope.security.interfaces.IMemberAwareGroup.providedBy(principal)
False…when you call the subscriber, it adds the two pseudo-methods to the
principal and makes the principal provide the IMemberAwareGroup interface.>>> zope.pluggableauth.plugins.groupfolder.setMemberSubscriber(
... interfaces.FoundPrincipalCreated(
... 'dummy auth (ignored)', principal, info))
>>> principal.getMembers()
('joe', 'jane')
>>> principal.setMembers(('joe', 'jane', 'jaimie'))
>>> principal.getMembers()
('joe', 'jane', 'jaimie')
>>> zope.security.interfaces.IMemberAwareGroup.providedBy(principal)
TrueThe two methods work with the value on the IGroupInformation object.>>> i.principals == principal.getMembers()
TrueLimitationThe current group-folder design has an important limitation!There is no point in assigning principals to a group
from a group folder unless the principal is from the same pluggable
authentication utility.If a principal is from a higher authentication utility, the user
will not get the group definition. Why? Because the principals
group assignments are set when the principal is authenticated. At
that point, the current site is the site containing the principal
definition. Groups defined in lower sites will not be consulted,It is impossible to assign users from lower authentication
utilities because they can’t be seen when managing the group,
from the site containing the group.A better design might be to store user-role assignments independent of
the group definitions and to look for assignments during (url)
traversal. This could get quite complex though.While it is possible to have multiple authentication utilities long a
URL path, it is generally better to stick to a simpler model in which
there is only one authentication utility along a URL path (in addition
to the global utility, which is used for bootstrapping purposes).Changes3.0 (2023-02-14)Add support for Python 3.8, 3.9, 3.10, 3.11.Drop support for Python 2.7, 3.5, 3.6.Drop support for deprecatedpython setup.py test.2.3.1 (2021-03-19)Drop support for Python 3.4.Add support for Python 3.7.Import from zope.interface.interfaces to avoid deprecation warning.2.3.0 (2017-11-12)Drop support for Python 3.3.2.2.0 (2017-05-02)Add support for Python 3.6.Fix a NameError in the idpicker under Python 3.6.
Seeissue 7.2.1.0 (2016-07-04)Add support for Python 3.5.Drop support for Python 2.6.2.0.0 (2014-12-24)Add support for Python 3.4.Refactorzope.pluggableauth.plugins.session.redirectWithComeFrominto a reusable function.Fix: allow password containing colon(s) in HTTP basic authentication
credentials extraction plug-in, to conform with RFC26172.0.0a1 (2013-02-21)Addtox.iniandMANIFEST.in.Add support for Python 3.3.Replace deprecatedzope.component.adaptsusage with equivalentzope.component.adapterdecorator.Replace deprecatedzope.interface.implementsusage with equivalentzope.interface.implementerdecorator.Drop support for Python 2.4 and 2.5.1.3 (2011-02-08)As thecamefrominformation is most probably used for a redirect,
require it to be an absolute URL (see alsohttp://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.30).1.2 (2010-12-16)Add a hook toSessionCredentialsPlugin(_makeCredentials) that can
be overriden in subclasses to store the credentials in the session
differently.For example, you could usekeas.kmiand encrypt the passwords of the
currently logged-in users so they don’t appear in plain text in the ZODB.1.1 (2010-10-18)Move concreteIAuthenticatorPluginimplementations fromzope.app.authenticationtozope.pluggableauth.plugins.As a result, projects that want to use theIAuthenticatorplugins
(previously found inzope.app.authentication) do not automatically
also pull in thezope.app.*dependencies that are needed to register
the ZMI views.1.0.3 (2010-07-09)Fix dependency declaration.1.0.2 (2010-07-90)Addpersistent.Persistentandzope.container.contained.Containedas
bases forzope.pluggableauth.plugins.session.SessionCredentialsPlugin,
so instances ofzope.app.authentication.session.SessionCredentialsPluginwon’t be changed.
(https://mail.zope.org/pipermail/zope-dev/2010-July/040898.html)1.0.1 (2010-02-11)Declare adapter in a new ZCML file :principalfactories.zcml. Avoids
duplication errors inzope.app.authentication.1.0 (2010-02-05)Splitting off from zope.app.authentication |
zope.preference | This package provides an API to create and maintain hierarchical user
preferences. Preferences can be easily created by defining schemas.ContentsUser PreferencesPreference GroupsPreference Group TreesDefault PreferencesCreating Preference Groups Using ZCMLSimple Python-Level AccessTraversalSecurityCHANGES5.0 (2023-02-10)4.1.0 (2018-09-27)4.0.0 (2017-05-09)4.0.0a1 (2013-02-24)3.8.0 (2010-06-12)User PreferencesImplementing user preferences is usually a painful task, since it requires a
lot of custom coding and constantly changing preferences makes it hard to
maintain the data and UI. Thepreferencepackage>>> from zope.preference import preferenceeases this pain by providing a generic user preferences framework that uses
schemas to categorize and describe the preferences.Preference GroupsPreferences are grouped in preference groups and the preferences inside a
group are specified via the preferences group schema:>>> import zope.interface
>>> import zope.schema
>>> class IZMIUserSettings(zope.interface.Interface):
... """Basic User Preferences"""
...
... email = zope.schema.TextLine(
... title=u"E-mail Address",
... description=u"E-mail Address used to send notifications")
...
... skin = zope.schema.Choice(
... title=u"Skin",
... description=u"The skin that should be used for the ZMI.",
... values=['Rotterdam', 'ZopeTop', 'Basic'],
... default='Rotterdam')
...
... showZopeLogo = zope.schema.Bool(
... title=u"Show Zope Logo",
... description=u"Specifies whether Zope logo should be displayed "
... u"at the top of the screen.",
... default=True)Now we can instantiate the preference group. Each preference group must have an
ID by which it can be accessed and optional title and description fields for UI
purposes:>>> settings = preference.PreferenceGroup(
... "ZMISettings",
... schema=IZMIUserSettings,
... title=u"ZMI User Settings",
... description=u"")Note that the preferences group provides the interface it is representing:>>> IZMIUserSettings.providedBy(settings)
Trueand the id, schema and title of the group are directly available:>>> settings.__id__
'ZMISettings'
>>> settings.__schema__
<InterfaceClass zope.preference.README.IZMIUserSettings>
>>> settings.__title__
'ZMI User Settings'So let’s ask the preference group for theskinsetting:>>> settings.skin #doctest:+ELLIPSIS
Traceback (most recent call last):
...
zope.security.interfaces.NoInteractionSo why did the lookup fail? Because we have not specified a principal yet, for
which we want to lookup the preferences. To do that, we have to create a new
interaction:>>> class Principal:
... def __init__(self, id):
... self.id = id
>>> principal = Principal('zope.user')>>> class Participation:
... interaction = None
... def __init__(self, principal):
... self.principal = principal>>> participation = Participation(principal)>>> import zope.security.management
>>> zope.security.management.newInteraction(participation)We also need an IAnnotations adapter for principals, so we can store the
settings:>>> from zope.annotation.interfaces import IAnnotations
>>> @zope.interface.implementer(IAnnotations)
... class PrincipalAnnotations(dict):
... data = {}
... def __new__(class_, principal, context):
... try:
... annotations = class_.data[principal.id]
... except KeyError:
... annotations = dict.__new__(class_)
... class_.data[principal.id] = annotations
... return annotations
... def __init__(self, principal, context):
... pass>>> from zope.component import provideAdapter
>>> provideAdapter(PrincipalAnnotations,
... (Principal, zope.interface.Interface), IAnnotations)Let’s now try to access the settings again:>>> settings.skin
'Rotterdam'which is the default value, since we have not set it yet. We can now reassign
the value:>>> settings.skin = 'Basic'
>>> settings.skin
'Basic'However, you cannot just enter any value, since it is validated before the
assignment:>>> settings.skin = 'MySkin'
Traceback (most recent call last):
...
ConstraintNotSatisfied: MySkinPreference Group TreesThe preferences would not be very powerful, if you could create a full
preferences. So let’s create a sub-group for our ZMI user settings, where we
can adjust the look and feel of the folder contents view:>>> class IFolderSettings(zope.interface.Interface):
... """Basic User Preferences"""
...
... shownFields = zope.schema.Set(
... title=u"Shown Fields",
... description=u"Fields shown in the table.",
... value_type=zope.schema.Choice(['name', 'size', 'creator']),
... default=set(['name', 'size']))
...
... sortedBy = zope.schema.Choice(
... title=u"Sorted By",
... description=u"Data field to sort by.",
... values=['name', 'size', 'creator'],
... default='name')>>> folderSettings = preference.PreferenceGroup(
... "ZMISettings.Folder",
... schema=IFolderSettings,
... title=u"Folder Content View Settings")Note that the id was chosen so that the parent id is the prefix of the child’s
id. Our new preference sub-group should now be available as an attribute or an
item on the parent group …>>> settings.Folder
Traceback (most recent call last):
...
AttributeError: 'Folder' is not a preference or sub-group.
>>> settings['Folder']
Traceback (most recent call last):
...
KeyError: 'Folder'but not before we register the groups as utilities:>>> from zope.preference import interfaces
>>> from zope.component import provideUtility>>> provideUtility(settings, interfaces.IPreferenceGroup,
... name='ZMISettings')
>>> provideUtility(folderSettings, interfaces.IPreferenceGroup,
... name='ZMISettings.Folder')If we now try to lookup the sub-group again, we should be successful:>>> settings.Folder #doctest:+ELLIPSIS
<zope.preference.preference.PreferenceGroup object at ...>>>> settings['Folder'] #doctest:+ELLIPSIS
<zope.preference.preference.PreferenceGroup object at ...>
>>> 'Folder' in settings
True
>>> list(settings)
[<zope.preference.preference.PreferenceGroup object at ...>]While the registry of the preference groups is flat, the careful naming of the
ids allows us to have a tree of preferences. Note that this pattern is very
similar to the way modules are handled in Python; they are stored in a flat
dictionary insys.modules, but due to the naming they appear to be in a
namespace tree.While we are at it, there are also preference categories that can be compared
to Python packages. They basically are just a higher level grouping concept
that is used by the UI to better organize the preferences. A preference group
can be converted to a category by simply providing an additional interface:>>> zope.interface.alsoProvides(folderSettings, interfaces.IPreferenceCategory)>>> interfaces.IPreferenceCategory.providedBy(folderSettings)
TruePreference group objects can also hold arbitrary attributes, but since
they’re not persistent this must be used with care:>>> settings.not_in_schema = 1
>>> settings.not_in_schema
1
>>> del settings.not_in_schema
>>> settings.not_in_schema
Traceback (most recent call last):
...
AttributeError: 'not_in_schema' is not a preference or sub-group.Default PreferencesIt is sometimes desirable to define default settings on a site-by-site
basis, instead of just using the default value from the schema. The
preferences package provides a module that implements a default
preferences provider that can be added as a unnamed utility for each
site:>>> from zope.preference import defaultWe’ll begin by creating a new root site:>>> from zope.site.folder import rootFolder
>>> root = rootFolder()
>>> from zope.site.site import LocalSiteManager
>>> rsm = LocalSiteManager(root)
>>> root.setSiteManager(rsm)And we’ll make the new site the current site:>>> zope.component.hooks.setSite(root)Now we can register the default preference provider with the root site:>>> provider = addUtility(
... rsm, default.DefaultPreferenceProvider(),
... interfaces.IDefaultPreferenceProvider)So before we set an explicit default value for a preference, the schema field
default is used:>>> settings.Folder.sortedBy
'name'But if we now set a new default value with the provider,>>> defaultFolder = provider.getDefaultPreferenceGroup('ZMISettings.Folder')
>>> defaultFolder.sortedBy = 'size'then the default of the setting changes:>>> settings.Folder.sortedBy
'size'Because theZMISettings.Folderwas declared as a preference
category, the default implementation is too:>>> interfaces.IPreferenceCategory.providedBy(defaultFolder)
TrueThe default preference providers also implicitly acquire default
values from parent sites. So if we add a new child folder calledfolder1, make it a site and set it as the active site:>>> from zope.site.folder import Folder
>>> root['folder1'] = Folder()
>>> folder1 = root['folder1']>>> from zope.site.site import LocalSiteManager
>>> sm1 = LocalSiteManager(folder1)
>>> folder1.setSiteManager(sm1)
>>> zope.component.hooks.setSite(folder1)and add a default provider there,>>> provider1 = addUtility(
... sm1, default.DefaultPreferenceProvider(),
... interfaces.IDefaultPreferenceProvider)then we still get the root’s default values, because we have not defined any
in the higher default provider:>>> settings.Folder.sortedBy
'size'But if we provide the new provider with a default value forsortedBy,>>> defaultFolder1 = provider1.getDefaultPreferenceGroup('ZMISettings.Folder')
>>> defaultFolder1.sortedBy = 'creator'then it is used instead:>>> settings.Folder.sortedBy
'creator'Of course, once the root site becomes our active site again>>> zope.component.hooks.setSite(root)the default value of the root provider is used:>>> settings.Folder.sortedBy
'size'Of course, all the defaults in the world are not relevant anymore as soon as
the user actually provides a value:>>> settings.Folder.sortedBy = 'name'
>>> settings.Folder.sortedBy
'name'Oh, and have I mentioned that entered values are always validated? So you
cannot just assign any old value:>>> settings.Folder.sortedBy = 'foo'
Traceback (most recent call last):
...
ConstraintNotSatisfied: fooFinally, if the user deletes his/her explicit setting, we are back to the
default value:>>> del settings.Folder.sortedBy
>>> settings.Folder.sortedBy
'size'Just as with regular preference groups, the default preference groups
are arranged in a matching hierarchy:>>> defaultSettings = provider.getDefaultPreferenceGroup('ZMISettings')
>>> defaultSettings.get('Folder')
<zope.preference.default.DefaultPreferenceGroup object at ...>
>>> defaultSettings.Folder
<zope.preference.default.DefaultPreferenceGroup object at ...>They also report useful AttributeErrors for bad accesses:>>> defaultSettings.not_in_schema
Traceback (most recent call last):
...
AttributeError: 'not_in_schema' is not a preference or sub-group.Creating Preference Groups Using ZCMLIf you are using the user preference system in Zope 3, you will not have to
manually setup the preference groups as we did above (of course). We will use
ZCML instead. First, we need to register the directives:>>> from zope.configuration import xmlconfig
>>> import zope.preference
>>> context = xmlconfig.file('meta.zcml', zope.preference)Then the system sets up a root preference group:>>> context = xmlconfig.string('''
... <configure
... xmlns="http://namespaces.zope.org/zope"
... i18n_domain="test">
...
... <preferenceGroup
... id=""
... title="User Preferences"
... />
...
... </configure>''', context)Now we can use the preference system in its intended way. We access the folder
settings as follows:>>> import zope.component
>>> prefs = zope.component.getUtility(interfaces.IPreferenceGroup)
>>> prefs.ZMISettings.Folder.sortedBy
'size'Let’s register the ZMI settings again under a new name via ZCML:>>> context = xmlconfig.string('''
... <configure
... xmlns="http://namespaces.zope.org/zope"
... i18n_domain="test">
...
... <preferenceGroup
... id="ZMISettings2"
... title="ZMI Settings NG"
... schema="zope.preference.README.IZMIUserSettings"
... category="true"
... />
...
... </configure>''', context)>>> prefs.ZMISettings2 #doctest:+ELLIPSIS
<zope.preference.preference.PreferenceGroup object at ...>>>> prefs.ZMISettings2.__title__
'ZMI Settings NG'>>> IZMIUserSettings.providedBy(prefs.ZMISettings2)
True
>>> interfaces.IPreferenceCategory.providedBy(prefs.ZMISettings2)
TrueAnd the tree can built again by carefully constructing the id:>>> context = xmlconfig.string('''
... <configure
... xmlns="http://namespaces.zope.org/zope"
... i18n_domain="test">
...
... <preferenceGroup
... id="ZMISettings2.Folder"
... title="Folder Settings"
... schema="zope.preference.README.IFolderSettings"
... />
...
... </configure>''', context)>>> prefs.ZMISettings2 #doctest:+ELLIPSIS
<zope.preference.preference.PreferenceGroup object at ...>>>> prefs.ZMISettings2.Folder.__title__
'Folder Settings'>>> IFolderSettings.providedBy(prefs.ZMISettings2.Folder)
True
>>> interfaces.IPreferenceCategory.providedBy(prefs.ZMISettings2.Folder)
FalseSimple Python-Level AccessIf a site is set, getting the user preferences is very simple:>>> from zope.preference import UserPreferences
>>> prefs2 = UserPreferences()
>>> prefs2.ZMISettings.Folder.sortedBy
'size'This function is also commonly registered as an adapter,>>> from zope.location.interfaces import ILocation
>>> provideAdapter(UserPreferences, [ILocation], interfaces.IUserPreferences)so that you can adapt any location to the user preferences:>>> prefs3 = interfaces.IUserPreferences(folder1)
>>> prefs3.ZMISettings.Folder.sortedBy
'creator'TraversalOkay, so all these objects are nice, but they do not make it any easier to
access the preferences in page templates. Thus, a special traversal namespace
has been created that makes it very simple to access the preferences via a
traversal path. But before we can use the path expressions, we have to
register all necessary traversal components and the specialpreferencesnamespace:>>> import zope.traversing.interfaces
>>> provideAdapter(preference.preferencesNamespace, [None],
... zope.traversing.interfaces.ITraversable,
... 'preferences')We can now access the preferences as follows:>>> from zope.traversing.api import traverse
>>> traverse(None, '++preferences++ZMISettings/skin')
'Basic'
>>> traverse(None, '++preferences++/ZMISettings/skin')
'Basic'SecurityYou might already wonder under which permissions the preferences are
available. They are actually available publicly (CheckerPublic), but that
is not a problem, since the available values are looked up specifically for
the current user. And why should a user not have full access to his/her
preferences?Let’s create a checker using the function that the security machinery is
actually using:>>> checker = preference.PreferenceGroupChecker(settings)
>>> checker.permission_id('skin')
Global(CheckerPublic,zope.security.checker)
>>> checker.setattr_permission_id('skin')
Global(CheckerPublic,zope.security.checker)The id, title, description, and schema are publicly available for access,
but are not available for mutation at all:>>> checker.permission_id('__id__')
Global(CheckerPublic,zope.security.checker)
>>> checker.setattr_permission_id('__id__') is None
TrueThe only way security could be compromised is when one could override the
annotations property. However, this property is not available for public
consumption at all, including read access:>>> checker.permission_id('annotation') is None
True
>>> checker.setattr_permission_id('annotation') is None
TrueCHANGES5.0 (2023-02-10)Drop support for Python 2.7, 3.4, 3.5, 3.6.Add support for Python 3.8, 3.9, 3.10, 3.11.4.1.0 (2018-09-27)Support newer zope.configuration and persistent. Seeissue 2.Add support for Python 3.7 and PyPy3.Drop support for Python 3.3.4.0.0 (2017-05-09)Add support for Python 3.4, 3.5 and 3.6.Add support for PyPy.Drop support for Python 2.6.4.0.0a1 (2013-02-24)Added support for Python 3.3.Replaced deprecatedzope.interface.implementsusage with equivalentzope.interface.implementerdecorator.Dropped support for Python 2.4 and 2.5.Refactored tests not to rely onzope.app.testinganymore.Fixed a bug while accessing the parent of a preference group.3.8.0 (2010-06-12)Split out fromzope.app.preference.Removed dependency onzope.app.component.hooksby usingzope.component.hooks.Removed dependency onzope.app.containerby usingzope.container. |
zope.principalannotation | zope.principalannotationThis package implements annotations for zope.security principals. Common
annotation techniques, likeAttributeAnnotationscannot be applied to
principals, since they are created on the fly for every request.Documentation is hosted athttps://zopeprincipalannotation.readthedocs.io/.Changes5.0 (2023-06-29)Drop support for Python 2.7, 3.5, 3.6.Drop support for deprecatedpython setup.py test.Add support for Python 3.11.4.4 (2022-03-17)Add support for Python 3.8, 3.9 and 3.10.Drop support for Python 3.4.4.3.0 (2018-10-19)Add support for Python 3.7.4.2.0 (2017-08-18)Add support for Python 3.5 and 3.6.Drop support for Python 2.6 and 3.3.4.1.1 (2015-06-02)Replace use of long-deprecatedzope.testing.doctestwith stdlib’sdoctest.4.1.0 (2015-01-09)Accomodate new methods added tozope.annotation.interfaces.IAnnotationsin upcoming zope.annotation 4.4.0 release.4.0.0 (2014-12-24)Add support for PyPy.Add support for Python 3.4.Add support for testing on Travis.4.0.0a2 (2013-02-25)Correct Trove classifiers.4.0.0a1 (2013-02-24)Add support for Python 3.3.Replace deprecatedzope.interface.implementsusage with equivalentzope.interface.implementerdecorator.Drop support for Python 2.4 and 2.5.3.6.1 (2010-05-05)Fix a test failure in nested local site manager setup.Remove dependency on zope.container.3.6.0 (2009-03-09)Initial release. This package was splitted off zope.app.principalannotation
to remove its dependencies on “zope 3 application server” components.In addition, the following changes were made after split off:The IAnnotations implementation was fixed to look in the higher-level
utility not only on__getitem__, but also ongetand__nonzero.Tests was reworked into the README.txt doctest.Added a buildout part that generates Sphinx documentation from the
README.txt |
zope.principalregistry | zope.principalregistryThis package provides an authentication utility forzope.authenticationthat uses a simple non-persistent principal registry. This is
typically registered as a global utility, and it is usually configured
in ZCML.Documentation is hosted athttps://zopeprincipalregistry.readthedocs.ioChanges5.0 (2023-07-06)Drop support for Python 2.7, 3.5, 3.6.Drop support for deprecatedpython setup.py test.Add support for Python 3.11.4.3 (2022-07-14)Drop support for Python 3.4.Add support for Python 3.7, 3.8, 3.9, 3.10.4.2.0 (2017-10-01)Fix principal and group objects registered in ZCML or directly with
the principalregistry being invalid under Python 2 (having byte
strings foridinstead of text strings).
Seehttps://github.com/zopefoundation/zope.principalregistry/issues/74.1.0 (2017-09-04)Add support for Python 3.5 and 3.6.Drop support for Python 2.6 and 3.3.Host documentation athttps://zopeprincipalregistry.readthedocs.ioReach 100% test coverage and ensure we remain there.Test PyPy3 on Travis CI.4.0.0 (2014-12-24)Add support for PyPy. (PyPy3 is pending release of a fix for:https://bitbucket.org/pypy/pypy/issue/1946)Add support for Python 3.4.Add support for testing under Travis.4.0.0a2 (2013-03-03)Make sure that the password is always bytes when passed into the principal
registry.Fix deprecation warnings.4.0.0a1 (2013-02-22)Add support for Python 3.3.Replace deprecatedzope.interface.implementsusage with equivalentzope.interface.implementerdecorator.Dropd support for Python 2.4 and 2.5.3.7.1 (2010-09-25)Add test extra to declare test dependency onzope.component [test].Use Python’sdoctestmodule instead of deprecatedzope.testing.doctest.3.7.0 (2009-03-14)Removezope.containerdependency, as contained principals didn’t make any
sense, since PrincipalRegistry never provided IContainer. Also, zope.container
pulls a number dependencies, that are not needed for non-persistent principal
registry (like, ZCML, for example).Set__name__and__parent__by hand to provide some backward-compatibility and
to save a pointer to registry from principal objects.Initial release. This package was split from zope.app.security as a part
of the refactoring process to provide global principal registry without extra
dependencies. |
zope.processlifetime | zope.processlifetimeThis package provides interfaces / implementations for events relative
to the lifetime of a server process (startup, database opening, etc.)
These events are usually used withzope.event.Documentation is hosted athttps://zopeprocesslifetime.readthedocs.io/en/latest/Changes3.0 (2023-03-27)Add support for Python 3.11.Drop support for Python 2.7, 3.5, 3.6.Drop support for deprecatedpython setup.py test.2.4 (2022-08-26)Drop support for Python 3.4.Add support for Python 3.8, 3.9, 3.10.2.3.0 (2018-10-05)Add support for Python 3.7.2.2.0 (2017-09-01)Add support for Python 3.5 and 3.6.Drop support for Python 2.6, 3.2 and 3.3.Host documentation athttps://zopeprocesslifetime.readthedocs.io/en/latest/2.1.0 (2014-12-27)Add support for PyPy and PyPy3.Add support for Python 3.4.Add support for testing on Travis.2.0.0 (2013-02-22)Replace deprecatedzope.interface.implementsusage with equivalentzope.interface.implementerdecorator.Add support for Python 3.2 and 3.3Drop support for Python 2.4 and 2.5.1.0 (2009-05-13)Split out event interfaces / implementations fromzope.app.appsetupversion 3.10.2. |
zopeproject | ContentsQuickstartNotes for Windows usersSharing eggs among sandboxesCommand line options for zopeprojectThe sandboxWhat are the different files and directories for?RenamingSharing and archiving sandboxesDevelopingFirst steps with your applicationAdding dependencies to the applicationWriting and running testsFunctional testsDebuggingThe interpreter promptThe interactive debug promptDebugging exceptionsDeployingDisabling debugging toolsLinux/UnixWindowsReporting bugs or asking questions about zopeprojectCreditsChanges0.4.2 (2009-02-12)0.4.1 (2007-09-29)0.4 (2007-09-15)New featuresBugfixes and restructuring0.3.2 (2007-07-17)0.3.1 (2007-07-15)0.3 (2007-07-14)0.2 (2007-07-12)0.1 (2007-07-06)QuickstartYou can start a new Zope-based web application from scratch with just
two commands:$ easy_install zopeproject
$ zopeproject HelloWorldThe second command will ask you for a name and password for an
initial administrator user. It will also ask you where to put the
Python packages (“eggs”) that it downloads. This way multiple
projects created withzopeprojectcan share the same packages and
won’t have to download them each time (see alsoSharing eggs among
sandboxesbelow).(Note: Depending on how they installed Python, Unix/Linux users may
have to invokeeasy_installwithsudo. If that’s not wanted
or possible,easy_installcan be invoked with normal privileges
inside avirtual-pythonorworkingenv).After asking these questions,zopeprojectwill download thezc.buildoutpackage that will be used to build the sandbox, unless
it is already installed locally. Then it will invokebuildoutto
download Zope and its dependencies. If you’re doing this for the first
time or not sharing packages between different projects, this may take
a while.Whenzopeprojectis done, you will find a typical Python package
development environment in theHelloWorlddirectory: the package
itself (helloworld) and asetup.pyscript. There’s also abindirectory that contains scripts, such aspasterwhich can
be used to start the application:$ cd HelloWorld
$ bin/paster serve deploy.iniYou may also use thehelloworld-ctlscript which works much like
thezopectlscript from Zope instances:$ bin/helloworld-ctl foregroundAfter starting the application, you should now be able to go tohttp://localhost:8080and see the default start screen of Zope. You
will also be able to log in with the administrator user account that
you specified earlier.Notes for Windows usersSome packages required by Zope contain C extension modules. There may
not always be binary Windows distributions available for these
packages. In this case, setuptools will try to compile them from
source which will likely fail if you don’t have a compiler such as the
Microsoft Visual C compiler installed. Alternatively, you can install
the freeMinGWcompiler:DownloadMinGW-x.y.z.exefromhttp://www.mingw.org/and run it
to do a full install into the standard location (ie.C:\MinGW).Tell Python to use the MinGW compiler by creatingC:\Documentsand Settings\YOUR USER\pydistutils.cfgwith the following contents:[build]
compiler=mingw32Let Python know about the MinGW installation and thepydistutils.cfgfile. To do that, go to theControl Panel,Systemsection,Advancedtab and click on theEnvironment
variablesbutton. Add theC:\MinGW\bindirectory to yourPathenvironment variable (individual paths are delimited by
semicolons). Also add another environment variable calledHOMEwith the following value:C:\Documents and Settings\YOUR USERWhen installing packages from source, Python should now automatically
use the MinGW compiler to build binaries.Sharing eggs among sandboxesA great feature ofzc.buildoutis the ability to share downloaded
Python packages (“eggs”) between sandboxes. This is achieved by
placing all eggs in a shared location. zopeproject will ask for this
location each time. The setting will become part ofbuildout.cfg.It could very well be that your shared eggs directory is different
from the suggested default value, so it would be good to avoid having
to type it in every time. Furthermore, you may want to avoid having
system-dependent paths appear inbuildout.cfgbecause they hinder
the repeatibility of the setup on other machines.A way to solve these problems is to configure a user-specific default
eggs directory for buildout in your home directory:~/.buildout/default.cfg:[buildout]
eggs-directory = /home/philipp/eggszopeproject will understand that you have this default value and
change its own default when asking you for the eggs directory. If you
just hit enter there (thereby accepting the default in~/.buildout/default.cfg), the generatedbuildout.cfgwill not
contain a reference to a path.Command line options for zopeproject--no-buildoutWhen invoked with this option,zopeprojectwill only create the
project directory with the standard files in it, but it won’t
download and invokezc.buildout.--newerThis option enables thenewest = truesetting inbuildout.cfg. That way, buildout will always check for newer
versions of eggs online. If, for example, you have outdated
versions of your dependencies in your shared eggs directory, this
switch will force the download of newer versions. Note that you can
always editbuildout.cfgto change this behaviour in an existing
project area, or you can invokebin/buildoutwith the-noption.--svn-repository=REPOSThis option will import the project directory and the files in it
into the given subversion repository and provide you with a checkout
of thetrunk.REPOSis supposed to be a repository path
that is going to be created, along withtags,branchesandtrunkbelow that. This checkin ignores any files and directories
created by zc.buildout.-v,--verboseWhen this option is enabled,zopeprojectwon’t hide the output
ofeasy_install(used to installzc.buildout) and thebuildoutcommand.The sandboxWhat are the different files and directories for?deploy.iniConfiguration file forPasteDeploy. It defines which server
software to launch and which WSGI application to invoke upon each
request (which is defined insrc/helloworld/startup.py). You
may also define WSGI middlewares here. Invokebin/paster servewith this file as an argument.debug.iniAlternate configuration forPasteDeploythat configures
middleware which intercepts exceptions for interactive debugging.
SeeDebugging exceptionsbelow.zope.confThis file will be read by the application factory insrc/helloworld/startup.py. Here you can define which ZCML file
the application factory should load upon startup, the ZODB database
instance, an event log as well as whether developer mode is switched
on or not.site.zcmlThis file is referred to byzope.confand will be loaded by the
application factory. It is the root ZCML file and includes
everything else that needs to be loaded. ‘Everything else’ typically
is just the application package itself,helloworld, which then
goes on to include its dependencies. Apart from this,site.zcmlalso defines the anonymous principal and the initial admin principal.setup.pyThis file defines the egg of your application. That definition
includes listing the package’s dependencies (mostly Zope eggs) and
the entry point for thePasteDeployapplication factory.buildout.cfgThis file tellszc.buildoutwhat to do when the buildout is
executed. This mostly involves executingsetup.pyto enable theHelloWorldegg (which also includes downloading its
dependencies), as well as installingPasteDeployfor the server.
This files also refers to the shared eggs directory
(eggs-directory) and determines whether buildout should check
whether newer eggs are available online or not (newest).bin/This directory contains all executable scripts, e.g for starting the
application (paster), installing or reinstalling dependencies
(buildout), or invoking the debug prompt (helloworld-debug).
It also contains a script (python) that invokes the standard
interpreter prompt with all packages on the module search path.src/This directory contains the Python package(s) of your application.
Normally there’s just one package (helloworld), but you may add
more to this directory if you like. Thesrcdirectory will be
placed on the interpreter’s search path byzc.buildout.var/The ZODB filestorage will place its files (Data.fs, lock files,
etc.) here.RenamingYou can rename or move the sandbox directory any time you like. Just
be sure to runbin/buildoutagain after doing so. Renaming the
sandbox directory won’t change the name of the egg, however. To do
that, you’ll have to change thenameparameter insetup.py.Sharing and archiving sandboxesYou can easily share sandboxes with co-developers or archive them in a
version control system such as subversion. You can theoretically
share or archive the whole sandbox directory, though it’s recommendednot to includethe following files and directories because they
can and will be generated by zc.buildout from the configuration files:bin/parts/develop-eggs/all files invar/all files inlog/.installed.cfgIf you receive a sandbox thas has been archived (e.g. by checking it
out from a version control system), you will first have to bootstrap
it in order to obtain thebin/buildoutexecutable. To do that,
use thebuildoutscript from any other sandbox on your machine:$ .../path/to/some/sandbox/bin/buildout bootstrapNow the sandbox has its ownbin/buildoutscript and can be
installed:$ bin/buildoutDevelopingFirst steps with your applicationAfter having started up Zope for the first time, you’ll likely want to
start developing your web application. Code for your application goes
into thehelloworldpackage that was created by zopeproject in thesrcdirectory.For example, to get a simple “Hello world!” message displayed, createsrc/helloworld/browser.pywith the following contents:from zope.publisher.browser import BrowserPage
class HelloPage(BrowserPage):
def __call__(self):
return "<html><body><h1>Hello World!</h1></body></html>"Then all you need to do is hook up the page in ZCML. To do that, add
the following directive towards the end ofsrc/helloworld/configure.zcml:<browser:page
for="*"
name="hello"
class=".browser.HelloPage"
permission="zope.Public"
/>Note that you’ll likely need to define thebrowsernamespace
prefix at the top of the file:<configure xmlns="http://namespaces.zope.org/zope"
xmlns:browser="http://namespaces.zope.org/browser"
>After having restarted the application usingpaster serve, you can
visithttp://localhost:8080/helloto see the page in action.Adding dependencies to the applicationThe standardsetup.pyandconfigure.zcmlfiles list a set of
standard dependencies that are typical for most Zope applications.
You may obviously remove things from this list, but typically you’ll
want to re-use more libraries that others have written. Many, if not
most, of additional Zope and third party libraries arelisted on the
Python Cheeseshop.Let’s say you wanted to reuse thesome.librarypackage in your
application. The first step would be to add it to the list of
dependencies insetup.py(install_requires). If this package
defined any Zope components, you would probably also have to load its
ZCML configuration by adding the following line tosrc/helloworld/configure.zcml:<include package="some.library" />After having changedsetup.py, you would want the newly added
dependency to be downloaded and added to the search path ofbin/paster. To do that, simply invoke the buildout:$ bin/buildoutWriting and running testsAutomated tests should be placed in Python modules. If they all fit
in one module, the module should simply be namedtests. If you
need many modules, create atestspackage and put the modules in
there. Each module should start withtest(for example, the full
dotted name of a test module could behelloworld.tests.test_app).If you prefer to separate functional tests from unit tests, you can
put functional tests in anftestsmodule or package. Note that
this doesn’t matter to the test runner whatsoever, it doesn’t care
about the location of a test case.Each test module should define atest_suitefunction that
constructs the test suites for the test runner, e.g.:def test_suite():
return unittest.TestSuite([
unittest.makeSuite(ClassicTestCase),
DocTestSuite(),
DocFileSuite('README.txt', package='helloworld'),
])To run all tests in your application’s packages, simply invoke thebin/testscript:$ bin/testFunctional testsWhile unit test typically require no or very little test setup,
functional tests normally bootstrap the whole application’s
configuration to create a real-life test harness. The configuration
file that’s responsible for this test harness isftesting.zcml.
You can add more configuration directives to it if you have components
that are specific to functional tests (e.g. mockup components).To let a particular test run inside this test harness, simply apply
thehelloworld.testing.FunctionalLayerlayer to it:from helloworld.testing import FunctionalLayer
suite.layer = FunctionalLayerYou can also simply use one of the convenience test suites inhelloworld.testing:FunctionalDocTestSuite(based ondoctest.DocTestSuite)FunctionalDocFileSuite(based ondoctest.DocFileSuite)FunctionalTestCase(based onunittest.TestCase)DebuggingThe interpreter promptUse thebin/pythonscript if you’d like test some components from
the interpreter prompt and don’t need the component registrations nor
access to the ZODB. If you do need those, go on to the next section.The interactive debug promptOccasionally, it is useful to be able to interactively debug the state
of the application, such as walking the object hierarchy in the ZODB
or looking up components manually. This can be done with the
interactive debug prompt, which is available underbin/helloworld-debug:$ bin/helloworld-debug
Welcome to the interactive debug prompt.
The 'root' variable contains the ZODB root folder.
The 'app' variable contains the Debugger, 'app.publish(path)' simulates a request.
>>>You can now get a folder listing of the root folder, for example:>>> list(root.keys())
[u'folder', u'file']Debugging exceptionsIn case your application fails with an exception, it can be useful to
inspect the circumstances with a debugger. This is possible with thez3c.evalexceptionWSGI middleware. When an exception occurs in
your application, stop the process and start it up again, now using
thedebug.iniconfiguration file:$ bin/paster serve debug.iniWhen you then repeat the steps that led to the exception, you will see
the relevant traceback in your browser, along with the ability to view
the corresponding source code and to issue Python commands for
inspection.If you prefer the Python debuggerpdb, replaceajaxwithpdbin the WSGI middleware definition indebug.ini:[filter-app:main]
use = egg:z3c.evalexception#pdb
next = zopeNote: Even exceptions such as Unauthorized (which normally leads to a
login screen) or NotFound (which normally leads to an HTTP 404
response) will trigger the debugger.DeployingDisabling debugging toolsBefore deploying a zopeproject-based application, you should make sure
that any debugging tools are disabled. In particular, this includesmaking sure there’s no debugging middleware indeploy.ini(normally these should be configured indebug.inianyway),switching offdeveloper-modeinzope.conf,disabling the APIDoc tool insite.zcml,disabling the bootstrap administrator principal insite.zcml.Linux/UnixYou can use thehelloworld-ctlscript to start the server process
in daemon mode. It works much like theapachectltool as known
from the Apache HTTPD server or INIT scripts known from Linux:$ bin/helloworld-ctl startTo stop the server, issue:$ bin/helloworld-ctl stopOther commands, such asstatusandrestartare supported as
well.WindowsThere’s currently no particular support for deployment on Windows
other than whatpasterprovides. Integration with Windows
services, much like what could be found in older versions of Zope, is
planned.Reporting bugs or asking questions about zopeprojectzopeproject maintains a bugtracker and help desk on Launchpad:https://launchpad.net/zopeprojectQuestions can also be directed to the zope3-users mailinglist:http://mail.zope.org/mailman/listinfo/zope3-usersCreditszopeproject is written and maintained by Philipp von Weitershausen.
It was inspired by the similargrokprojecttool from the same author.James Gardner, Martijn Faassen, Jan-Wijbrand Kolman and others gave
valuable feedback on the early prototype presented at EuroPython 2007.Michael Bernstein gave valuable feedback and made many suggestions for
improvements.zopeproject is distributed under theZope Public License,
v2.1. Copyright (c) by Zope Corporation and Contributors.Changes0.4.2 (2009-02-12)Use Zope 3.4.0 KGS in the default deployment buildout.cfg.Added blobstorage proxy to default ZODB config in zope.conf.Use ZopeSecurityPolicy from zope.securitypolicy instead
of zope.app.securitypolicy, which is a deprecated place for
that.The zope.securitypolicy uses a special role name,
thezope.Anonymousthat every user has, define
it in site.zcml and grant view permissions to it,
instead of zope.Anybody unauthenticated group.0.4.1 (2007-09-29)Improvements toREADME.txtandvar/README.txt(it was
pointing to the wrong configuration file). Moved changelog fromREADME.txtinto separateCHANGES.txtfile.The--no-buildoutoption is no longer ignored now.Added abin/pythonscript that mimicks an interpreter.Enabled the APIDoc tool by default. You may access it underhttp://localhost:8080/++apidoc++.Simplified*package*/testing.py.0.4 (2007-09-15)New featuresAdded a zdaemon controller script much like zopectl called*package*-ctl(where*package*is the name of the package
created with zopeproject).Added a debug script called*package*-debugthat configures the
application and drops into an interpreter session. It is also
available via*package*-ctldebug.Addeddebug.iniwhich configures a WSGI middleware for
intercepting exceptions and live debugging (either using Paste’s
evalexception middleware or the Python debuggerpdb).Added a functional test layer in*package*.testingwhich loads
the newftesting.zcml. Convenience definitions of test suites
pre-configured for that layer are available in*package*.testingas well.More improvements to the README.txt file.Bugfixes and restructuringMake use ofzope.app.wsgi.getApplication()to reduce the startup
boiler-plate instartup.py(formerlyapplication.py).The package that zopeproject creates is now located in asrcdirectory, where it’s easier to single out among the other files and
directories.Fixed a bug when guessing the default eggs-directory: When
~/.buildout/default.cfg did not contain an eggs-directory option,
zopeproject failed with a ConfigParser.NoOptionError.Renamedapplication.pytostartup.pyto make the intent of
the module much clearer, and to avoid clashes with e.g. Grok (where
“application” means something else, andapp.pyis commonly used
for the application object).The eggs directory will no longer be written tobuildout.cfgif
it is the same as the buildout default in~/.buidout/default.cfg.Cleaned up and enhanced the dependencies of the generated
application. It no longer depends on zope.app.securitypolicy, only
the deployment (site.zcml) does. Obsolete dependencies (and
their include statements in ZCML) have been removed.zope.app.catalogand friends have been added as a convenience.0.3.2 (2007-07-17)If the user already has a default eggs directory set in~/.buildout/default.cfg, it is used as the default value for the
eggs directory.Greatly improved the README.txt file.0.3.1 (2007-07-15)Thebuildout.cfgtemplate was missing settings for the shared
eggs directory and thewnewestflag.Assemble the default path for the eggs directory in a
Windows-friendly way.0.3 (2007-07-14)Renamed tozopeproject.Incorporated much of thegrokproject0.5.x infrastructure. This
makes it much more robust, especially when launching zc.buildout.Mergedmake-zope-appanddeploy-zope-appback into one
command:zopeproject.0.2 (2007-07-12)Renamed tomake-zope-app.Splitmkzopeappinto two commands:make-zope-appanddeploy-zope-app.No longer usezope.pastefor the application factory. Instead,
each application that’s created from the skeleton defines its own
factory (which is reasonably small and gains flexibility).Get rid of thestart<<Project>>script. Simply usebin/paster serve deploy.inifor starting the server.Use thePaste#httpserver by default.0.1 (2007-07-06)Initial release asmkzopeapp |
zope.proxy | zope.proxyProxies are special objects which serve as mostly-transparent
wrappers around another object, intervening in the apparent behavior of
the wrapped object only when necessary to apply the policy (e.g., access
checking, location brokering, etc.) for which the proxy is responsible.zope.proxy is implemented via a C extension module, which lets it do things
like lie about its own__class__that are difficult in pure Python (and
were completely impossible before metaclasses). It also proxies all the
internal slots (such as__int__/__str__/__add__).Complete documentation is athttps://zopeproxy.readthedocs.ioChanges5.2 (2024-02-09)Add preliminary support for Python 3.13 as of 3.13a3.5.1 (2023-10-05)Add support for Python 3.12.5.0.0 (2023-01-18)Drop support for Python 2.7, 3.5, 3.6.Remove proxying code for names that no longer exist in Python 3
like__long__and some others.
(#55)4.6.1 (2022-11-16)Add support for building arm64 wheels on macOS.4.6.0 (2022-11-03)Add support for Python 3.11.4.5.1 (2022-09-15)Disable unsafe math optimizations in C code. Seepull request 53.4.5.0 (2021-11-17)Add support for Python 3.10.4.4.0 (2021-07-22)Add support for Python 3.9.Create aarch64 wheels.4.3.5 (2020-03-16)Stop installing C header files on PyPy (which is what zope.proxy before 4.3.4
used to do), fixesissue 39.4.3.4 (2020-03-13)Fix a compilation warning on Python 3.8. The slottp_printchanged totp_vectorcall_offsetin 3.8 and must not be set.
Prior to 3.8, it was reserved and ignored in all Python 3 versions.
Seeissue 36.Remove deprecated use of setuptools features. Seeissue 38.4.3.3 (2019-11-11)Add support for Python 3.8.Drop support for Python 3.4.4.3.2 (2019-07-12)Fix error handling inProxyBase.__setattr__: any the exception raised byPyString_AsString/PyUnicode_AsUTF8would be silently swallowed up
and ignored. Seeissue 31.4.3.1 (2018-08-09)Simplify the internal C handling of attribute names in__getattribute__and__setattr__.Make building the C extension optional. We still attempt to build it
on supported platforms, but we allow it to fail in case of a missing
compiler or headers. Seeissue 26.Test the PURE_PYTHON environment and PyPy3 on Travis CI.Add support for Python 3.7.4.3.0 (2017-09-13)Fix a potential rare crash when deallocating proxies. Seeissue 20.Drop support for Python 3.3.Drop support for “python setup.py test”.100% test coverage.Fix indexing pure-Python proxies with slices under Python 3, and
restore the use of__getslice__(if implemented by the target’s
type) under Python 2. Previously, pure-Python proxies would fail
with an AttributeError when given a slice on Python 3, and on Python
2, a custom__getslice__was ignored. Seeissue 21.4.2.1 (2017-04-23)Make the pure-Python implementation ofsameProxiedObjectshandlezope.securityproxies. Seeissue 15.Add support for Python 3.6.4.2.0 (2016-05-05)Correctly stripzope.securityproxies inremoveAllProxies.
Seeissue 13.Avoid poisoning the user’s global wheel cache when testingPURE_PYTHONenvironments undertox,Drop support for Python 2.6 and 3.2.Add support for Python 3.5.4.1.6 (2015-06-02)Make subclasses of ProxyBase properly delegate__module__to the
wrapped object. This fixes somezope.interfacelookups under
PyPy.Make the pure-Python implementation of ProxyBase properly report thezope.interfaceinterfaces implemented by builtin types likelist. This fixes somezope.interfacelookups under PyPy.4.1.5 (2015-05-19)Make the C implementation proxy__unicode__correctly.Make the C implementation use the standard methods to proxyintandfloat.Make the pure Python implementation handle descriptors defined in
subclasses like the C version. Seehttps://github.com/zopefoundation/zope.proxy/issues/5.4.1.4 (2014-03-19)Add support for Python 3.4.Updatebootstrap.pyto version 2.2.4.1.3 (2013-03-12)Fix interface object introspection in PyPy. For some reason PyPy makes
attributes available despite the restrictive__slots__declaration.Add a bunch of tests surrounding interface lookup and adaptation.4.1.2 (2013-03-11)MakePyProxyBase.__iter__()return the result ofPyProxyBase._wrapped.__iter__if available, otherwise falling back to
Python internals. The previous implementation always created a generator.InPyProxyBase.__setattr__(), allow setting of properties on the
proxy itself. This is needed to properly allow proxy extensions as was
evidenced int hezope.security.decoratormodule.4.1.1 (2012-12-31)Fleshed out PyPI Trove classifiers.4.1.0 (2012-12-19)Enable compilation of dependent modules under Py3k.Replace use ofPyCObjectAPIs with equivalentPyCapsuleAPIs,
except under Python 2.6.N.B. This change is an ABI incompatibility under Python 2.7:extensions built under Python 2.7 against 4.0.x versions ofzope.proxymust be rebuilt.4.0.1 (2012-11-21)Add support for Python 3.3.4.0.0 (2012-06-06)Add support for PyPy.N.B.: the C extension isnotbuilt under PyPy.Add a pure-Python reference / fallback implementations ofzope.proxy.ProxyBaseand the proxy module API functions.N.B.: the pure-Python proxy implements all regular features ofProxyBase; however, it does not exclude access to the wrapped object
in the same way that the C version does. If you need that information
hiding (e.g., to implement security sandboxing), you still need to use
the C version.Add support for continuous integration usingtoxandjenkins.100% unit test coverage.Add Sphinx documentation: moved doctest examples to API reference.Add ‘setup.py docs’ alias (installsSphinxand dependencies).Add ‘setup.py dev’ alias (runssetup.py developplus installsnoseandcoverage).Replace deprecatedzope.interface.implementsusage with equivalentzope.interface.implementerdecorator.Drop support for Python 2.4 and 2.5.Add Python 3.2 support.3.6.1 (2010-07-06)Make tests compatible with Python 2.7.3.6.0 (2010-04-30)Remove test extra and the remaining dependency on zope.testing.Remove use of ‘zope.testing.doctestunit’ in favor of stdlib’s ‘doctest.3.5.0 (2009/01/31)Add support to bootstrap on Jython.Usezope.containerinstead ofzope.app.container.3.4.2 (2008/07/27)Make C code compatible with Python 2.5 on 64bit architectures.3.4.1 (2008/06/24)Bug: Updatesetup.pyscript to conform to common layout. Also updated
some of the fields.Bug: Honor pre-cooked indices for tuples and lists in the__getslice__()and__setslice__()methods. Seehttp://docs.python.org/ref/sequence-methods.html.3.4.0 (2007/07/12)Feature: Add adecoratormodule that supports declaring interfaces on
proxies that get blended with the interfaces of the things they proxy.3.3.0 (2006/12/20)Corresponds to the verison of thezope.proxypackage shipped as part of
the Zope 3.3.0 release.3.2.0 (2006/01/05)Corresponds to the verison of thezope.proxypackage shipped as part of
the Zope 3.2.0 release.3.0.0 (2004/11/07)Corresponds to the verison of thezope.proxypackage shipped as part of
the Zope X3.0.0 release. |
zope.psycopgda | psycopgdaThis file outlines the basics of using Zope3 with PostgreSQL via PsycopgDA.Installing PsycopgDACheck out the psycopgda package into a directory in your
PYTHONPATH. INSTANCE_HOME/lib/python or Zope3/src is usually the
most convenient place:svn co svn://svn.zope.org/repos/main/psycopgda/trunk/psycopgda psycopgdaCopypsycopg-configure.zcmlto thepackage-includesdirectory
of your Zope instance.You can also use the eggified version, by installing it sitewide:easy_install -U psycopgdaIf you’re using buildout, just by listing psycopgda in the ‘eggs’ key
of your buildout.cfg, then buildout should be able to find and fetch it.Creating Database ConnectionsIt is time to add some connections. A connection in Zope 3 is
registered as a utility.Open a web browser on your Zope root folder (http://localhost:8080/if you use the default settings in zope.conf.in).Click on the ‘Manage Site’ action on the right side of the
screen. You should see a screen which reads ‘Common Site Management
Tasks’Around the middle of that page, you should see a link named ‘Add
Utility’. Click on it.Select ‘Psycopg DA’ and type in a name at the bottom of the page.Enter the database connection string. It looks like this:dbi://username:password@host:port/databasenameClick on the ‘Add’ button.You should be on a page which reads ‘Add Database Connection
Registration’. There you can configure the permission needed to use
the database connection, the name of the registration and the
registration status. You can use any name for ‘Register As’ field,
as long as it doesn’t clash with an existing one. Choose a
permission. Choose between ‘Registered’ and ‘Active’ for the
‘Registration Status’. Only one component of a kind can be ‘Active’
at a time, so be careful.You should be redirected to the ‘Edit’ screen of the connection
utility.If you want to, you can go to the Test page and execute arbitrary
SQL queries to see whether the connection is working as expected.Using SQL ScriptsYou can create SQL Scripts in the content space. For example:Go to Zope root.Add an SQL script (you can use the Common Tasks box on the left,
or the Add action on the right).Click on the name of your new SQL script.Choose a connection name (the one you entered in step 29) from the
drop-down.Enter your query and click on the ‘Save Changes’ button.You can test the script in the – surprise! – Test page.CHANGES1.1.1 (2008/01/26)Bug: Some classes were incorrectly looked up.1.1.0 (2008/01/26)Feature: Produced a real egg.Restructuring: Moved frompsycopgdatozope.psycopgda.Bug: Fixed issue 561: PsycopgDA ForbiddenAttribute exception. |
zope.ptresource | zope.ptresourceNoteThis package is at present not reusable without depending on a large
chunk of the Zope Toolkit and its assumptions. It is maintained by theZope Toolkit project.This package provides a “page template”resource class, a resource
whose content is processed with theZope Page Templatesengine before
being returned to client.The resource factory class is registered for “pt”, “zpt” and “html” file
extensions in the package’sconfigure.zcmlfile.Changes5.0 (2023-03-27)Add support for Python 3.11.Drop support for Python 2.7, 3.5, 3.6.Drop support for deprecatedpython setup.py test.4.3.0 (2021-12-15)Add support for Python 3.8, 3.9 and 3.10.Drop support for Python 3.4.4.2.0 (2018-10-05)Add support for Python 3.7.4.1.0 (2017-08-31)Add support for Python 3.5 and 3.6.Drop support for Python 2.6 and 3.3.4.0.0 (2014-12-24)Add support for PyPy and PyPy3.Add support for Python 3.4.Add support for testing on Travis.4.0.0a1 (2013-02-25)Add support for Python 3.3.Replace deprecatedzope.interface.implementsusage with equivalentzope.interface.implementerdecorator.Drop support for Python 2.4 and 2.5.3.9.0 (2009-08-27)Initial release. This package was split off zope.app.publisher as a part
of refactoring process. It’s now a plugin for another package that was
refactored from zope.app.publisher - zope.browserresource. See its
documentation for more details.Other changes:Don’t render PageTemplateResource when called as the IResource interface
requires that __call__ method should return an absolute URL. When accessed
by browser, it still will be rendered, because “browserDefault” method now
returns a callable that will render the template to browser. |
zope.publisher | zope.publisherThis package allows you to publish Python objects on the web. It
has support for plain HTTP/WebDAV clients, web browsers as well as
XML-RPC and FTP clients. Input and output streams are represented by
request and response objects which allow for easy client interaction
from Python. The behaviour of the publisher is geared towards WSGI
compatibility.Documentation is hosted athttps://zopepublisher.readthedocs.io/Changes7.0 (2023-08-29)Drop support for Python 2.7, 3.5, 3.6.Drop support forim_funcandfunc_code.Add support for Python 3.11.6.1.0 (2022-03-15)Revamp handling of query string and form decoding inBrowserRequest.The previous approach was to tell underlying libraries to decode inputs
using ISO-8859-1, then re-encode as ISO-8859-1 and decode using an
encoding deduced from theAccept-Charsetrequest header. However,
this didn’t make much conceptual sense (sinceAccept-Charsetdefines
the preferredresponseencoding), and it made it impossible to handle
cases where the encoding was specified as something other than ISO-8859-1
in the request (which might even be on a per-item basis, in the case ofmultipart/form-datainput).We now only perform the dubiousAccept-Charsetguessing for query
strings; in other cases we letmultipartdetermine the encoding,
defaulting to UTF-8 as per the HTML specification. For cases where
applications need to specify some other default form encoding,BrowserRequestsubclasses can now setdefault_form_charset.Seeissue 65.Add support for Python 3.10.6.0.2 (2021-06-07)Avoid traceback reference cycle inzope.publisher.publish.publish.Handle empty Content-Type environment variable gracefully.6.0.1 (2021-04-15)Fix test compatibility with zope.interface 5.4.6.0.0 (2021-01-20)Port form data parsing tomultipart, which is a new dependency. Seeissue 39.
Note that as a resultFileUploadobjects no longer have anameattribute: thenameattribute couldn’t be used in portable code in any
case, and the usual methods on open files should be used instead.Add support for Python 3.9.5.2.1 (2020-06-15)Fix text/bytes handling on Python 3 for some response edge cases. Seepull request 51.5.2.0 (2020-03-30)Add support for Python 3.8.Ensure all objects have a consistent interface resolution order. Seeissue 49.Drop support for the deprecatedpython setup.py testcommand.5.1.1 (2019-08-08)Avoid usingurllib.parse.splitport()which was deprecated in Python 3.8.
Seeissue 385.1.0 (2019-07-12)Drop support for Python 3.4.FileUploadobjects now support theseekable()method on Python 3.
Fixesissue 44.Character set handling was rather comprehensively broken on Python 3.
It should be fixed now. Seeissue 41.5.0.1 (2018-10-19)Fix aDeprecationWarning.5.0.0 (2018-10-10)Backwards incompatible change: Removezope.publisher.tests.httprequest.
It is not used inside this package and was never ported to Python 3.
Fixeshttps://github.com/zopefoundation/zope.publisher/issues/4.Add support for Python 3.7 and PyPy3.Drop support for Python 3.3.FixXMLRPCResponsehaving a str body (instead of a bytes body)
which could lead toTypeErroron Python 3. Seeissue 26.4.3.2 (2017-05-23)Fix instances ofBaseRequest(includingBrowserRequest)
being unexpectedlyFalseon Python 3 by defining__bool__.
Such instances were alwaysTrueon Python 2. Seeissue 18.4.3.1 (2017-04-24)Add support for Python 3.6.Accept both new and old locations for__code__inzope.publisher.publisher.unwrapMethod. This restores compatibility with
Products.PythonScripts, where parameters were not extracted.
[maurits, thet, MatthewWilkes]Fix file uploads on python 3.4 and up. cgi.FieldStorage explicitly
closes files when it is garbage collected. For details, see:http://bugs.python.org/issue18394https://hg.python.org/cpython/rev/c0e9ba7b26d5https://github.com/zopefoundation/zope.publisher/pull/13We now keep a reference to the FieldStorage till we are finished
processing the request.Fix POST with large values on Python 3. Related to cgi.FieldStorage
doing the decoding in Python 3. Seepull 16.4.3.0 (2016-07-04)Add support for Python 3.5.Drop support for Python 2.6 and 3.2.4.2.2 (2015-11-16)Emit HTTP response headers in a deterministic order (GH #8).4.2.1 (2015-06-05)Add support for Python 3.2.4.2.0 (2015-06-02)Add support for PyPy and PyPy3.4.1.0 (2014-12-27)Add support for Python 3.4.4.0.0 (2014-12-22)Enable testing on Travis.Add__traceback_info__toresponse.redirect()to ease debugging
untrusted redirects.Addtrustedsupport forRedirectexception4.0.0a4 (2013-03-12)Support UTF-8-encoding application/json responses returned as Unicode.Add YAML for travis-ci.4.0.0a3 (2013-02-28)Return bytes fromPrincipalLogging.getLogMessageinstead of unicode.4.0.0a2 (2013-02-22)Use BytesIO inzope.publisher.xmlrpc.TestRequest.4.0.0a1 (2013-02-21)Replace deprecatedzope.component.adaptsusage with equivalentzope.component.adapterdecorator.Replace deprecatedzope.interface.implementsusage with equivalentzope.interface.implementerdecorator.Drop support for Python 2.4, 2.5 and pypy.Add support for Python 3.3.Wrapwith interaction()in try/finally.Don’t guess the content type with 304 responses which MUST NOT /
SHOULD NOT include it according to:http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html#sec10.3.5Unfortunately, the content type will still be guessed if the result is
set before the status.3.13.0 (2011-11-17)Fix error when no charset matches form data and HTTP_ACCEPT_CHARSET contains a*.Add test convenience helpercreate_interactionandwith interaction().3.12.6 (2010-12-17)Upload a non-CRLF version to pypi.3.12.5 (2010-12-14)Rename thetestsextra totest.Add a test for our own configure.zcml.Use UTF-8 as the charset if the browser does not set a header,
per W3C spec.3.12.4 (2010-07-15)LP #131460: Make principal logging unicode safe.Remove use of string exceptions in tests,http://bugs.debian.org/585343AddIStartRequestEventandStartRequestEventfor use inzope.app.publication(matching up withIEndRequestEventandEndRequestEvent). Includes refactoring to produce one definition of
‘event with a request’ - IRequestEvent.3.12.3 (2010-04-30)LP #209440: Don’t obscure original exception when handling retries
inpublish.publish()withhandleErrors == False. This change
makes debugging such exception in unit tests easier.
Thanks to James Henstridge for the patch.LP #98395: allow unicode output of XML content whose mimetype does not
begin withtext/, per RFC 3023 as well as for content types ending
in+xmlsuch as Mozilla XUL’sapplication/vnd+xml. Thanks to
Justin Ryan for the patch.3.12.2 (2010-04-16)Remove use ofzope.testing.doctestunitin favor of stdlib’sdoctest.Fix bug where xml-rpc requests would hang when served usingpaster.httpserver.3.12.1 (2010-02-21)Ensure thatBaseRequest.traversedoes not call traversal hooks on
elements previously traversed but wrapped in a security proxy.3.12.0 (2009-12-31)Revert change done in 3.6.2, removing thezope.authenticationdependency again. Move theBasicAuthAdapterandFTPAuthadapters
to the newzope.loginpackage.3.11.0 (2009-12-15)MoveEndRequestEventandIEndRequestEventhere fromzope.app.publication.3.10.1 (2009-11-28)Declare minimum dependency onzope.contenttype3.5 (omitted in 3.10).3.10.0 (2009-10-22)Move the implementation ofzope.publisher.contenttypetozope.contenttype.parse, leaving BBB imports and moving tests along.zope.contenttypeis a new but light-weight dependency of this package.Support Python 2.6 by keeping QUERY_STRING out of request.form if
the method is a POST. The original QUERY_STRING is still available if
further processing is needed.Better support the zcmldefaultSkindirective’s behavior (registering
an interface as a default skin) in thesetDefaultSkinfunction.3.9.3 (2009-10-08)Fix the check for untrusted redirects introduced in 3.9.0 so it works with
virtual hosting.3.9.2 (2009-10-07)Make redirect validation works without HTTP_HOST variable.Add DoNotReRaiseException adapter that can be registered
for exceptions to flag that they should not be re-raised by
publisher whenhandle_errorsparameter of thepublishmethod is False.3.9.1 (2009-09-01)Convert a location, passed to a redirect method of HTTPRequest to
string before checking for trusted host redirection, because a
location object may be some non-string convertable to string, like
URLGetter.3.9.0 (2009-08-27)Move some parts ofzope.app.publisherinto this package
duringzope.app.publisherrefactoring:IModifiableUserPreferredLanguagesadapter for requestsbrowser:defaultViewandbrowser:defaultSkinZCML directivesIHTTPView,IXMLRPCViewand like interfacessecurity ZCML declarations for some ofzope.publisherclassesIntroduceIReRaiseExceptioninterface. If during publishing an
exception occurs and for this exception an adapter is available that
returnsFalseon being called, the exception won’t be reraised
by the publisher. This happens only ifhandle_errorsparameter
of thepublish()method is set toFalse. Fixes problems when
acting in a WSGI pipeline with a debugger middleware enabled.Seehttps://bugs.launchpad.net/grok/+bug/332061for details.Fix #98471: Restrict redirects to current host. This causes a ValueError to
be raised in the case of redirecting to a different host. If this is
intentional, the parametertrustedcan be given.Move dependency onzope.testingfrominstall_requirestotests_require.Removetime.sleepin thesupportsRetryhttp request.Add a fix for Internet Explorer versions which upload files with full
filesystem paths as filenames.3.8.0 (2009-05-23)MoveIHTTPException,IMethodNotAllowed, andMethodNotAllowedhere fromzope.app.http, fixing dependency cycles involvingzope.app.http.Move theDefaultViewNameAPI here fromzope.app.publisher.browser,
making it accessible to other packages that need it.3.7.0 (2009-05-13)MoveIViewandIBrowserViewinterfaces intozope.browser.interfaces, leaving BBB imports.3.6.4 (2009-04-26)Add some BBB code to setDefaultSkin to allow IBrowserRequest’s to continue
to work without configuring any special adapter for IDefaultSkin.MovegetDefaultSkinto the skinnable module next to thesetDefaultSkinmethod, leaving a BBB import in place. MarkIDefaultBrowserLayeras aIBrowserSkinTypein code instead of relying on the ZCML to be loaded.3.6.3 (2009-03-18)Mark HTTPRequest as IAttributeAnnotatable ifzope.annotationis
available, this was previously done byzope.app.i18n.RegisterIHTTPRequest->IUserPreferredCharsetsadapter in ZCML
configuration. This was also previously done byzope.app.i18n.3.6.2 (2009-03-14)Add an adapter fromzope.security.interfaces.IPrincipaltozope.publisher.interfaces.logginginfo.ILoggingInfo. It was moved
fromzope.app.securityas a part of refactoring process.Add adapters from HTTP and FTP request tozope.authentication.ILoginPasswordinterface. They are moved fromzope.app.securityas a part of refactoring process. This change adds a
dependency on thezope.authenticationpackage, but it’s okay, since it’s
a tiny contract definition-only package.Seehttp://mail.zope.org/pipermail/zope-dev/2009-March/035325.htmlfor
reasoning.3.6.1 (2009-03-09)Fix: remove IBrowserRequest dependency in http implementation based on
condition for setDefaultSkin. Use ISkinnable instead of IBrowserRequest.3.6.0 (2009-03-08)Clean-up: Move skin related code from zope.publisher.interfaces.browser and
zope.publisher.browser to zope.publihser.interfaces and
zope.publisher.skinnable and provide BBB imports. See skinnable.txt for more
information.Fix: ensure that we only apply skin interface in setDefaultSkin which also
provide IBrowserSkinType. This will ensure that we find a skin if the
applySkin method will lookup for a skin based on this type interface.Fix: Make it possible to use adapters and not only interfaces as skins from
the adapter registry. Right now the defaultSkin directive registers simple
interfaces as skin adapters which will run into a TypeError if someone tries
to adapter such a skin adapter. Probably we should change the defaultSkin
directive and register real adapters instead of using the interfaces as fake
adapters where we expect adapter factories.Feature: allow use ofapplySkinofwith different skin types using the
optionalskinTypeargument, which is by default set toIBrowserSkinType.Feature: implement the default skin pattern within adapters. This allows
us to register default skins for other requests then onlyIBrowserRequestusingIDefaultSkinadapters.Note,ISkinnableandISkinTypeand the skin implementation should
be moved out of the browser request modules. Packages likez3c.jsonrpcdo not depend onIBrowserRequestbut they are skinnable.Feature: addISkinnableinterface which allows us to implement the apply
skin pattern not only forIBrowserRequest.Fix: Don’t cause warnings on Python 2.6Fix: MakeIBrowserPageinheritIBrowserView.MoveIViewandIDefaultViewNamehere fromzope.component.interfaces. Stop inheriting from deprecated (for years)
interfaces defined inzope.component.Remove deprecated code.Clean-up: Movezope.testingfrom extras to dependencies, per Zope
Framework policy. Removezope.app.testingas a dependency: tests run
fine without it.3.5.6 (2009-02-14)Fix an untested code path that incorrectly attempted to construct aNotFound, adding a test.3.5.5 (2009-02-04)LP #322486:setStatus()now allows anyint()-able status value.3.5.4 (2008-09-22)LP #98440: interfaces lost on retried requestLP #273296: dealing more nicely with malformed HTTP_ACCEPT_LANGUAGE headers
within getPreferredLanguages().LP #253362: dealing more nicely with malformed HTTP_ACCEPT_CHARSET headers
within getPreferredCharsets().LP #98284: Pass thesizeargument to readline, as the version of
twisted used in zope.app.twisted supports it.Fix the LP #98284 fix: do not passsizeargument of None that causes
cStringIO objects to barf with a TypeError.3.5.3 (2008-06-20)It turns out that some Web servers (Paste for example) do not send the EOF
character after the data has been transmitted and the read() of the cached
stream simply hangs if no expected content length has been specified.3.5.2 (2008-04-06)A previous fix to handle posting of non-form data broke handling of
form data with extra information in the content type, as in:application/x-www-form-urlencoded; charset=UTF-83.5.1 (2008-03-23)When posting non-form (and non-multipart) data, the request body was
consumed and discarded. This makes it impossible to deal with other
post types, like xml-rpc or json without resorting to overly complex
“request factory” contortions.https://bugs.launchpad.net/zope2/+bug/143873zope.publisher.http.HTTPCharsetswas confused by the Zope 2
publisher, which gives misleading information about which headers
it has.3.5.0 (2008-03-02)Added a PasteDeploy app_factory implementation. This should make
it easier to integrate Zope 3 applications with PasteDeploy. It
also makes it easier to control the publication used, giving far
greater control over application policies (e.g. whether or not to
use the ZODB).3.4.2 (2007-12-07)Made segmentation of URLs not strip (trailing) whitespace from path segments
to allow URLs ending in %20 to be handled correctly. (#172742)3.4.1 (2007-09-29)No changes since 3.4.1b2.3.4.1b2 (2007-08-02)Add support for Python 2.5.Fix a problem withrequest.get()when the object that’s to be
retrieved is the request itself.3.4.1b1 (2007-07-13)No changes.3.4.0b2 (2007-07-05)LP #122054:HTTPInputStreamunderstands both the CONTENT_LENGTH and
HTTP_CONTENT_LENGTH environment variables. It is also now tolerant
of empty strings and will treat those as if the variable were
absent.3.4.0b1 (2007-07-05)Fix caching issue. The input stream never got cached in a temp file
because of a wrong content-length header lookup. Added CONTENT_LENGTH
header check in addition to the previous used HTTP_CONTENT_LENGTH. TheHTTP_prefix is sometimes added by some CGI proxies, but CONTENT_LENGTH
is the right header info for the size.LP #98413:HTTPResponse.handleExceptionshould set the content type3.4.0a1 (2007-04-22)Initial release as a separate project, corresponds to zope.publisher
from Zope 3.4.0a1 |
zope.pypisupport | This package provides a few simple scripts to administrate the Python Package
Index (PyPI).Adding and Removing RolesThe first two scripts allow to grant or revoke the owner role to/from a user
for a list of packages. Here is the syntax:# addrole --user=USER --pwd=PASSWORD TARGETUSER PACKAGE1, PACKAGE2, ...
# delrole --user=USER --pwd=PASSWORD TARGETUSER PACKAGE1, PACKAGE2, ...Optionally, you can also apply the role changes to all packages of the calling
user:# addrole --user=USER --pwd=PASSWORD -a TARGETUSER
# delrole --user=USER --pwd=PASSWORD -a TARGETUSERCHANGES0.1.1 (2009-02-08)Show command line help correctly.Show a error message instead of exception traceback, when user
is not an owner and thus can not give someone else the owner role.Change mailing list to zope-dev at zope.org instead of retired one.Change “cheeseshop” to “pypi” in the package’s url.Fix package description.0.1.0 (2007-11-05)Initial release. Implementedaddroleanddelrolescripts, which
allow one to add and remove roles for a user from one or more packages. |
zope.pytest | zope.pytestIntroductionThis package contains a set of helper functions to test Zope/Grok
usingpytest. It currently lacks special support for doctesting.Core functionszope.pytest.setup.create_appthis function creates a WSGI app object which utilizes a temporary db.zope.pytest.setup.configurethis function parses ZCML files and initializes the component registrySimple example:import my.project
from zope.pytest import create_app, configure
from my.project import Root
def pytest_funcarg__app(request):
return create_app(request, Root())
def pytest_funcarg__config(request):
return configure(request, my.project, 'ftesting.zcml')
def test_hello(app, config):
assert 1 == 1DocumentationComplete documentation can be found onhttp://packages.python.org/zope.pytestCHANGES0.1 (2011-03-05)Initial implementation.Download |
zope.ramcache | zope.ramcacheThis package provides a RAM-based cache implementation for Zope.The classzope.ramcache.ram.RAMCacheis a (persistent) object
meant to be shared between threads. It implementszope.ramcache.interfaces.ram.IRAMCache, which provides a simple
interface to cache information as well as defines a maximum number and
age for cached entries.The cache is based on the idea of using arbitrary objects as keys,
with the ability to associate additional information in the cache key
for any given object. For example, it’s possible to cache information
for an object for multiple different users simultaneously.Changes3.0 (2023-04-06)Add support for Python 3.11.Drop support for Python 2.7, 3.5, 3.6.2.4 (2021-12-06)Add support for Python 3.8, 3.9 and 3.10.Drop support for Python 3.4.2.3 (2018-10-10)Add support for Python 3.7.2.2.0 (2017-09-05)Add support for Python 3.5 and 3.6.Drop support for Python 2.6 and 3.3.Drop support forpython setup.py test.Test PyPy3 on Travis CI.Stop requiring all values to support pickling in order to get
statistics. Instead, returnFalsefor the size if such a value
is found. Fixesissue 1.Change the internal storage format of the RAM cache to require less
memory and be easier to maintain.2.1.0 (2014-12-29)Added support for PyPy. (PyPy3 is pending release of a fix for:https://bitbucket.org/pypy/pypy/issue/1946)Add support for Python 3.4.Add support for testing on Travis.2.0.0 (2013-02-28)Add support for Python 3.3.Replace deprecatedzope.interface.implementsusage with equivalentzope.interface.implementerdecorator.Drop support for Python 2.4 and 2.5.Remove outdated classifier / keywords.1.0 (2009-07-23)Broke out the ram cache functionality fromzope.app.cache. |
zope.rdb | zope.rdbContentszope.rdbOverviewChange History3.5.0 (2009/01/31)3.4.2 (2008/10/10)3.4.1 (2008/10/10)3.4.0 (2007/09/01)DownloadOverviewZope RDBMS Transaction Integration.Provides a proxy for interaction between the zope transaction
framework and the db-api connection. Databases which want to support
sub transactions need to implement their own proxy.Change History3.5.0 (2009/01/31)Use zope.container instead of zope.app.container.3.4.2 (2008/10/10)Re-release 3.4.13.4.1 (2008/10/10)Remove body of DatabaseException, base Exception class already
provides the same functionality.Use hashlib.md5 instead of md5.new if available. md5 module is
deprecated and will be removed in a future Python release.Remove usage of ‘as’ as variable name. ‘as’ is a keyword in Python
2.6 and generates a SyntaxError.3.4.0 (2007/09/01)Initial release as an independent packageDownload |
zope.release | Zope 3 Controlled Package IndexThis package has been developed to support the maintenance of a stable set of
Zope project distributions. It manages the controlled packages configuration
file and supports the generation of buildout configuration files that can be
used by developers.Another use of this package is to use it for testing new distributions against
the index. Here is the workflow for testing a new package against stable set:Install the correct version of this package.Download the version of this package that manages the stable set that
you are interested in. For the Zope 3.4 release, a 3.4 branch exists:$ svn co svn://svn.zope.org/repos/main/zope.release/branches/3.4 zope3.4
$ cd zope3.4Bootstrap the checkout:$ python ./bootstrap.pyRun buildout to create the scripts:$ ./bin/buildoutRun thebuildout.cfggeneration script to build a configuration
file that can be used for testing:$ ./bin/generate-buildoutFrom the generated configuration file, you can now build a testing
environment.Enter the test directory and create a buildout:$ cd test
$ python ../bootstrap.py
$ ./bin/buildoutRun all the tests to verify that all tests are initially passing:$ ./bin/test -vpc1Modify thebuildout.cfgto look for your the new distribution to be
tested:Change the version number of the package of interest in the “versions”
section.Alternative:Check out the new distribution from SVN.Add a “develop path/to/my/package” line in the “buildout” section ofbuildout.cfg.Run the tests, making sure that they all pass.Modifycontrolled-packages.cfgto reference the new version.Find the package that you are interested in and add the new of the
package in theversionsattribute of the package’s section.In the[KGS]section, increase the version number in theversionattribute.Upload the new KGS release:$ cd ..
$ ./bin/uploadOnce the files are uploaded, a crontab-job, running every minute, will
detect the changes incontrolled-pages.cfgand will generate the new
controlled package pages.Update the svn:externals in the Zope3 3.4 branch:$ svn co svn+ssh://svn.zope.org/repos/main/Zope3/branches/3.4 Zope3-3.4
$ ./bin/update-tree
$ cd Zope3-3.4
$ svn diff
$ svn commitNote: I think the process is still a tiny bit too long. I probably write a
script that makes testing a new version of a package easier, but let’s see
whether this process is workable first.Zope Release ToolsThis package provides some tools to manage Zope 3 releases. It extends the
scripts provided byzope.kgswith Zope-specifc scripts, such as updating
the Zope 3 source tree and uploading files to the download location.Here is an examplatory controlled packages configuration file:>>> import tempfile
>>> cfgFile = tempfile.mktemp('-controlled-packages.cfg')
>>> open(cfgFile, 'w').write('''\
... [DEFAULT]
... tested = true
...
... [KGS]
... name = zope-dev
... version = 1.0.0
... changelog = CHANGES.txt
... files = zope-dev-1.0.0.tgz
...
... [packageA]
... versions = 1.0.0
... 1.0.1
...
... [packageB]
... versions = 1.2.3
...
... [packageC]
... # Do not test this package.
... tested = false
... versions = 4.3.1
... ''')>>> import os
>>> dir = os.path.dirname(cfgFile)>>> open(os.path.join(dir, 'CHANGES.txt'), 'w').write('Changes')
>>> open(os.path.join(dir, 'zope-dev-1.0.0.tgz'), 'w').write('TGZ')Uploading FilesOnce the generated files are tested and ready for upload, you can use the
upload script to upload the files to the KGS. Since we do not actually want to
upload files, we simply switch into dry-run mode:>>> from zope.release import upload
>>> upload.DRY_RUN = TrueUsually we only need to upload the controlled packages file, since site script
of thezope.kgspackage will do the rest for us.>>> upload.main((cfgFile, 'download.zope.org:/zope-dev'))
scp ...zope-dev-1.0.0.tgz download.zope.org:/zope-dev/zope-dev-1.0.0.tgz
scp .../CHANGES.txt download.zope.org:/zope-dev/CHANGES.txt
scp ...controlled-packages.cfg ...controlled-packages.cfgUpdating the Zope 3 TreeSince we still want to create a Zope 3 source tree release, we need to be able
to update its externals using the information of the controlled packages
file. Since this script is clearly Zope3-specific, we need a new controlled
packages config file that contains actual packages:>>> import tempfile
>>> zopeCfgFile = tempfile.mktemp('-cp.cfg')
>>> open(zopeCfgFile, 'w').write('''\
... [DEFAULT]
... tested = true
...
... [KGS]
... name = zope
... version = dev
...
... [ZODB3]
... versions = 1.0.0
...
... [ZConfig]
... versions = 1.1.0
...
... [pytz]
... versions = 2007g
...
... [zope.interface]
... versions = 1.2.0
...
... [zope.app.container]
... versions = 1.3.0
... ''')We also need to stub the command execution, since we do not have an actual Zope
3 tree checked out:>>> cmdOutput = {
... 'svn propget svn:externals Zope3/src': '''\
... docutils path/to/docutils
... pytz path/to/pytz
... twisted path/to/twisted
... ZConfig path/to/ZConfig
... ZODB path/to/ZODB''',
... 'svn propget svn:externals Zope3/src/zope': '''\
... interface path/to/zope/interface''',
... 'svn propget svn:externals Zope3/src/zope/app': '''\
... container path/to/zope/app/container''',
... }>>> def do(cmd):
... print cmd
... print '-----'
... return cmdOutput.get(cmd, '')>>> from zope.release import tree
>>> tree.do = doLet’s now run the tree update:>>> tree.main((zopeCfgFile, 'Zope3'))
svn propget svn:externals Zope3/src
-----
svn propset svn:externals
"docutils svn://svn.zope.org/repos/main/docutils/tags/0.4.0/
pytz svn://svn.zope.org/repos/main/pytz/tags/2007g/src/pytz
twisted svn://svn.twistedmatrix.com/.../twisted-core-2.5.0/twisted
ZConfig svn://svn.zope.org/repos/main/ZConfig/tags/1.1.0/ZConfig
ZODB svn://svn.zope.org/repos/main/ZODB/tags/1.0.0/src/ZODB"
Zope3/src
-----
svn propget svn:externals Zope3/src/zope
-----
svn propset svn:externals
"interface svn://svn.zope.org/repos/main/zope.interface/tags/1.2.0/src/zope/interface" Zope3/src/zope
-----
svn propget svn:externals Zope3/src/zope/app
-----
svn propset svn:externals
"container svn://svn.zope.org/repos/main/zope.app.container/tags/1.3.0/src/zope/app/container" Zope3/src/zope/app
-----Zope KGS HistoryNOTE: The releases of this package are synced with the Zope 3 releases.3.4.0 (2009-01-29)Upgraded setuptools to 0.6c9Upgraded ZODB3 to 3.8.1Upgraded zc.resourcelibrary to 1.0.1Upgraded zope.app.authentication to 3.4.43.4.0c7 (2008-09)Upgraded zope.server to 3.4.3Upgraded zope.app.server to 3.4.1 and 3.4.2Upgraded zope.publisher to 3.4.5, 3.4.6Upgraded zc.zope3recipes to 0.6.2Upgraded zope.testing to 3.5.6Upgraded z3c.form to 1.9.0Upgraded z3c.formui to 1.4.1Upgraded z3c.formdemo to 1.5.3Upgraded z3c.formjs to 0.4.0Upgraded z3c.formjsdemo to 0.3.1Upgraded zdaemon to 2.0.2Upgraded zope.app.locales to 3.4.2, 3.4.3, 3.4.4, 3.4.5Upgraded z3c.traverser to 0.2.2, 0.2.3Upgraded zope.annotation to 3.4.1Upgraded zope.app.file to 3.4.3, 3.4.4Upgraded zope.cachedescriptors to 3.4.1Upgraded zope.securitypolicy to 3.4.1Upgraded zc.buildout to 1.1.1Fixed backwards incompatible change in handling of environment option.Seems to have fixed sporadic test failures under high system load3.4.0c6 (2008-08-14)Upgraded zope.publisher to 3.4.3.Upgraded zope.app.authentication to 3.4.3. Removed previous versions,
as they are not compatible with zope.app.container >= 3.5.4Upgraded zope.app.container to 3.5.6Upgraded zope.testing 3.5.1 to 3.5.4.Upgraded zc.buildout 1.0.0 to 1.1.0.New global buildout option, unzipRecompiles pyc files to have correct paths.Upgraded zope.proxy 3.4.0 to 3.4.2: fixes problems using Python 2.5 on
AMD64.Upgraded zope.security 3.4.0 to 3.4.1: fixes problems using Python 2.5 on
AMD64.Upgraded z3c.form 1.8.0 to 1.8.2: fixes error on Python 2.5.3.4.0c5 (2008-07-31)Upgraded setuptools to 0.6c8.Upgraded zope.app.security to 3.5.2. This is a major version bump, but the
new feature in 3.5 should not interfere with existing code and 3.5.2 fixes a
deprecation warning between Python 2.4 and 2.5.3.4.0c4 (2008-07-30)no changes3.4.0c3 (2008-07-30)Upgraded z3c.coverage to 1.1.2Upgraded zope.app.applicationcontrol to 3.4.3Upgraded zope.app.cache to 3.4.1Upgraded zope.app.pagetemplate to 3.4.1Upgraded zope.app.pythonpage to 3.4.1Upgraded zope.app.renderer to 3.4.3Upgraded zope.app.wsgi to 3.4.1Upgraded zope.traversing to 3.4.13.4.0c2 (2008-07-23)Upgraded ClientForm to 0.2.9Upgraded zope.app.debug to 3.4.1Upgraded zope.app.testing to 3.4.2Upgraded zope.app.twisted to 3.4.1Upgraded zope.server to 3.4.23.4.0c1 (2008-01-31)Added a KGS sectionUpgraded ZConfig to 2.5.1Upgraded ZODB3 to 3.8.0c1 and 3.8.0Upgraded pytz to 2007kUpgraded z3c.coverage to 1.1.1 (major version change)Upgraded z3c.form to 1.8.0 (major version change)Upgraded z3c.formui to 1.4.1 (major version change)Upgraded z3c.layer to 0.2.3Upgraded z3c.pagelet to 1.0.2Upgraded z3c.rml to 0.7.3 and removed version 0.7.1Upgraded z3c.traverser to 0.2.1Upgraded zc.buildout to 1.0.0Upgraded zc.resourcelibrary to 0.8.2Upgraded zc.zope3recipes to 0.6.1Upgraded zope.app.apidoc to 3.4.3Upgraded zope.app.container to 3.5.3Upgraded zope.app.file to 3.4.2Upgraded zope.app.locales to 3.4.1. Removed 3.4.0Upgraded zope.app.onlinehelp to 3.4.1Upgraded zope.app.publication to 3.4.3Upgraded zope.app.securitypolicy to 3.4.6Upgraded zope.interface to 3.4.1Upgraded zope.minmax to 1.1.0 (major version change)Upgraded zope.publisher to 3.4.2Upgraded zope.tal to 3.4.1Upgraded zope.viewlet to 3.4.2No history was recorded before version 3.4.0c1 |
zope.renderer | This package provides a framework to convert a string from one format, such as
Structured or Restructured Text, to another, such as HTML. Converters are
looked up by adapter and uses other packages to implement the converters.CHANGES4.0.0a1 (2013-03-01)Renamed package fromzope.app.renderertozope.renderer.Added support for Python 3.3.Replaced deprecatedzope.interface.implementsusage with equivalentzope.interface.implementerdecorator.Dropped support for Python 2.4 and 2.5.3.5.1 (2009-07-21)Require the newromanpackage, since docutils does not install it
correctly.3.5.0 (2009-01-17)Adapted to docutils 0.5 for ReST rendering: get rid of the
ZopeTranslator class, because docutils changed the way it
uses translator so previous implementation doesn’t work anymore.
Instead, use publish_parts and join needed parts in therendermethod of the renderer itself.Removed deprecated meta.zcml stuff and zpkg stuff.Replaced __used_for__ with zope.component.adapts calls.3.4.0 (2007-10-27)Initial release independent of the main Zope tree. |
zope.schema | zope.schemaSchemas extend the notion of interfaces to detailed descriptions of
Attributes (but not methods). Every schema is an interface and
specifies the public fields of an object. Afieldroughly
corresponds to an attribute of a Python object. But a Field provides
space for at least a title and a description. It can also constrain
its value and provide a validation method. Besides you can optionally
specify characteristics such as its value being read-only or not
required.Seehttps://zopeschema.readthedocs.io/for more information.Changes7.0.1 (2023-01-02)Fix fallback whenzope.i18nmessageidis not installed (regression
introduced in 7.0.0).7.0.0 (2023-01-01)Add support for Python 3.11.Drop support for Python 2.7, 3.5, 3.6.Dropzope.schema._compatmodule.Fix test deprecation warning on Python 3.11.
(#112)6.2.1 (2022-09-14)Fix outsized integer test values that break tests on newer Python versions.
(#115)6.2.0 (2021-10-18)Add support for Python 3.10.6.1.1 (2021-10-13)Fix incompatibility introduced in 6.1.0:
TheBoolfield constructor implicitly set required to False if not given.
While this is the desired behavior in most common cases,
it broke special cases.
Seeissue 104(scroll down, it is around thereopen).6.1.0 (2021-02-09)FixIField.requiredto not be required by default.
Seeissue 104.6.0.1 (2021-01-25)Bring branch coverage to 100%.Add support for Python 3.9.Fix FieldUpdateEvent implementation by having anobjectattribute as theIFieldUpdatedEventinterfaces claims there should be.6.0.0 (2020-03-21)Require zope.interface 5.0.Ensure the resolution orders of all fields are consistent and make
sense. In particular,Boolfields now correctly implementIBoolbeforeIFromUnicode. Seeissue 80.Add support for Python 3.8.Drop support for Python 3.4.5.0.1 (2020-03-06)Fix: addText.unicode_normalization = 'NFC'as default, because some are
persisting schema fields. Setting that attribute only in__init__breaks loading old objects.5.0 (2020-03-06)SetIDecimalattributesmin,maxanddefaultasDecimaltype instead ofNumber.
Seeissue 88.Enable unicode normalization forTextfields.
The default is NFC normalization. Valid forms are ‘NFC’, ‘NFKC’, ‘NFD’, and
‘NFKD’. To disable normalization, setunicode_normalizationtoFalseorNonewhen calling__init__of theTextfield.
Seeissue 86.4.9.3 (2018-10-12)Fix a ReST error in getDoc() results when having “subfields”
with titles.4.9.2 (2018-10-11)Make sure that the title forIObject.validate_invariantsis a unicode
string.4.9.1 (2018-10-05)FixSimpleTermtoken for non-ASCII bytes values.4.9.0 (2018-09-24)MakeNativeStringandNativeStringLinedistinct types that
implement the newly-distinct interfacesINativeStringandINativeStringLine. Previously these were just aliases for eitherText(on Python 3) orBytes(on Python 2).FixField.getDoc()whenvalue_typeorkey_typeis
present. Previously it could produce ReST that generated Sphinx
warnings. Seeissue 76.MakeDottedNameaccept leading underscores for each segment.AddPythonIdentifier, which accepts one segment of a dotted
name, e.g., a python variable or class.4.8.0 (2018-09-19)Add the interfaceIFromBytes, which is implemented by the
numeric and bytes fields, as well asURI,DottedName, andId.Fix passingNoneas the description to a field constructor. Seeissue 69.4.7.0 (2018-09-11)MakeWrongTypehave anexpected_typefield.AddNotAnInterface, an exception derived fromWrongTypeandSchemaNotProvidedand raised by the constructor ofObjectand when validation fails forInterfaceField.GiveSchemaNotProvidedaschemafield.GiveWrongContainedTypeanerrorslist.GiveTooShort,TooLong,TooBigandTooSmallaboundfield and the common superclassesLenOutOfBounds,OrderableOutOfBounds, respectively, both of which inherit fromOutOfBounds.4.6.2 (2018-09-10)Fix checking a field’s constraint to set thefieldandvalueproperties if the constraint raises aValidationError. Seeissue 66.4.6.1 (2018-09-10)Fix theFieldconstructor to again allowMessageIDvalues
for thedescription. This was a regression introduced with the
fix forissue 60. Seeissue 63.4.6.0 (2018-09-07)Add support for Python 3.7.Objectinstances call their schema’svalidateInvariantsmethod by default to collect errors from functions decorated with@invariantwhen validating. This can be disabled by passingvalidate_invariants=Falseto theObjectconstructor. Seeissue 10.ValidationErrorcan be sorted on Python 3.DottedNameandIdconsistently handle non-ASCII unicode
values on Python 2 and 3 by raisingInvalidDottedNameandInvalidIdinfromUnicoderespectively. Previously, aUnicodeEncodeErrorwould be raised on Python 2 while Python 3
would raise the descriptive exception.Fieldinstances are hashable on Python 3, and use a defined
hashing algorithm that matches what equality does on all versions of
Python. Previously, on Python 2, fields were hashed based on their
identity. This violated the rule that equal objects should have
equal hashes, and now they do. Since having equal hashes does not
imply that the objects are equal, this is not expected to be a
compatibility problem. Seeissue 36.Fieldinstances are only equal when their.interfaceis
equal. In practice, this means that two otherwise identical fields
of separate schemas are not equal, do not hash the same, and can
both be members of the samedictorset. Prior to this
release, when hashing was identity based but only worked on Python
2, that was the typical behaviour. (Field objects that arenotmembers of a schema continue to compare and hash equal if they have
the same attributes and interfaces.) Seeissue 40.Orderable fields, includingInt,Float,Decimal,Timedelta,DateandTime, can now have amissing_valuewithout needing to specify concreteminandmaxvalues (they must still specify adefaultvalue). Seeissue 9.Choice,SimpleVocabularyandSimpleTermall gracefully
handle using Unicode token values with non-ASCII characters by encoding
them with thebackslashreplaceerror handler. Seeissue 15andPR
6.All instances ofValidationErrorhave afieldandvalueattribute that is set to the field that raised the exception and the
value that failed validation.Float,IntandDecimalfields raiseValidationErrorsubclasses for literals that cannot be parsed. These subclasses also
subclassValueErrorfor backwards compatibility.Add a new exceptionSchemaNotCorrectlyImplemented, a subclass ofWrongContainedTypethat is raised by theObjectfield. It
has a dictionary (schema_errors) mapping invalid schema
attributes to their corresponding exception, and a list
(invariant_errors) containing the exceptions raised by
validating invariants. Seeissue 16.Add new fieldsMappingandMutableMapping, corresponding to
the collections ABCs of the same name;Dictnow extends and
specializesMutableMappingto only accept instances ofdict.Add new fieldsSequenceandMutableSequence, corresponding
to the collections ABCs of the same name;Tuplenow extendsSequenceandListnow extendsMutableSequence.Add new fieldCollection, implementingICollection. This is
the base class ofSequence. Previously this was known asAbstractCollectionand was not public. It can be subclassed to
addvalue_type,_typeanduniqueattributes at the class
level, enabling a simpler constructor call. Seeissue 23.MakeObjectrespect aschemaattribute defined by a
subclass, enabling a simpler constructor call. Seeissue 23.Add fields and interfaces representing Python’s numeric tower. In
descending order of generality these areNumber,Complex,Real,RationalandIntegral. TheIntclass extendsIntegral, theFloatclass extendsReal, and theDecimalclass extendsNumber. Seeissue 49.MakeIterableandContainerproperly implementIIterableandIContainer, respectively.MakeSimpleVocabulary.fromItemsaccept triples to allow
specifying the title of terms. Seeissue 18.MakeTreeVocabulary.fromDictonly createITitledTokenizedTermswhen a title is actually provided.MakeChoicefields reliably raise aValidationErrorwhen a
named vocabulary cannot be found; for backwards compatibility this
is also aValueError. Previously this only worked when the
defaultVocabularyRegistrywas in use, not when it was replaced
withzope.vocabularyregistry. Seeissue 55.MakeSimpleVocabularyandSimpleTermhave value-based
equality and hashing methods.All fields of the schema of anObjectfield are bound to the
top-level value being validated before attempting validation of
their particular attribute. Previously onlyIChoicefields were
bound. Seeissue 17.Share the internal logic ofObjectfield validation andzope.schema.getValidationErrors. Seeissue 57.MakeField.getDoc()return more information about the properties
of the field, such as its required and readonly status. Subclasses
can add more information using the new methodField.getExtraDocLines(). This is used to generate Sphinx
documentation when usingrepoze.sphinx.autointerface. Seeissue 60.4.5.0 (2017-07-10)Drop support for Python 2.6, 3.2, and 3.3.Add support for Python 3.5 and 3.6.Drop support for ‘setup.py test’. Use zope.testrunner instead.4.4.2 (2014-09-04)Fix description of min max field: max value is included, not excluded.4.4.1 (2014-03-19)Add support for Python 3.4.4.4.0 (2014-01-22)Add an event on field properties to notify that a field has been updated.
This event enables definition of subscribers based on an event, a context
and a field. The event contains also the old value and the new value.
(also see packagezope.schemaeventthat define a field event handler)4.3.3 (2014-01-06)PEP 8 cleanup.Don’t raise RequiredMissing if a field’s defaultFactory returns the field’s
missing_value.Updateboostrap.pyto version 2.2.Add the ability to swallow ValueErrors when rendering a SimpleVocabulary,
allowing for cases where vocabulary items may be duplicated (e.g., due to
user input).Include the field name inConstraintNotSatisfied.4.3.2 (2013-02-24)Fix Python 2.6 support. (Forgot to run tox with all environments before last
release.)4.3.1 (2013-02-24)Make sure that we do not fail during bytes decoding of term token when
generated from a bytes value by ignoring all errors. (Another option would
have been to hexlify the value, but that would break way too many tests.)4.3.0 (2013-02-24)Fix a bug where bytes values were turned into tokens inproperly in
Python 3.Addzope.schema.fieldproperty.createFieldProperties()function which
maps schema fields intoFieldPropertyinstances.4.2.2 (2012-11-21)Add support for Python 3.3.4.2.1 (2012-11-09)Fix the default property of fields that have no defaultFactory attribute.4.2.0 (2012-05-12)Automate build of Sphinx HTML docs and running doctest snippets via tox.Drop explicit support for Python 3.1.Introduce NativeString and NativeStringLine which are equal to Bytes and
BytesLine on Python 2 and Text and TextLine on Python 3.Change IURI from a Bytes string to a “native” string. This is a backwards
incompatibility which only affects Python 3.Bring unit test coverage to 100%.Move doctests from the package and wired up as normal Sphinx documentation.Add explicit support for PyPy.Add support for continuous integration usingtoxandjenkins.Drop the externalsixdependency in favor of a much-trimmedzope.schema._compatmodule.Ensure tests pass when run undernose.Addsetup.py devalias (runssetup.py developplus installsnoseandcoverage).Addsetup.py docsalias (installsSphinxand dependencies).4.1.1 (2012-03-23)Remove trailing slash in MANIFEST.in, it causes Winbot to crash.4.1.0 (2012-03-23)Add TreeVocabulary for nested tree-like vocabularies.Fix broken Object field validation where the schema contains a Choice with
ICountextSourceBinder source. In this case the vocabulary was not iterable
because the field was not bound and the source binder didn’t return the
real vocabulary. Added simple test for IContextSourceBinder validation. But a
test with an Object field with a schema using a Choice with
IContextSourceBinder is still missing.4.0.1 (2011-11-14)Fix bug infromUnicodemethod ofDottedNamewhich would fail
validation on being given unicode. Introduced in 4.0.0.4.0.0 (2011-11-09)Fix deprecated unittest methods.Port to Python 3. This adds a dependency on six and removes support for
Python 2.5.3.8.1 (2011-09-23)Fix broken Object field validation. Previous version was using a volatile
property on object field values which ends in a ForbiddenAttribute error
on security proxied objects.3.8.0 (2011-03-18)Implement adefaultFactoryattribute for all fields. It is a callable
that can be used to compute default values. The simplest case is:Date(defaultFactory=datetime.date.today)If the factory needs a context to compute a sensible default value, then it
must provideIContextAwareDefaultFactory, which can be used as follows:@provider(IContextAwareDefaultFactory)
def today(context):
return context.today()
Date(defaultFactory=today)3.7.1 (2010-12-25)Rename the validation token, used in the validation of schema with Object
Field to avoid infinite recursion:__schema_being_validatedbecame_v_schema_being_validated,
a volatile attribute, to avoid persistency and therefore,
read/write conflicts.Don’t allow “[]^`” in DottedName.https://bugs.launchpad.net/zope.schema/+bug/1912363.7.0 (2010-09-12)Improve error messages when term tokens or values are duplicates.Fix the buildout so the tests run.3.6.4 (2010-06-08)fix validation of schema with Object Field that specify Interface schema.3.6.3 (2010-04-30)Prefer the standard libraries doctest module to the one from zope.testing.3.6.2 (2010-04-30)Avoid maximum recursion when validating Object field that points to cyclesMake the dependency onzope.i18nmessageidoptional.3.6.1 (2010-01-05)Allow “setup.py test” to run at least a subset of the tests runnable
viabin/test(227 forsetup.py testvs. 258. forbin/test)Makezope.schema._bootstrapfields.ValidatedPropertydescriptor
work under Jython.Make “setup.py test” tests pass on Jython.3.6.0 (2009-12-22)Prefer zope.testing.doctest over doctestunit.Extend validation error to hold the field name.Add FieldProperty class that uses Field.get and Field.set methods
instead of storing directly on the instance __dict__.3.5.4 (2009-03-25)Don’t fail trying to validate default value for Choice fields with
IContextSourceBinder object given as a source. Seehttps://bugs.launchpad.net/zope3/+bug/340416.Add an interface forDottedNamefield.AddvocabularyNameattribute to theIChoiceinterface, change
“vocabulary” attribute description to be more sensible, making itzope.schema.Fieldinstead of plainzope.interface.Attribute.Make IBool interface of Bool more important than IFromUnicode so adapters
registered for IBool take precendence over adapters registered for
IFromUnicode.3.5.3 (2009-03-10)Make Choice and Bool fields implement IFromUnicode interface, because
they do provide thefromUnicodemethod.Change package’s mailing list address to zope-dev at zope.org, as
zope3-dev at zope.org is now retired.Fix package’s documentation formatting. Change package’s description.Add buildout part that builds Sphinx-generated documentation.Remove zpkg-related file.3.5.2 (2009-02-04)Made validation tests compatible with Python 2.5 again (hopefully not
breaking Python 2.4)Add an __all__ package attribute to expose documentation.3.5.1 (2009-01-31)Stop using the old old set type.Make tests compatible and silent with Python 2.4.Fix __cmp__ method in ValidationError. Show some side effects based on the
existing __cmp__ implementation. See validation.txtMake ‘repr’ of the ValidationError and its subclasses more sensible. This
may require you to adapt your doctests for the new style, but now it makes
much more sense for debugging for developers.3.5.0a2 (2008-12-11)Move zope.testing to “test” extras_require, as it is not needed
for zope.schema itself.Change the order of classes in SET_TYPES tuple, introduced in
previous release to one that was in 3.4 (SetType, set), because
third-party code could be dependent on that order. The one
example is z3c.form’s converter.3.5.0a1 (2008-10-10)Add the doctests to the long description.Remove use of deprecated ‘sets’ module when running under Python 2.6.Remove spurious doctest failure when running under Python 2.6.Add support to bootstrap on Jython.Add helper methods for schema validation:getValidationErrorsandgetSchemaValidationErrors.zope.schema now works on Python2.53.4.0 (2007-09-28)Add BeforeObjectAssignedEvent that is triggered before the object
field sets a value.3.3.0 (2007-03-15)Corresponds to the version of the zope.schema package shipped as part of
the Zope 3.3.0 release.3.2.1 (2006-03-26)Corresponds to the version of the zope.schema package shipped as part of
the Zope 3.2.1 release.Fix missing import of ‘VocabularyRegistryError’. Seehttp://www.zope.org/Collectors/Zope3-dev/544.3.2.0 (2006-01-05)Corresponds to the version of the zope.schema package shipped as part of
the Zope 3.2.0 release.Add “iterable” sources to replace vocabularies, which are now deprecated
and scheduled for removal in Zope 3.3.3.1.0 (2005-10-03)Corresponds to the version of the zope.schema package shipped as part of
the Zope 3.1.0 release.Allow ‘Choice’ fields to take either a ‘vocabulary’ or a ‘source’
argument (sources are a simpler implementation).Add ‘TimeDelta’ and ‘ASCIILine’ field types.3.0.0 (2004-11-07)Corresponds to the version of the zope.schema package shipped as part of
the Zope X3.0.0 release. |
zope.schemaevent | ContentsIntroductionContributorsChangelog0.3 (2017-07-13)0.2 (2014-01-30)0.1 (2014-01-22)IntroductionEnable handler for event triggered on field by adding subscriber.
We make the configuration glue betweenzope.schema(which doesn’t depend on zope.component) andzope.component.Example:<subscriber
for=".interfaces.IExampleObject
zope.schema.interfaces.IText
zope.schema.interfaces.IFieldUpdatedEvent"
handler=".localrolefield.set_local_role_on_object" />ContributorsAffinitic, Bubblenet - Original AuthorIMIO - ClientChangelog0.3 (2017-07-13)Add support for Python 3.4, 3.5, 3.6 and PyPy.Drop support for Python 2.6.0.2 (2014-01-30)Fix release, better manifest.in
[jfroche]0.1 (2014-01-22)Initial release
[jfroche]Package created using templer
[jfroche] |
zope.security | zope.securityThe Security framework provides a generic mechanism to implement security
policies on Python objects.Documentation is available athttps://zopesecurity.readthedocs.io/Changes6.2 (2023-10-05)Makenext()on C proxies call__next__rather thannext(see
PEP 3114), and drop support for the Python 2nextmethod name from
pure-Python proxies.Drop usingsetup_requiresdue to constant problems on GHA.Add support for Python 3.12.6.1 (2023-01-18)Remove more proxying code for names that no longer exist in Python 3.
(#92)6.0 (2023-01-16)Remove proxying code for names that no longer exist in Python 3.
(#92)Drop support for Python 2.7, 3.5, 3.6.5.8 (2022-11-30)The extrauntrustedpythonnow for Python 3, too, installszope.untrustedpython.5.7 (2022-11-17)Release to rebuild full set of binary wheels.5.6 (2022-11-16)Add support for building arm64 wheels on macOS.5.5 (2022-11-06)Add support for final release of Python 3.11.5.4 (2022-09-15)Disable unsafe math optimizations in C code. Seepull request 89.5.3 (2022-04-27)Allow calling bound methods of some built-in objects such as().__repr__and{}.__repr__by default. This worked on Python 2, but raisedForbiddenAttributeon Python 3. Seeissue 75.Remove usage ofunittest.makeSuiteas it is deprecated in Python 3.11+.
Seeissue 83.Add support for Python 3.11 (as of 3.11.0a7).5.2 (2022-03-10)Add support for Python 3.9 and 3.10.5.1.1 (2020-03-23)Ensure all objects have consistent interface resolution orders (if
all dependencies are up-to-date). Seeissue 71.5.1.0 (2020-02-14)Let proxied interfaces be iterated on Python 3. This worked on
Python 2, but raisedForbiddenAttributean Python 3. Seezope.interface issue 141.Allow to use a common Sphinx version for Python 2 and 3.5.0.0 (2019-11-11)Drop support for Python 3.4.Add support for Python 3.8.Properly declare dependency on zope.schema >= 4.2.0, introduced in
zope.security 4.2.1.Fix dict item view iteration on PyPy3 7.x.4.3.1 (2019-01-03)Fix the decimal.Decimal checker,__truediv__was missing causingForbiddenAttributeon aProxyFactory(Decimal('1'))/ 1operation4.3.0 (2018-08-24)Add the interfaceISystemPrincipaland makezope.security.management.system_usera regular object that
implements this interface. This facilitates providing adapter
registrations specifically for thesystem_user.4.2.3 (2018-08-09)Add support for Python 3.7.4.2.2 (2018-01-11)Make the pure-Python proxy on Python 2notcheck permissions for__unicode__just like the C implementation. Note that__str__is checked for both implementations on both Python 2 and
3, but if there is no__unicode__method defined, Python 2’s
automatic fallback to__str__isnotchecked whenunicodeis called. Seeissue 10.4.2.1 (2017-11-30)Fix the default values forPermissionfieldstitleanddescriptionunder Python 2. Seeissue 48.Change theIPermission.idfromText(unicode) to aNativeStringLine. This matches what ZCML creates and what is
usually written in source code.4.2.0 (2017-09-20)Fix the extremely rare potential for a crash when the C extensions
are in use. Seeissue 35.Fixissue 7: The
pure-Python proxy didn’t propagateTypeErrorfrom__repr__and__str__like the C implementation did.Fixissue 27:
iteration ofzope.interface.providedBy()is now allowed by
default on all versions of Python. Previously it only worked on
Python 2. Note thatprovidedByreturns unproxied objects for backwards
compatibility.Fix__length_hint__of proxied iterator objects. Previously it
was ignored.Drop support for Python 3.3.Enable coveralls.io for coverage measurement and run doctests on all
supported Python versions.Fixissue 9:
iteration ofitertools.groupbyobjects is now allowed by
default. In addition, iteration of all the custom iterator types
defined in itertools are also allowed by default.Simplify the internal_compat.pymodule now that we only run on
newer Python versions. SeePR 32.RespectPURE_PYTHONat runtime. At build time, always try to
build the C extensions on supported platforms, ignoringPURE_PYTHON. Seeissue 33.Fix watching checkers (ZOPE_WATCH_CHECKERS=1) in pure-Python
mode. Seeissue 8.Remove unused internal files fromtests/.Removezope.security.setup. It was unused and did not work
anyway.Fix the pure-Python proxy on Python 2 letting__getslice__and__setslice__fall through to__getitem__or__setitem__,
respectively, if it raised an error.Fix the pure-Python proxy calling a wrapped__getattr__or__getattribute__more than once in situations where the C
implementation only called it one time (when it raised an
AttributeError).Reach 100% test coverage and maintain it via automated checks.4.1.1 (2017-05-17)Fixissue 23:
iteration ofcollections.OrderedDictand its various views is
now allowed by default on all versions of Python.As a further fix for issue 20, iteration ofBTreeitself is now
allowed by default.4.1.0 (2017-04-24)When testingPURE_PYTHONenvironments undertox, avoid poisoning
the user’s global wheel cache.Drop support for Python 2.6 and 3.2.Add support for Python 3.5 and 3.6.Fixissue 20:
iteration of pure-PythonBTrees.items(), and also creating a list fromBTrees.items()on Python 3. The same applies forkeys()andvalues().4.0.3 (2015-06-02)Fix iteration over security proxies in Python 3 using the pure-Python
implementation.4.0.2 (2015-06-02)Fix compatibility withzope.proxy4.1.5 under PyPy.Fix the very first call toremoveSecurityProxyreturning
incorrect results if given a proxy under PyPy.4.0.1 (2014-03-19)Add support for Python 3.4.4.0.0 (2013-07-09)Updateboostrap.pyto version 2.2.Bugfix: ZOPE_WATCH_CHECKERS=2 used to incorrectly suppress
unauthorized/forbidden warnings.Bugfix: ZOPE_WATCH_CHECKERS=1 used to miss most of the checks.4.0.0b1 (2013-03-11)Add support for PyPy.Fix extension compilation on windows python 3.x4.0.0a5 (2013-02-28)Undo changes from 4.0.0a4. Instead,zope.untrustedpythonis only
included during Python 2 installs.4.0.0a4 (2013-02-28)Removeuntrustedpythonextra again, since we do not want to supportzope.untrustedpythonin ZTK 2.0. If BBB is really needed, we will create
a 3.10.0 release.4.0.0a3 (2013-02-15)Fix test breakage in 4.0.0a2 due to deprecation strategy.4.0.0a2 (2013-02-15)Add back theuntrustedpythonextra: now pulls inzope.untrustedpython. Restored deprecated backward-compatible imports
forzope.security.untrustedpython.{builtins,interpreter,rcompile}(the extra and the imports are to be removed in version 4.1).4.0.0a1 (2013-02-14)Add support for Python 3.2 and 3.3.Bring unit test coverage to 100%.zope.security.untrustedpythonmoved to separate project:zope.untrustedpythonConvert use ofassertin non-test code to apprpriate error types:Non-dict’s passed toChecker.__init__.Remove dprecattion ofzope.security.adapter.TrustedAdapterFactory.
Although it has been marked as deprectaed since before Zope3 3.2, current
versions ofzope.compoentstill rely on it.Convert doctests to Sphinx documentation in ‘docs’.Addsetup.py docsalias (installsSphinxand dependencies).Addsetup.py devalias (runssetup.py developplus installsnoseandcoverage).Make non-doctest tests fully independent ofzope.testing.Two modules,zope.security.checkerandzope.security.management,
register cleanups withzope.testingIFF it is importable, but the
tests no longer rely on it.Enable building extensions without thesvn:externalof thezope.proxyheaders into ourincludedir.Bumpzope.proxydependency to “>= 4.1.0” to enable compilation
on Py3k.Replace deprecatedzope.component.adaptsusage with equivalentzope.component.adapterdecorator.Replace deprecatedzope.interface.classProvidesusage with equivalentzope.interface.providerdecorator.Replace deprecatedzope.interface.implementsusage with equivalentzope.interface.implementerdecorator.Drop support for Python 2.4 and 2.5.Add test convenience helpercreate_interactionandwith interaction().3.9.0 (2012-12-21)Pinzope.proxy >= 4.1.0Ship with an includedproxy.hheader which is compatible with the
4.1.x version ovzope.proxy.3.8.5 (2012-12-21)Ship with an includedproxy.hheader which is compatible with the
supported versions ofzope.proxy.3.8.4 (2012-12-20)Pinzope.proxy >= 3.4.2, <4.1dev3.8.3 (2011-09-24)Fix a regression introduced in 3.8.1:zope.location's LocationProxy
did not get a security checker ifzope.security.decoratorwas not
imported manually. Nowzope.security.decoratoris imported inzope.security.proxywithout re-introducing the circular import fixed in
3.8.1.3.8.2 (2011-05-24)Fix a test that failed on Python 2.7.3.8.1 (2011-05-03)Fix circular import beweenzope.security.decoratorandzope.security.proxywhich led to anImportErrorwhen only
importingzope.security.decorator.3.8.0 (2010-12-14)Add tests for our ownconfigure.zcml.Addzcmlextra dependencies; run related tests only ifzope.configurationis available.Run tests related to theuntrustedpythonfunctionality only ifRestrictedPythonis available.3.7.3 (2010-04-30)Prefer the standard library’sdoctestmodule to the one fromzope.testing.EnsurePermissionIdsVocabularydirectly providesIVocabularyFactory,
even though it might be unnecessary becauseIVocabularyFactoryis
provided in ZCML.Remove the dependency on the zope.exceptions package: zope.security.checker
now importsDuplicationErrorfrom zope.exceptions if available, otherwise
it defines a package-specificDuplicationErrorclass which inherits from
Exception.3.7.2 (2009-11-10)Add compatibility with Python 2.6 abstract base classes.3.7.1 (2009-08-13)Fix for LP bug 181833 (from Gustavo Niemeyer). Before “visiting” a
sub-object, a check should be made to ensure the object is still valid.
Because garbage collection may involve loops, if you garbage collect an
object, it is possible that the actions done on this object may modify the
state of other objects. This may cause another round of garbage collection,
eventually generating a segfault (see LP bug). The Py_VISIT macro does the
necessary checks, so it is used instead of the previous code.3.7.0 (2009-05-13)Makepytza soft dependency: the checker forpytz.UTCis
created / tested only if the package is already present. Runbin/test_pytzto run the tests withpytzon the path.3.6.3 (2009-03-23)Ensure that simple zope.schema’sVocabularyRegistryis used forPermissionVocabularytests, because it’s replaced implicitly in
environments withzope.app.schemainstalled that makes that tests
fail.Fix a bug inDecoratedSecurityCheckerDescriptorwhich made
security-wrapping location proxied exception instances throw
exceptions on Python 2.5.
Seehttps://bugs.launchpad.net/zope3/+bug/2518483.6.2 (2009-03-14)Addzope.i18nmessageid.Messageto non-proxied basic types. It’s okay,
because messages are immutable. Done previously byzope.app.security.Add__name__and__parent__attributes to list of available by
default. Done previously byzope.app.security.MovePermissionsVocabularyandPermissionIdsVocabularyvocabularies
to thezope.security.permissionmodule from thezope.app.securitypackage.Add zcml permission definitions for most common and useful permissions,
likezope.Viewandzope.ManageContent, as well as for the specialzope.Publicpermission. They are placed in a separatepermissions.zcmlfile, so it can be easily excluded/redefined. They are
selected part of permissions moved fromzope.app.securityand used by
manyzope.*packages.AddaddCheckerPublichelper function inzope.security.testingmodule
that registers the “zope.Public” permission as an IPermission utility.Add security declarations for thezope.security.permisson.Permissionclass.Improve test coverage.3.6.1 (2009-03-10)Usefromimports instead ofzope.deferredto avoid circular
import problems, thus drop dependency onzope.deferredimport.RaiseNoInteractionwhenzope.security.checkPermissionis called
without interaction being active (LP #301565).Don’t define security checkers for deprecated set types from the
“sets” module on Python 2.6. It’s discouraged to use them andsetandfrozensetbuilt-in types should be used instead.Change package’s mailng list address to zope-dev at zope.org as
zope3-dev at zope.org is now retired.Remove old zpkg-related files.3.6.0 (2009-01-31)Install decorated security checker support onLocationProxyfrom the
outside.Add support to bootstrap on Jython.Move theprotectclassmodule fromzope.app.securityto this
package to reduce the number of dependencies onzope.app.security.Move the<module>directive implementation fromzope.app.securityto this package.Move the<class>directive implementation fromzope.app.componentto this package.3.5.2 (2008-07-27)Make C code compatible with Python 2.5 on 64bit architectures.3.5.1 (2008-06-04)Addfrozenset,set,reversed, andsortedto the list of
safe builtins.3.5.0 (2008-03-05)Changed title forzope.security.management.system_userto be more
presentable.3.4.3 - (2009/11/26)Backport a fix made by Gary Poster to the 3.4 branch:
Fix for LP bug 181833 (from Gustavo Niemeyer). Before “visiting” a
sub-object, a check should be made to ensure the object is still valid.
Because garbage collection may involve loops, if you garbage collect an
object, it is possible that the actions done on this object may modify the
state of other objects. This may cause another round of garbage collection,
eventually generating a segfault (see LP bug). ThePy_VISITmacro does
the necessary checks, so it is used instead of the previous code.3.4.2 - (2009/03/23)Add dependency onzope.threadto setup.py; without it, the tests were
failing.Backport a fix made by Albertas Agejevas to the 3.4 branch. He
fixed a bug in DecoratedSecurityCheckerDescriptor which made
security-wrapping location proxied exception instances throw
exceptions on Python 2.5. Seehttps://bugs.launchpad.net/zope3/+bug/2518483.4.1 - 2008/07/27Make C code compatible with Python 2.5 on 64bit architectures.3.4.0 (2007-10-02)Update meta-data.3.4.0b5 (2007-08-15)Fix a circular import in the C implementation.3.4.0b4 (2007-08-14)Improve ugly/brittle ID ofzope.security.management.system_user.3.4.0b3 (2007-08-14)Add support for Python 2.5.Bug:zope.security.management.system_userwasn’t a valid principal
(didn’t provide IPrincipal).Bug: Fix inclusion of doctest to use the doctest module fromzope.testing. Now tests can be run multiple times without
breaking. (#98250)3.4.0b2 (2007-06-15)Bug: Remove stack extraction innewInteraction. When using eggs this is
an extremly expensive function. The publisher is now more than 10 times
faster when using eggs and about twice as fast with a zope trunk checkout.3.4.0b1Temporarily fixed the hidden (and accidental) dependency on zope.testing to
become optional.Note: The releases between 3.2.0 and 3.4.0b1 where not tracked as an
individual package and have been documented in the Zope 3 changelog.3.2.0 (2006-01-05)Corresponds to the verison of thezope.securitypackage shipped as part
of the Zope 3.2.0 release.Remove deprecated helper functions,proxy.trustedRemoveSecurityProxyandproxy.getProxiedObject.Make handling ofmanagement.{end,restore}Interactionmore careful w.r.t.
edge cases.Make behavior ofcanWriteconsistent withcanAccess:
ifcanAccessdoes not raiseForbiddenAttribute, then neither willcanWrite. See:http://www.zope.org/Collectors/Zope3-dev/506Code style / documentation / test fixes.3.1.0 (2005-10-03)Add support for use of the new Python 2.4 datatypes,setandfrozenset, within checked code.Make the C security proxy depend on theproxy.hheader from thezope.proxypackage.XXX: the spelling of the#includeis bizarre! It seems to be related tozpkg-based builds, and should likely be revisited. For the moment, I have
linked in thezope.proxypackage into our ownincludedirectory. See
the subversion checkin:http://svn.zope.org/Zope3/?rev=37882&view=revUpdate checker to avoid re-proxying objects which have and explicit__Security_checker__assigned.Corresponds to the verison of thezope.securitypackage shipped as part of
the Zope 3.1.0 release.Clarify contract ofICheckerto indicate that itscheck*methods may
raise onlyForbiddenorUnauthorizedexceptions.Add interfaces, (IPrincipal,IGroupAwarePrincipal,IGroup, andIPermission) specifying contracts of components in the security framework.Code style / documentation / test fixes.3.0.0 (2004-11-07)Corresponds to the version of thezope.securitypackage shipped as part
of the Zope X3.0.0 release. |
zope.securitypolicy | zope.securitypolicyThis package provides an useful security policy for Zope3. It’s the
default security policy used in “zope3 the application” and many other
zope-based projects.Classic Zope Security PolicyThis package implements a role-based security policy similar to the
policy found in Zope 2. The security policy is responsible for
deciding whether an interaction has a permission on an object. This
security policy does this using grant and denial information. Managers
can grant or deny:roles to principals,permissions to principals, andpermissions to rolesGrants and denials are stored as annotations on objects. To store
grants and denials, objects must be annotatable:>>> import zope.interface
>>> from zope.annotation.interfaces import IAttributeAnnotatable
>>> @zope.interface.implementer(IAttributeAnnotatable)
... class Ob:
... pass>>> ob = Ob()We use objects to represent principals. These objects implement an
interface namedIPrincipal, but the security policy only uses theidandgroupsattributes:>>> class Principal:
... def __init__(self, id):
... self.id = id
... self.groups = []>>> principal = Principal('bob')Roles and permissions are also represented by objects, however, for
the purposes of the security policy, only stringidsare used.The security policy provides a factory for creating interactions:>>> import zope.securitypolicy.zopepolicy
>>> interaction = zope.securitypolicy.zopepolicy.ZopeSecurityPolicy()An interaction represents a specific interaction between some
principals (normally users) and the system. Normally, we are only
concerned with the interaction of one principal with the system, although
we can have interactions of multiple principals. Multiple-principal
interactions normally occur when untrusted users store code on a
system for later execution. When untrusted code is executing, the
authors of the code participate in the interaction. An
interaction has a permission on an object only if all of the
principals participating in the interaction have access to the object.ThecheckPermissionmethod on interactions is used to test whether
an interaction has a permission for an object. An interaction without
participants always has every permission:>>> interaction.checkPermission('P1', ob)
TrueIn this example, ‘P1’ is a permission id.Normally, interactions have participants:>>> class Participation:
... interaction = None
>>> participation = Participation()
>>> participation.principal = principal
>>> interaction.add(participation)If we have participants, then we don’t have a permission unless there
are grants:>>> interaction.checkPermission('P1', ob)
FalseNote, however, that we always have the CheckerPublic permission:>>> from zope.security.checker import CheckerPublic
>>> interaction.checkPermission(CheckerPublic, ob)
TrueWe make grants and denials on objects by adapting them to various
granting interfaces. The objects returned from the adaptation are
object-specific manager objects:>>> from zope.securitypolicy import interfaces
>>> roleper = interfaces.IRolePermissionManager(ob)
>>> prinrole = interfaces.IPrincipalRoleManager(ob)
>>> prinper = interfaces.IPrincipalPermissionManager(ob)The computations involved in checking permissions can be
significant. To reduce the computational cost, caching is used
extensively. We could invalidate the cache as we make grants, but the
adapters for making grants will automatically invalidate the cache of
the current interaction. They use the security-management apis to do
this. To take advantage of the cache invalidation, we’ll need to let
the security-management system manage our interactions. First, we’ll
set our security policy as the default:>>> import zope.security.management
>>> oldpolicy = zope.security.management.setSecurityPolicy(
... zope.securitypolicy.zopepolicy.ZopeSecurityPolicy)and then we’ll create a new interaction:>>> participation = Participation()
>>> participation.principal = principal
>>> zope.security.management.newInteraction(participation)
>>> interaction = zope.security.management.getInteraction()We normally provide access by granting permissions to roles for an object:>>> roleper.grantPermissionToRole('P1', 'R1')and then granting roles to principals for an object (local roles):>>> prinrole.assignRoleToPrincipal('R1', 'bob')The combination of these grants, which we call a role-based grant,
provides the permission:>>> interaction.checkPermission('P1', ob)
TrueWe can also provide a permission directly:>>> prinper.grantPermissionToPrincipal('P2', 'bob')
>>> interaction.checkPermission('P2', ob)
TruePermission grants or denials override role-based grant or denials. So
if we deny P1:>>> prinper.denyPermissionToPrincipal('P1', 'bob')we cause the interaction to lack the permission, despite the role
grants:>>> interaction.checkPermission('P1', ob)
FalseSimilarly, even if we have a role-based denial of P2:>>> roleper.denyPermissionToRole('P2', 'R1')we still have access, because of the permission-based grant:>>> interaction.checkPermission('P2', ob)
TrueA role-based denial doesn’t actually deny a permission; rather it
prevents the granting of a permission. So, if we have both grants and
denials based on roles, we have access:>>> roleper.grantPermissionToRole('P3', 'R1')
>>> roleper.grantPermissionToRole('P3', 'R2')
>>> roleper.denyPermissionToRole('P3', 'R3')
>>> prinrole.removeRoleFromPrincipal('R2', 'bob')
>>> prinrole.assignRoleToPrincipal('R3', 'bob')>>> interaction.checkPermission('P3', ob)
TrueGlobal grantsGrants made to an object are said to be “local”. We can also make
global grants:>>> from zope.securitypolicy.rolepermission import \
... rolePermissionManager as roleperG
>>> from zope.securitypolicy.principalpermission import \
... principalPermissionManager as prinperG
>>> from zope.securitypolicy.principalrole import \
... principalRoleManager as prinroleGAnd the same rules apply to global grants and denials.>>> roleperG.grantPermissionToRole('P1G', 'R1G', False)In these tests, we aren’t bothering to define any roles, permissions,
or principals, so we pass an extra argument that tells the granting
routines not to check the validity of the values.>>> prinroleG.assignRoleToPrincipal('R1G', 'bob', False)
>>> interaction.checkPermission('P1G', ob)
True>>> prinperG.grantPermissionToPrincipal('P2G', 'bob', False)
>>> interaction.checkPermission('P2G', ob)
True>>> prinperG.denyPermissionToPrincipal('P1G', 'bob', False)
>>> interaction.checkPermission('P1G', ob)
False>>> roleperG.denyPermissionToRole('P2G', 'R1G', False)
>>> interaction.checkPermission('P2G', ob)
True>>> roleperG.grantPermissionToRole('P3G', 'R1G', False)
>>> roleperG.grantPermissionToRole('P3G', 'R2G', False)
>>> roleperG.denyPermissionToRole('P3G', 'R3G', False)
>>> prinroleG.removeRoleFromPrincipal('R2G', 'bob', False)
>>> prinroleG.assignRoleToPrincipal('R3G', 'bob', False)
>>> interaction.checkPermission('P3G', ob)
TrueLocal versus global grantsWe, of course, acquire global grants by default:>>> interaction.checkPermission('P1G', ob)
False
>>> interaction.checkPermission('P2G', ob)
True
>>> interaction.checkPermission('P3G', ob)
TrueLocal role-based grants do not override global principal-specific denials:>>> roleper.grantPermissionToRole('P1G', 'R1G')
>>> prinrole.assignRoleToPrincipal('R1G', 'bob')
>>> interaction.checkPermission('P1G', ob)
FalseAnd local role-based denials don’t override global
principal-grants:>>> roleper.denyPermissionToRole('P2G', 'R1G')
>>> interaction.checkPermission('P2G', ob)
TrueA local role-based deny can cancel a global role-based grant:>>> roleper.denyPermissionToRole('P3G', 'R1G')
>>> interaction.checkPermission('P3G', ob)
Falseand a local role-based grant can override a global role-based denial:>>> roleperG.denyPermissionToRole('P4G', 'R1G', False)
>>> prinroleG.assignRoleToPrincipal('R1G', "bob", False)
>>> interaction.checkPermission('P4G', ob)
False
>>> roleper.grantPermissionToRole('P4G', 'R1G')
>>> interaction.checkPermission('P4G', ob)
True
>>> prinroleG.removeRoleFromPrincipal('R1G', "bob", False)
>>> interaction.checkPermission('P4G', ob)
TrueOf course, a local permission-based grant or denial overrides any
global setting and overrides local role-based grants or denials:>>> prinper.grantPermissionToPrincipal('P3G', 'bob')
>>> interaction.checkPermission('P3G', ob)
True>>> prinper.denyPermissionToPrincipal('P2G', 'bob')
>>> interaction.checkPermission('P2G', ob)
FalseSublocationsWe can have sub-locations. A sublocation of a location is an object
whose__parent__attribute is the location:>>> ob2 = Ob()
>>> ob2.__parent__ = obBy default, sublocations acquire grants from higher locations:>>> interaction.checkPermission('P1', ob2)
False
>>> interaction.checkPermission('P2', ob2)
True
>>> interaction.checkPermission('P3', ob2)
True
>>> interaction.checkPermission('P1G', ob2)
False
>>> interaction.checkPermission('P2G', ob2)
False
>>> interaction.checkPermission('P3G', ob2)
True
>>> interaction.checkPermission('P4G', ob2)
TrueSublocation role-based grants do not override their parent
principal-specific denials:>>> roleper2 = interfaces.IRolePermissionManager(ob2)
>>> prinrole2 = interfaces.IPrincipalRoleManager(ob2)
>>> prinper2 = interfaces.IPrincipalPermissionManager(ob2)>>> roleper2.grantPermissionToRole('P1', 'R1')
>>> prinrole2.assignRoleToPrincipal('R1', 'bob')
>>> interaction.checkPermission('P1', ob2)
FalseAnd local role-based denials don’t override their parents
principal-grant:>>> roleper2.denyPermissionToRole('P2', 'R1')
>>> interaction.checkPermission('P2', ob2)
TrueA local role-based deny can cancel a parent role-based grant:>>> roleper2.denyPermissionToRole('P3', 'R1')
>>> interaction.checkPermission('P3', ob2)
Falseand a local role-based grant can override a parent role-based denial:>>> roleper.denyPermissionToRole('P4', 'R1')
>>> prinrole.assignRoleToPrincipal('R1', 'bob')
>>> interaction.checkPermission('P4', ob2)
False
>>> roleper2.grantPermissionToRole('P4', 'R1')
>>> interaction.checkPermission('P4', ob2)
True
>>> prinrole.removeRoleFromPrincipal('R1', 'bob')
>>> interaction.checkPermission('P4', ob2)
TrueOf course, a local permission-based grant or denial overrides any
global setting and overrides local role-based grants or denials:>>> prinper.grantPermissionToPrincipal('P3', 'bob')
>>> interaction.checkPermission('P3', ob2)
True>>> prinper.denyPermissionToPrincipal('P2', 'bob')
>>> interaction.checkPermission('P2', ob2)
FalseIf an object is not annotatable, but does have a parent, it will get
its grants from its parent:>>> class C:
... pass>>> ob3 = C()
>>> ob3.__parent__ = ob>>> interaction.checkPermission('P1', ob3)
False
>>> interaction.checkPermission('P2', ob3)
False
>>> interaction.checkPermission('P3', ob3)
True
>>> interaction.checkPermission('P1G', ob3)
False
>>> interaction.checkPermission('P2G', ob3)
False
>>> interaction.checkPermission('P3G', ob3)
True
>>> interaction.checkPermission('P4G', ob3)
TrueThe same results will be had if there are multiple non-annotatable
objects:>>> ob3.__parent__ = C()
>>> ob3.__parent__.__parent__ = ob>>> interaction.checkPermission('P1', ob3)
False
>>> interaction.checkPermission('P2', ob3)
False
>>> interaction.checkPermission('P3', ob3)
True
>>> interaction.checkPermission('P1G', ob3)
False
>>> interaction.checkPermission('P2G', ob3)
False
>>> interaction.checkPermission('P3G', ob3)
True
>>> interaction.checkPermission('P4G', ob3)
Trueand if an object doesn’t have a parent:>>> ob4 = C()it will have whatever grants were made globally:>>> interaction.checkPermission('P1', ob4)
False
>>> interaction.checkPermission('P2', ob4)
False
>>> interaction.checkPermission('P3', ob4)
False
>>> interaction.checkPermission('P1G', ob4)
False
>>> interaction.checkPermission('P2G', ob4)
True
>>> interaction.checkPermission('P3G', ob4)
False
>>> interaction.checkPermission('P4G', ob4)
False>>> prinroleG.assignRoleToPrincipal('R1G', "bob", False)
>>> interaction.checkPermission('P3G', ob4)
TrueWe’ll get the same result if we have a non-annotatable parent without a
parent:>>> ob3.__parent__ = C()>>> interaction.checkPermission('P1', ob3)
False
>>> interaction.checkPermission('P2', ob3)
False
>>> interaction.checkPermission('P3', ob3)
False
>>> interaction.checkPermission('P1G', ob3)
False
>>> interaction.checkPermission('P2G', ob3)
True
>>> interaction.checkPermission('P3G', ob3)
True
>>> interaction.checkPermission('P4G', ob3)
FalseThe Anonymous roleThe security policy defines a special role named “zope.Anonymous”. All
principals have this role and the role cannot be taken away.>>> roleperG.grantPermissionToRole('P5', 'zope.Anonymous', False)
>>> interaction.checkPermission('P5', ob2)
TrueProxiesObjects may be proxied:>>> from zope.security.checker import ProxyFactory
>>> ob = ProxyFactory(ob)
>>> interaction.checkPermission('P1', ob)
False
>>> interaction.checkPermission('P2', ob)
False
>>> interaction.checkPermission('P3', ob)
True
>>> interaction.checkPermission('P1G', ob)
False
>>> interaction.checkPermission('P2G', ob)
False
>>> interaction.checkPermission('P3G', ob)
True
>>> interaction.checkPermission('P4G', ob)
Trueas may their parents:>>> ob3 = C()
>>> ob3.__parent__ = ob>>> interaction.checkPermission('P1', ob3)
False
>>> interaction.checkPermission('P2', ob3)
False
>>> interaction.checkPermission('P3', ob3)
True
>>> interaction.checkPermission('P1G', ob3)
False
>>> interaction.checkPermission('P2G', ob3)
False
>>> interaction.checkPermission('P3G', ob3)
True
>>> interaction.checkPermission('P4G', ob3)
TrueGroupsPrincipals may have groups. Groups are also principals (and, thus,
may have groups).If a principal has groups, the groups are available as group ids in
the principal’sgroupsattribute. The interaction has to convert
these group ids to group objects, so that it can tell whether the
groups have groups. It does this by calling thegetPrincipalmethod
on the principal authentication service, which is responsible for,
among other things, converting a principal id to a principal.
For our examples here, we’ll create and register a stub principal
authentication service:>>> from zope.authentication.interfaces import IAuthentication
>>> @zope.interface.implementer(IAuthentication)
... class FauxPrincipals(object):
... def __init__(self):
... self.data = {}
... def __setitem__(self, key, value):
... self.data[key] = value
... def __getitem__(self, key):
... return self.data[key]
... def getPrincipal(self, id):
... return self.data[id]>>> auth = FauxPrincipals()>>> from zope.component import provideUtility
>>> provideUtility(auth, IAuthentication)Let’s define a group:>>> auth['g1'] = Principal('g1')Let’s put the principal in our group. We do that by adding the group id
to the new principals groups:>>> principal.groups.append('g1')Of course, the principal doesn’t have permissions not granted:>>> interaction.checkPermission('gP1', ob)
FalseNow, if we grant a permission to the group:>>> prinper.grantPermissionToPrincipal('gP1', 'g1')We see that our principal has the permission:>>> interaction.checkPermission('gP1', ob)
TrueThis works even if the group grant is global:>>> interaction.checkPermission('gP1G', ob)
False>>> prinperG.grantPermissionToPrincipal('gP1G', 'g1', True)>>> interaction.checkPermission('gP1G', ob)
TrueGrants are, of course, acquired:>>> interaction.checkPermission('gP1', ob2)
True>>> interaction.checkPermission('gP1G', ob2)
TrueInner grants can override outer grants:>>> prinper2.denyPermissionToPrincipal('gP1', 'g1')
>>> interaction.checkPermission('gP1', ob2)
FalseBut principal grants always trump group grants:>>> prinper2.grantPermissionToPrincipal('gP1', 'bob')
>>> interaction.checkPermission('gP1', ob2)
TrueGroups can have groups too:>>> auth['g2'] = Principal('g2')
>>> auth['g1'].groups.append('g2')If we grant to the new group:>>> prinper.grantPermissionToPrincipal('gP2', 'g2')Then we, of course have that permission too:>>> interaction.checkPermission('gP2', ob2)
TrueJust as principal grants override group grants, group grants can
override other group grants:>>> prinper.denyPermissionToPrincipal('gP2', 'g1')
>>> interaction.checkPermission('gP2', ob2)
FalsePrincipals can be in more than one group. Let’s define a new group:>>> auth['g3'] = Principal('g3')
>>> principal.groups.append('g3')
>>> prinper.grantPermissionToPrincipal('gP2', 'g3')Now, the principal has two groups. In one group, the permission ‘gP2’
is denied, but in the other, it is allowed. In a case like this, the
permission is allowed:>>> interaction.checkPermission('gP2', ob2)
TrueIn a case where a principal has two or more groups, the group denies
prevent allows from their parents. They don’t prevent the principal
from getting an allow from another principal.Grants can be inherited from ancestor groups through multiple paths.
Let’s grant a permission to g2 and deny it to g1:>>> prinper.grantPermissionToPrincipal('gP3', 'g2')
>>> prinper.denyPermissionToPrincipal('gP3', 'g1')Now, as before, the deny in g1 blocks the grant in g2:>>> interaction.checkPermission('gP3', ob2)
FalseLet’s make g2 a group of g3:>>> auth['g3'].groups.append('g2')Now, we get g2’s grant through g3, and access is allowed:>>> interaction.invalidate_cache()
>>> interaction.checkPermission('gP3', ob2)
TrueWe can assign roles to groups:>>> prinrole.assignRoleToPrincipal('gR1', 'g2')and get permissions through the roles:>>> roleper.grantPermissionToRole('gP4', 'gR1')
>>> interaction.checkPermission('gP4', ob2)
Truewe can override role assignments to groups through subgroups:>>> prinrole.removeRoleFromPrincipal('gR1', 'g1')
>>> prinrole.removeRoleFromPrincipal('gR1', 'g3')
>>> interaction.checkPermission('gP4', ob2)
Falseand through principals:>>> prinrole.assignRoleToPrincipal('gR1', 'bob')
>>> interaction.checkPermission('gP4', ob2)
TrueWe clean up the changes we made in these examples:>>> zope.security.management.endInteraction()
>>> ignore = zope.security.management.setSecurityPolicy(oldpolicy)Changes5.0 (2023-02-24)Add support for Python 3.9, 3.10, 3.11.Drop support for Python 2.7, 3.5, 3.6.4.3.2 (2021-03-19)Add support for Python 3.8.Drop support for Python 3.4.Fix some test imports to use the proper imports fromzope.interfaceinstead ofzope.component.4.3.1 (2018-10-11)Use current location forIRegisteredandIUnregisteredinterface.4.3.0 (2018-08-27)Add support for Python 3.7.Drop support for Python 3.3.Drop support forpython setup.py test.MakeSecurityMapandAnnotationGrantInfohave proper truth
behaviour on Python 3; previously they were always true.MakeAnnotationGrantInfoconsistently return lists instead of
dict views on Python 3.MakeAnnotationSecurityMap(and objects derived from it, such asAnnotationPrincipalPermissionManagerand the role managers) more
efficient when adding or removing cells before they have been
persisted. They now avoid some unnecessary object copying.4.2.0 (2017-08-24)Add<zope:deny>directive, which is a mirror of the<zope:grant>directive.Add support for Python 3.6.4.1.0 (2016-11-05)Add support for Python 3.5.Drop support for Python 2.6.Add support to grant multiple permissions with one ZCML statement. Example:<grant
role="my-role"
permissions="zope.foo
zope.bar" />4.0.0 (2014-12-24)Add support for PyPy. (PyPy3 is pending release of a fix for:https://bitbucket.org/pypy/pypy/issue/1946)Add support for Python 3.4.Add support for testing on Travis.4.0.0a1 (2013-02-22)Add support for Python 3.3.Replace deprecatedzope.interface.classProvidesusage with equivalentzope.interface.providerdecorator.Replace deprecatedzope.interface.implementsusage with equivalentzope.interface.implementerdecorator.Drop support for Python 2.4 and 2.5.3.7.0 (2010-09-25)LP #131115: Clean up inconsistency ingetSettinginterface definitions
and actual usage for the various security maps.LP #564525: fix permission moved fromzope.app.dublincorenamespace
tozope.dublincore.Remove unused imports and pep8 cleanup.Use doctest module instead of the deprecated zope.testing.doctest.AnnotationGrantInfo implements IGrantInfo.Add test extra to declare test dependency onzope.component [test].Add an extra nameddublincoreto express optional dependency onzope.dublincore >= 3.7.Add tests for ZCML files making sure they include everything they need.3.6.1 (2009-07-24)Make tests work when the default and Zope vocabulary registry compete in the
cleanup.3.6.0 (2009-03-14)Changezope.app.securitydependency to the newzope.authenticationpackage, dropping a big number of unused dependencies.Get rid ofzope.app.testingand other testing dependencices.AddZODB3to install dependencies, because we usePersistentclass. We didn’t fail before, because it was installed implicitly.3.5.1 (2009-03-10)Don’t depend on thehookextra of zope.component, as we don’t need
it explicitly.Import security settings (Allow, Deny, Unset) in theinterfacesmodule from thezope.securitypolicy.settings, added in previous
release instead of oldzope.app.security.settings.
Thezope.app.securitywill be adapted to import them fromzope.securitypolicy.interfaces.Use_z_instancesinstead of__instances__for storing instances
forzope.securitypolicy.settings.PermissionSettingsingleton
implementation, because __*__ name pattern is reserved for special
names in python.Add security protections for thePermissionSetting.Improve documentation formatting, add it to the package’s long
description.Remove unneeded dependencies.Remove old zpkg-related files and zcml slugs.3.5.0 (2009-01-31)Include settings that were previously imported from zope.app.security.3.4.2 (2009-01-28)Change mailing list address to zope-dev at zope.org. Fix package
homepage to the pypi page.Fix test in buildout which still depended on zope.app.securitypolicy
by mistake.Remove explicit dependency on zope.app.form fromsetup.py; nothing
in the code directly depends on this.3.4.1 (2008-06-02)Fix reference to deprecated security policy from ZCML.3.4.0 (2007-09-25)Initial documented release |
zope.sendmail | zope.sendmailzope.sendmail is a package for email sending from Zope 3 applications.
Email sending from Zope 3 applications works as follows:A Zope 3 application locates a mail delivery utility
(IMailDelivery) and feeds a message to it. It gets back a unique
message ID so it can keep track of the message by subscribing toIMailEventevents.The utility registers with the transaction system to make sure the
message is only sent when the transaction commits successfully.
(Among other things this avoids duplicate messages onConflictErrors.)If the delivery utility is aIQueuedMailDelivery, it puts the
message into a queue (a Maildir mailbox in the file system). A
separate process or thread (IMailQueueProcessor) watches the queue
and delivers messages asynchronously. Since the queue is located in
the file system, it survives Zope restarts or crashes and the mail is
not lost. The queue processor can implement batching to keep the
server load low.If the delivery utility is aIDirectMailDelivery, it delivers
messages synchronously during the transaction commit. This is not a
very good idea, as it makes the user wait. Note that transaction
commits must not fail, but that is not a problem, because mail
delivery problems dispatch an event instead of raising an exception.However, there is a problem – sending events causes unknown code to
be executed during the transaction commit phase. There should be a
way to start a new transaction for event processing after this one is
commited.AnIMailQueueProcessororIDirectMailDeliveryactually
delivers the messages by using a mailer (IMailer) component that
encapsulates the delivery process. There currently is only one
mailer:ISMTPMailersends all messages to a relay host using SMTP.Documentation is hosted athttps://zopesendmail.readthedocs.io/Changes6.1 (2024-02-07)Fix SMTP protocol interoperability by avoiding hardcoded line endings.
(seehttps://www.rfc-editor.org/rfc/rfc2821#section-2.3.7)Add preliminary support for Python 3.13 as of 3.13a3.Add support for Python 3.12.6.0 (2023-08-22)Drop support for Python 2.7, 3.5, 3.6.Add support for Python 3.11.5.3 (2022-10-06)Add support for Python 3.10.Do not try to send queued emails to an empty address
(#45).5.2 (2021-01-18)Add minimal savepoint support, so we do not fail if any code tries to create a savepoint.
(#35).Fix TypeError: ‘error’ object is not subscriptable during error handling on
Windows (#33).Add support for Python 3.9.5.1 (2020-07-31)Usepywin32again, not any longer the meanwhile outdated fork namedpypiwin32.
Add some information for installation with buildout.
(#30)Supportbytesmessages; consistently convert messages
using a “text” type (i.e.strfor Python 3,unicodefor Python 2)
intobytesvia utf-8 encoding.
Prerequisite to fixProducts.MailHost#30.5.0 (2019-04-03)Drop support for Python 3.4.Add support for Python 3.8a3.Fix text/bytes issue in MailDir for Python 3.
(#24)4.2.1 (2019-02-07)Fix SMTP authentication on Python 3. Seeissue 16.4.2 (2018-10-10)Add support for Python 3.7.4.1.0 (2017-09-02)Host documentation athttps://zopesendmail.readthedocs.io/Make the data manager sort key a string, this fixes Python 3 where
strings and integers are not sortable. This would happen when using
other data managers with string sort keys.Add support for Python 3.5 and 3.6.Drop support for Python 2.6 and 3.3.Declare explicit dependency onpywin32on Windows.Replace hard-coded constants with equivalents from the standarderrnomodule.Fix SSL support on Python 3. Seeissue 9.Reach 100% test coverage and maintain it via tox.ini and Travis CI.Replaced deprecated dependency onoptparsewith equivalentargparse. The help messages have changed and errors are
generally more clear. Specifying a--configpath that doesn’t
exist is now an error instead of being silently ignored.Fix SMTPMailer sending more than one message. It now reconnects to
the SMTP server as needed. Previously it could only send one message
since it closed the connection after each send. This also makes the
SMTPMailer thread safe. Seeissue 1.4.0.1 (2014-12-29)Add support for PyPy3.4.0.0 (2014-12-20)Add support for testing on Travis-CI against supported Python verisons.Drop use ofzope.testrunnerfor testing.Drop dependency onsix.Replace doctests with equivalent unittests.4.0.0a2 (2013-02-26)Fix license Trove classifier.4.0.0a1 (2013-02-25)Add support for Python 3.3.Delete event fossils (interfaceszope.sendmail.interfaces.IMailSentandzope.sendmail.interfaces.IMailError. plus thezope.sendmail.eventsmodule and associated tests). These events were never emitted, and couldn’t
have been used safely even if they had been, due to two-phase commit.https://bugs.launchpad.net/zope3/+bug/177739Replace deprecatedzope.interface.classProvidesusage with equivalentzope.interface.providerdecorator.Replace deprecatedzope.interface.implementsusage with equivalentzope.interface.implementerdecorator.Drop support for Python 2.4 and 2.5.Add a vote method to Mailer implementations to allow them to abort a
transaction if it is known to be unsafe.Prevent fatal errors in mail delivery causing potential database corruption.Add not declared, but needed test dependency onzope.component [test].Add handling for unicode usernames and passwords, encoding them to UTF-8.
Fix forhttps://bugs.launchpad.net/zope.sendmail/+bug/597143Give the background queue processor thread a name.Document the ini file keys forzope-sendmail--configin the help
message printed byzope-sendmail--help. Also rewrote the command-line
parsing to use optparse (not argparse, since Python 2.6 is still supported).3.7.5 (2012-05-23)Ensure that the ‘queuedDelivery’ directive has the same discriminator
as the ‘directDelivery’ directive (they are mutually incompatible).https://bugs.launchpad.net/zope.sendmail/+bug/191143Avoid requeuing messages after an SMTP “recipients refused” error.https://bugs.launchpad.net/zope.sendmail/+bug/10032883.7.4 (2010-10-01)Handle unicode usernames and passwords, encoding them to UTF-8. Fix forhttps://bugs.launchpad.net/zope.sendmail/+bug/5971433.7.3 (2010-09-25)Add not declared, but needed test dependency onzope.component [test].3.7.2 (2010-04-30)Remove no longer required testing dependency on zope.testing.Maildir storage for queue can now handle unicode passed in for message or
to/from addresses (change backported from repoze.sendmail).Tests use stdlib doctest instead of zope.testing.doctest.3.7.1 (2010-01-13)Backward compatibility import of zope.sendmail.queue.QueueProcessorThread in
zope.sendmail.delivery.3.7.0 (2010-01-12)Remove dependency onzope.security: the security support is optional,
and only available if thezope.securitypackage is available. This change
is similar to the optional security support introduced inzope.component3.8.0, and in fact it uses the same helpers.Sort by modification time the messages in zope.sendmail.maildir so earlier
messages are sent before later messages during queue processing.Add the new parameterprocessorThreadto the queuedDelivery ZCML
directive: if False, the QueueProcessorThread is not started and thus an
independent process must process the queue; it defaults to True for b/c.Provide a console scriptzope-sendmailwhich can be used to process the
delivery queue in case processorThread is False. The console script can
either process the messages in the queue once, or run in “daemon” mode.3.6.1 (2009-11-16)Depend onzope.component>= 3.8.0, which supports the new semantic of
zope.component.zcml.proxify needed by zope.sendmail.zcml.3.6.0 (2009-09-14)Use simple vocabulary factory function instead of customUtilityTermandUtilityVocabularyclasses, copied fromzope.app.componentin
the previous release.Depend on thetransactionpackage instead ofZODB3.Remove zcml slugs and zpkg-related files.Work around problem when used with Python >=2.5.1. Seehttps://bugs.edge.launchpad.net/zope.sendmail/+bug/413335.3.5.1 (2009-01-26)Copyover the UtilityTerm and UtilityVocabulary implementation from
zope.app.component to avoid a dependency.Work around a problem when smtp quit fails, the mail was considered not
delivered where just the quit failed.3.5.0 (2008-07-05)final release (identical with 3.5.0b2)3.5.0b2 (2007-12-19)If the SMTP server rejects a message (for example, when the sender or
recipient address is malformed), that email stays in the queue forever
(https://bugs.launchpad.net/zope3/+bug/157104).3.5.0b1 (2007-11-08)Add README.txtCan now talk to servers that don’t implement EHLOFix bug that caused files with very long names to be createdFix forhttps://bugs.launchpad.net/zope3/+bug/157104: move aside mail that’s
causing 5xx server responses.3.5.0a2 (2007-10-23)Clean updoes_esmtpin faux SMTP connection classes provided by the
tests.If theQueueProcessorThreadis asked to stop while sending messages, do
so after sending the current message; previously if there were many, many
messages to send, the thread could stick around for quite a while.3.5.0a1 (2007-10-23)QueueProcessorThreadnow accepts an optional parameterintervalfor
defining how often to process the mail queue (default is 3 seconds)SeveralQueueProcessorThreads(either in the same process, or multiple
processes) can now deliver messages from a single maildir without duplicates
being sent.3.4.0 (2007-08-20)Bugfix: Don’t keep open files around for every email message
to be sent on transaction commit. People who try to send many emails
in a single transaction now will not run out of file descriptors.3.4.0a1 (2007-04-22)Initial release as a separate project, corresponds tozope.sendmailfrom Zope 3.4.0a1. |
zope.sequencesort | zope.sequencesortThis package provides support for sorting sequences based on multiple
keys, including locale-based comparisons and per-key directions.Changelog5.0 (2023-01-19)Add support for Python 3.11.Drop support for Python 2.7, 3.5, 3.6.Drop support for deprecatedpython setup.py test.4.2 (2021-11-04)Fix a TypeError exception incmpwhen operands areNone.
Seeissue 7.Drop support for Python 3.4.Add support for Python 3.8, 3.9 and 3.10.4.1.2 (2018-10-10)Fix regression introduced in 4.1.1 where two_Smallestobjects are no
longer considered to be equal.4.1.1 (2018-10-05)Handle sorting of broken objects more gracefully.
(#4)4.1.0 (2018-08-13)Updatedboostrap.pyto version 2.2.Drop support for Python 2.6, 3.2 and 3.3.Add support for Python 3.4, 3.5, 3.6 and 3.7.The locale comparison functions,strcollandstrcoll_nocaseare always available, not only if thelocalemodule had been
imported before this module.4.0.1 (2013-03-04)Fix omitted tests under Py3k.4.0.0 (2013-02-28)Addedsetup.py docsalias (installsSphinxand dependencies).Addedsetup.py devalias (runssetup.py developplus installsnoseandcoverage).Dropped spurioustestextra requirement onzope.testing.100% unit test coverage.Added support for PyPy, Python 3.2 / 3.2.Dropped support for Python 2.4 / 2.5.3.4.0 (2007-10-03)Initial release independent of the main Zope3 tree. |