[Zope-dev] [Checkins] SVN: z3c.form/branches/icemac_compatibility/ - Made compatible with `zope.app.publisher` 3.8.2

Michael Howitz mh at gocept.com
Fri Jul 17 12:44:08 EDT 2009


Am 17.07.2009 um 18:24 schrieb Michael Howitz:
> Log message for revision 101967:
>  - Made compatible with `zope.app.publisher` 3.8.2 (and above) by  
> using
>    the new absolute url adapter for resources introduced in 3.8.2.

The current trunk of z3c.form is not compatible with  
zope.app.publisher 3.8.2 and above, as this version introduced an  
absolute url adapter for resources. This adapter does not exist in  
versions before 3.8.2. It returns a str instead of a unicode as  
Resource.__call__ did before. (Relying on this feature seems to be bad  
anyway.)

So my question is whether z3c.form 2.x still has to be compatible with  
KGS 3.4 of if we can break this compatibility to get compatible with  
more recent versions of other packages.
Trying to stay compatible requires at least some conditional code to  
register the new absolute url adapter in the tests.

Is there any buildbot which tests z3c.form against KGS 3.4 and above?

>  - Fixed tests to run with `z3c.pt` 1.0b17 (and above) by adding a
>    missing test dependency on `zope.app.component`.

This is necessary because zope.app.component no longer gets pulled in  
indirectly. But z3c.pt expects zope.app.component to be installed when  
zope.app.security is installed. (zope.app.security is a test  
dependency needed by browser/README.txt)
zope.app.component is even required for one test (browser/README.txt)  
of z3c.form.

