[Zope-dev] Re: Heads up: about to merge new-style ExtensionClass and ZODB 3.3 into Zope 2 head

Jim Fulton jim at zope.com
Sun Nov 30 11:28:20 EST 2003


Yuppie wrote:
> Jim Fulton wrote:
> 
>> Done!
> 
> 
> Hi Jim!
> 
> 
> Here some feedback regarding your checkin.

Thanks!

 > I tested CMF with Zope HEAD.
> These are the issues I ran into:
> 
> 
> 1.) "from ZODB import Persistent, PersistentMapping" doesn't work anymore
> 
> Maybe Zope 2.7 should have a deprecation warning?

Hm, or maybe we should make this work for zodb.  Jeremy, what do you think?

> 
> 2.) assignment to class dictionaries doesn't work anymore
> 
> I copied your fix for ZopePageTemplate to FSPageTemplate. Now Zope 
> started again.

Right.  I don't see an easy way around this.

> 
> 3.) 'rebinding by assignment' doesn't work anymore
> 
> With oldstyle ExtensionClasses you were able to rebind methods by 
> assignment, without subclassing from the class that defines the method.
> 
> CMFCore/FSPageTemplate.py seems to be a good use case for that feature:
> 
> class FSPageTemplate(FSObject, Script, PageTemplate):
>     pt_getContext = ZopePageTemplate.pt_getContext

Hm, this seems lame.

> This works fine with Zope 2.7,

Hm, I'm surprised.

 > but raises an error with Zope HEAD:
> 
> TypeError: unbound method pt_getContext() must be called with 
> ZopePageTemplate instance as first argument (got nothing instead)

This is consistent with standard Python behavior:

 >>> class X:
...   def foo(self): pass
...
 >>> class Y:
...   foo = X.foo
...
 >>> y = Y()
 >>> y.foo()
Traceback (most recent call last):
   File "<stdin>", line 1, in ?
TypeError: unbound method foo() must be called with X instance as first argument (got nothing instead)

So I'm inclined to consider the new behavior correct.

> I fixed this one and now a CMF Site seems to work, but I'm afraid this 
> pattern is used in other places. The unittests show this:
> 
> TypeError: unbound method manage_addPortalFolder() must be called with 
> PortalFolder instance as first argument (got str instance instead)

Dang, I should have tested CMF with 2.8.

> 
> 4.) some objects publishable in Zope 2.7 aren't publishable anymore

Can you give any specifics?

> No big deal to add docstrings, but what's the policy change?

For better or worse, it has always been policy not to publish objects
without non-empty doc strings.

> 5.) other issues
> 
> I was not able to track this error down, but maybe you've got an idea 
> what's going wrong here?
> 
> http://localhost:8080/myCMFSite/portal_types/Document/manage_propertiesForm
> Traceback (innermost last):
>   Module ZPublisher.Publish, line 100, in publish
>   Module ZPublisher.mapply, line 88, in mapply
>   Module ZPublisher.Publish, line 40, in call_object
>   Module Products.CMFCore.utils, line 350, in manage_propertiesForm
>   Module Shared.DC.Scripts.Bindings, line 252, in __call__
>   Module Shared.DC.Scripts.Bindings, line 281, in _bindAndExec
>   Module Shared.DC.Scripts.Bindings, line 1, in ?
>   Module Shared.DC.Scripts.Bindings, line 218, in _getContext
> AttributeError: aq_parent

Not off-hand.  I'll chase this down if no one else does.

I'd really appreciate some help with this.  In other words, I'd
really like others to pick these issues up and run with them.  I did the
hard part.  It took me a good bit of time stolen from Zope 3.

Jim


-- 
Jim Fulton           mailto:jim at zope.com       Python Powered!
CTO                  (540) 361-1714            http://www.python.org
Zope Corporation     http://www.zope.com       http://www.zope.org




More information about the Zope-Dev mailing list