[Zope] Creating python script from python

Mark Gibson mark@kaivo.com
Wed, 21 Aug 2002 13:16:10 -0600


Thanks to all who replied.  I ended up fixing this by adding the
following line after I create the python script object (ob).

ob.ZBindings_edit(ob.getBindingAssignments().getAssignedNames())

This line basically sets the bindings in the object to their current
value.  I still don't know why I have to do this, but it worked.

Mark

Mark Gibson wrote:

> I've built a python product that creates a python script in the zodb. 
> This seems to work, the script appears int the zmi where I expect it to, 
> and looks like I expect it to.
> 
> The problem is, it doesn't work.  When I try to use the python script, I 
> get the following error:
> 
> Error Type: NameError
> Error Value: global name '_' is not defined
> 
> I'll spare you the traceback.  Suffice to say this occurs in the newly 
> created python script.
> 
> When I view the bindings on the script, the '_' appears appropriately in 
> the Namespace field.  If I now hit 'Save Changes' in the bindings 
> screen, the problem goes away; no complaints about the '_'.
> 
> Does anyone have any idea why this would happen?  Any idea how I can get 
> the script to work without following this procedure?
> 
> Again, I don't make any changes to the bindings, I simply hit 'Save 
> Changes' button.
> 
> Thanks,
> Mark
> 
> 
> _______________________________________________
> 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 )