> Changed:
>  U   z3c.form/branches/icemac_compatibility/CHANGES.txt
>  U   z3c.form/branches/icemac_compatibility/buildout.cfg
>  U   z3c.form/branches/icemac_compatibility/setup.py
>  U   z3c.form/branches/icemac_compatibility/src/z3c/form/browser/ 
> README.txt
>  U   z3c.form/branches/icemac_compatibility/src/z3c/form/browser/ 
> image.py
>  U   z3c.form/branches/icemac_compatibility/src/z3c/form/button.py
>  U   z3c.form/branches/icemac_compatibility/src/z3c/form/button.txt
>
> -=-
> Modified: z3c.form/branches/icemac_compatibility/CHANGES.txt
> ===================================================================
> --- z3c.form/branches/icemac_compatibility/CHANGES.txt	2009-07-17  
> 16:22:39 UTC (rev 101966)
> +++ z3c.form/branches/icemac_compatibility/CHANGES.txt	2009-07-17  
> 16:24:27 UTC (rev 101967)
> @@ -12,6 +12,13 @@
>   manager is only registered for dict, because it would otherwise get
>   picked up in undesired scenarios.
>
> +- Made compatible with `zope.app.publisher` 3.8.2 (and above) by  
> using
> +  the new absolute url adapter for resources introduced in 3.8.2.
> +
> +- Fixed tests to run with `z3c.pt` 1.0b17 (and above) by adding a
> +  missing test dependency on `zope.app.component`.
> +
> +
> Version 2.0.0 (2009-06-14)
> --------------------------
>
>
> Modified: z3c.form/branches/icemac_compatibility/buildout.cfg
> ===================================================================
> --- z3c.form/branches/icemac_compatibility/buildout.cfg	2009-07-17  
> 16:22:39 UTC (rev 101966)
> +++ z3c.form/branches/icemac_compatibility/buildout.cfg	2009-07-17  
> 16:24:27 UTC (rev 101967)
> @@ -2,7 +2,12 @@
> develop = . benchmark
> parts = test test-no-z3cpt checker coverage-test coverage-report  
> docs i18n
>         benchmark python
> +versions = versions
>
> +[versions]
> +zope.app.publisher = 3.8.3
> +z3c.pt = 1.0.0
> +
> [test-environment]
> CHAMELEON_DEBUG = False
> CHAMELEON_CACHE = False
>
> Modified: z3c.form/branches/icemac_compatibility/setup.py
> ===================================================================
> --- z3c.form/branches/icemac_compatibility/setup.py	2009-07-17  
> 16:22:39 UTC (rev 101966)
> +++ z3c.form/branches/icemac_compatibility/setup.py	2009-07-17  
> 16:24:27 UTC (rev 101967)
> @@ -91,6 +91,8 @@
>             'zope.app.testing',
>             'zope.container',
>             'zope.testing',
> +            'zope.app.component', # required by z3c.pt from 1.0b17 on
> +                                  # also required by our browser/ 
> README.txt
>             ],
>         adding = ['zope.app.container'],
>         docs = ['z3c.recipe.sphinxdoc'],
>
> Modified: z3c.form/branches/icemac_compatibility/src/z3c/form/ 
> browser/README.txt
> ===================================================================
> --- z3c.form/branches/icemac_compatibility/src/z3c/form/browser/ 
> README.txt	2009-07-17 16:22:39 UTC (rev 101966)
> +++ z3c.form/branches/icemac_compatibility/src/z3c/form/browser/ 
> README.txt	2009-07-17 16:24:27 UTC (rev 101967)
> @@ -500,6 +500,14 @@
>>>> zope.component.provideAdapter(
>   ...     resource, (None, None), ITraversable, name="resource")
>
> +  # Register resource absolute url adapter
> +  >>> import zope.app.publisher.browser.resource
> +  >>> from zope.app.publisher.interfaces import IResource
> +  >>> import zope.traversing.browser.interfaces
> +  >>> zope.component.provideAdapter(
> +  ...     zope.app.publisher.browser.resource.AbsoluteURL,  
> (IResource, None),
> +  ...     zope.traversing.browser.interfaces.IAbsoluteURL)
> +
>   # Register the "pressme.png" resource
>>>> from zope.app.publisher.browser.resource import Resource
>>>> testing.browserResource('pressme.png', Resource)
>
> Modified: z3c.form/branches/icemac_compatibility/src/z3c/form/ 
> browser/image.py
> ===================================================================
> --- z3c.form/branches/icemac_compatibility/src/z3c/form/browser/ 
> image.py	2009-07-17 16:22:39 UTC (rev 101966)
> +++ z3c.form/branches/icemac_compatibility/src/z3c/form/browser/ 
> image.py	2009-07-17 16:24:27 UTC (rev 101967)
> @@ -51,6 +51,6 @@
>     image.value = field.title
>     # Get the full resource URL for the image:
>     site = hooks.getSite()
> -    image.src = zope.traversing.api.traverse(
> -        site, '++resource++' + field.image, request=request)()
> +    image.src = unicode(zope.traversing.api.traverse(
> +            site, '++resource++' + field.image, request=request)())
>     return image
>
> Modified: z3c.form/branches/icemac_compatibility/src/z3c/form/ 
> button.py
> ===================================================================
> --- z3c.form/branches/icemac_compatibility/src/z3c/form/button.py	 
> 2009-07-17 16:22:39 UTC (rev 101966)
> +++ z3c.form/branches/icemac_compatibility/src/z3c/form/button.py	 
> 2009-07-17 16:24:27 UTC (rev 101967)
> @@ -234,8 +234,8 @@
>     @property
>     def src(self):
>         site = hooks.getSite()
> -        src = zope.traversing.api.traverse(
> -            site, '++resource++' + self.field.image,  
> request=self.request)()
> +        src = unicode(zope.traversing.api.traverse(
> +            site, '++resource++' + self.field.image,  
> request=self.request)())
>         return src
>
>     def isExecuted(self):
>
> Modified: z3c.form/branches/icemac_compatibility/src/z3c/form/ 
> button.txt
> ===================================================================
> --- z3c.form/branches/icemac_compatibility/src/z3c/form/button.txt	 
> 2009-07-17 16:22:39 UTC (rev 101966)
> +++ z3c.form/branches/icemac_compatibility/src/z3c/form/button.txt	 
> 2009-07-17 16:24:27 UTC (rev 101967)
> @@ -644,6 +644,14 @@
>>>> zope.component.provideAdapter(
>   ...     resource, (None, None), ITraversable, name="resource")
>
> +  # Register resource absolute url adapter
> +  >>> import zope.app.publisher.browser.resource
> +  >>> from zope.app.publisher.interfaces import IResource
> +  >>> import zope.traversing.browser.interfaces
> +  >>> zope.component.provideAdapter(
> +  ...     zope.app.publisher.browser.resource.AbsoluteURL,  
> (IResource, None),
> +  ...     zope.traversing.browser.interfaces.IAbsoluteURL)
> +
>   # Register the "submit.png" resource
>>>> from zope.app.publisher.browser.resource import Resource
>>>> testing.browserResource('submit.png', Resource)

Yours sincerely,
-- 
Michael Howitz · mh at gocept.com · software developer
gocept gmbh & co. kg · forsterstraße 29 · 06112 halle (saale) · germany
http://gocept.com · tel +49 345 1229889 8 · fax +49 345 1229889 1
Zope and Plone consulting and development



More information about the Zope-Dev mailing list