[Zope] More about problems between 2-3-1 and 2-4-3
complaw@hal-pc.org
complaw@hal-pc.org
Fri, 7 Dec 2001 14:58:54 GMT
If I had not recompiled the code, would this (could this) result in a NameError
(global name 'namespace' not found) for the following code:
From: Ronald L. Chichester [complaw@hal-pc.org]
Sent: Thursday, December 06, 2001 10:39 PM
To: zope@zope.org
Subject: Re: [Zope] NameError (global name 'namespace' is not defined)
Okay, here is a little more diagnostic information. The 'namespace'
that Zope is complaining about is in the following code:
found = 0 # flag to indicate that the object was/wasn't found...
contents = [] # the return list...
# Run through the objects in the current (context) folder to see if
there is a match (with given_title)...
for obj in context.objectValues('Image'):
if found == 0:
if given_title == obj.title:
url = obj.absolute_url
title = obj.title
contents.append(namespace(url=url, title=title)[0])
found = 1 # Set flag on success...
# If you can't find it in the context, then check the container...
for obj in container.objectValues('Image'):
if found == 0:
if given_title == obj.title:
url = obj.absolute_url
title = obj.title
contents.append(namespace(url=url, title=title)[0])
found = 1 # Set flag on success...
# Return indicative values if the desired object was not found...
if found == 0:
contents.append(namespace(url='', title='')[0])
vars = namespace(contents=contents)
return vars
> Note that everything still works, but it will be slower and will
> complain at you until you go to each of these things and resave them.
> SOmeone came up with a script a while ago that did this.
>
> Ronald L. Chichester wrote:
> > When I use python scripts created under Zope 2-3-1, I get an
> > informational message:
> >
> > PROBLEM (100) Script (Python) Object "my_script_name" needs to be
> > recompiled.
> >
> >
> > ... Is that why my code written in Zope 2-3-1 doesn't work properly in
> > Zope 2-4-3?
> >
> > If so, how do I recompile?
> >
> > Thanks in advance,
> >
> > Ron
> >
> > _______________________________________________
> > Zope maillist - Zope@zope.org
> > http://lists.zope.org/mailman/listinfo/zope
> > ** No cross posts or HTML encoding! **
> > (Related lists -
> > http://lists.zope.org/mailman/listinfo/zope-announce
> > http://lists.zope.org/mailman/listinfo/zope-dev )
> >
>
>
> --
> Chris McDonough Zope Corporation
> http://www.zope.org http://www.zope.com
> "Killing hundreds of birds with thousands of stones"
>
>
> _______________________________________________
> Zope maillist - Zope@zope.org
> http://lists.zope.org/mailman/listinfo/zope
> ** No cross posts or HTML encoding! **
> (Related lists -
> http://lists.zope.org/mailman/listinfo/zope-announce
> http://lists.zope.org/mailman/listinfo/zope-dev )
>