[Zope] Re: Help - cannot import zexp

Oleg Broytmann phd@mail2.phd.pp.ru
Sat, 2 Dec 2000 14:16:31 +0300 (MSK)


Hi!

   Followup to myself...

On Fri, 1 Dec 2000, Oleg Broytmann wrote:
>    Please help, I have a problem importing my zexp.
>    Initially I created the exported zexp while debugging some External
> Method. The method is declared as follows:
>     def navigation_leftColumn(self, _, render=default_render):
> where default_render is a helper function, defined in the same .py file:
>     def default_render(self, _, alist=None, indent=0):
>
> Later I deleted the entire folder and tried to import zexp to return to
> saved position. Zope raise the error:
>    "Cannot import class default_render from module __main__". Oops!
> What's that? The default_render isn't a class in __main__, sure. I tried
> to create External Method before importing, but this didn't help :(

   Nobody dared to answer? Well, I am not in big trouble here - I have
previous backup; I can import it and will redo all changes.
   But I think I found a bug or undocumented misfeature in Zope External
Methods. The problem is in default parameter (render=default_render). By
some reason Zope stores (pickles?) it in wrong way, so later it cannot be
imported. I'll remove this argument (or replace it with render=None) and I
am sure the problem will gone away, and I can export and reimport it
safely.

Oleg.
----
     Oleg Broytmann     http://www.zope.org/Members/phd/     phd@phd.pp.ru
           Programmers don't die, they just GOSUB without RETURN.