[Zope-CMF] NameError: on global name 'context' is not defined

alan runyan alan runyan" <runyaga@runyaga.com
Tue, 11 Jun 2002 09:13:17 -0500


## Script (Python) "breadcrumbs"
##bind container=container
##bind context=context
##bind namespace=
##bind script=script
##bind subpath=traverse_subpath
##parameters=obj=None
##title=used to make the breadcrumbs in the pathbar
##

I use this same header for each of my python scripts.  I have only 1 python
script in which namespace is bound to _
If they are using the defaults should I remove the ##bind'ings?  this just
started occuring recently.


> On Mon, 2002-06-10 at 13:13, alan runyan wrote:
> > exceptions.NameError on global name 'context' is not defined in
> > '&lt;PythonExpr here.breadcrumbs(here)&gt;',
> >
> > I have been getting this alot lately.  I run Zope2.5.1+CMF1.3b1 w/
python
> > 2.1.3 on linux.  I can tickle this bug sometimes after refreshing a
Product.
> > Recently it has been getting worse ;'(.  http://plone.org is suffering
from
> > these errors (it runs Zope2.5.1a + CMF1.3b1 + python2.1.3 on FreeBSD).
It
> > seems that Plone 0.9.9+CMF1.3 didnt do this.  But Plone in CVS does
cause
> > this behavior.  I am not doing anything hokey to any of the tools.  I
dont
> > believe I get these problems when a script is loaded from within the
ZODB.
> >
> > I saw someone reporting this error on the mailing list but it seems like
the
> > thread went nowhere.
>
>
> At a guess, do you have a (FS)PythonScript which is stored with
> a special binding?  E.g.::
>
>   ## Script (Python) "addtoFavorites"
>   ##title=Add item to favourites
>   ##bind namespace=_
>   ##parameters=
>
> If so, and if the body uses any of the "standard" bindings, they may be
> stomped unless you re-bind them directly.  That header *should* be::
>
>   ## Script (Python) "addtoFavorites"
>   ##title=Add item to favourites
>   ##bind container=container
>   ##bind context=context
>   ##bind namespace=_
>   ##bind script=script
>   ##bind subpath=traverse_subpath
>   ##parameters=
>
> or even just::
>
>   ## Script (Python) "addtoFavorites"
>   ##title=Add item to favourites
>   ##bind context=context
>
> as the body only depends on 'context'.  *Most* FSPythonScripts should
> not have any '##bind' headers, as they use only the default bindings,
> anyway.
>
> Tres.
> --
> ===============================================================
> Tres Seaver                                tseaver@zope.com
> Zope Corporation      "Zope Dealers"       http://www.zope.com
>
>
>
> _______________________________________________
> Zope-CMF maillist  -  Zope-CMF@zope.org
> http://lists.zope.org/mailman/listinfo/zope-cmf
>
> See http://www.zope.org/Products/PTK/Tracker for bug reports and feature
requests
>