[Zope] Re: unbound method failures

Tres Seaver tseaver at palladion.com
Tue Sep 6 19:44:57 EDT 2005


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

garry saddington wrote:
> I am using Zope 2.8.1 and adding an xslt method produces the following
> error:
> Module ZPublisher.Publish, line 113, in publish
>       * Module ZPublisher.mapply, line 88, in mapply
>       * Module ZPublisher.Publish, line 40, in call_object
>       * Module Shared.DC.Scripts.Bindings, line 311, in __call__
>       * Module Shared.DC.Scripts.Bindings, line 348, in _bindAndExec
>       * Module Products.PageTemplates.PageTemplateFile, line 110, in
>         _exec
>       * Module Products.PageTemplates.PageTemplate, line 102, in
>         pt_render
>         <PageTemplateFile at /create>
>       * Module TAL.TALInterpreter, line 206, in __call__
>       * Module TAL.TALInterpreter, line 250, in interpret
>       * Module TAL.TALInterpreter, line 649, in do_loop_tal
>       * Module Products.PageTemplates.TALES, line 206, in setRepeat
>       * Module Products.PageTemplates.TALES, line 221, in evaluate
>         URL: create
>         Line 70, Column 6
>         Expression: standard:'here/availableProcessors'
>         Names:
>         {'container': <App.ProductContext.__FactoryDispatcher__ object at 0x414b478c>,
>          'context': <App.ProductContext.__FactoryDispatcher__ object at 0x414b478c>,
>          'default': <Products.PageTemplates.TALES.Default instance at 0x40be970c>,
>          'here': <App.ProductContext.__FactoryDispatcher__ object at 0x414b478c>,
>          'loop': <Products.PageTemplates.TALES.SafeMapping object at 0x414c13ec>,
>          'modules': <Products.PageTemplates.ZRPythonExpr._SecureModuleImporter instance at 0x40bfa5ac>,
>          'nothing': None,
>          'options': {'args': ()},
>          'repeat': <Products.PageTemplates.TALES.SafeMapping object at 0x414c13ec>,
>          'request': <HTTPRequest, URL=http://localhost:8080/manage_addProduct/ZopeXMLMethods/create>,
>          'root': <Application at >,
>          'template': <PageTemplateFile at /create>,
>          'traverse_subpath': [],
>          'user': garry}
>       * Module Products.PageTemplates.Expressions, line 183, in __call__
>       * Module Products.PageTemplates.Expressions, line 178, in _eval
>       * Module Products.PageTemplates.Expressions, line 85, in render
> TypeError: unbound method availableProcessors() must be called with
> XSLTMethod instance as first argument (got nothing instead)
>
> I have a Zope 2.7 on the same machine where xslt methods works fine.
> Does anyone know what could be wrong here?

The XSLTMethod product followed "standard practice" in pre-2.8
ExtensionClass derivatives, "borrowing" an unbound method from one class
and sticking it directly into the class dict of another.  This practice
used to work, due to implementation details of the old ExtensionClass,
but now breaks, because EC is now a new-style class.  The cure is
simple:  find the spot where the method is being "borrowed", and strip
off the UnboundMethod wrapper.  E.g., instead of:

  class Foo(Base):
      some_method = Bar.some_method

make it

   class Foo(Base):
      some_method = Bar.some_method.im_func

> ps. since I posted this I have tried to view my Plone site in 2.8.1 and get the following error:
> 
> 
> An error was encountered while publishing this resource. 
> 
> TypeError
> 
> Sorry, a site error occurred.
> 
> Traceback (innermost last):
> 
>       * Module ZPublisher.Publish, line 187, in publish_module_standard
>       * Module Products.PlacelessTranslationService.PatchStringIO, line
>         51, in new_publish
>       * Module ZPublisher.Publish, line 144, in publish
>       * Module Zope2.App.startup, line 199, in zpublisher_exception_hook
>       * Module ZPublisher.Publish, line 113, in publish
>       * Module ZPublisher.mapply, line 88, in mapply
>       * Module ZPublisher.Publish, line 40, in call_object
>       * Module Products.CMFCore.PortalContent, line 116, in __call__
>       * Module Shared.DC.Scripts.Bindings, line 311, in __call__
>       * Module Shared.DC.Scripts.Bindings, line 348, in _bindAndExec
>       * Module Products.CMFCore.FSPageTemplate, line 191, in _exec
>       * Module Products.CMFCore.FSPageTemplate, line 124, in pt_render
>       * Module Products.PageTemplates.PageTemplate, line 96, in
>         pt_render
>         <FSPageTemplate at /sp/document_view used for /sp/index_html>
> TypeError: unbound method pt_getContext() must be called with
> ZopePageTemplate instance as first argument (got nothing instead) (Also,
> an error occurred while attempting to render the standard error
> message.) 

You likely need to upgrade Plone to a version which has been made
compatible with Zope 2.8.


Tres.
- --
===================================================================
Tres Seaver          +1 202-558-7113          tseaver at palladion.com
Palladion Software   "Excellence by Design"    http://palladion.com
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.5 (GNU/Linux)
Comment: Using GnuPG with Thunderbird - http://enigmail.mozdev.org

iD8DBQFDHin5+gerLs4ltQ4RAgo1AJ44l+mv8bSB0XgbW6GSt+aWYfLEpgCghCgn
hWw7Yn+LOpvHRP7O/NFQJHA=
=ruaM
-----END PGP SIGNATURE-----



More information about the Zope mailing list