[Zope] test for the existence of a nodeValue

Jon Bowlas me at jonbowlas.com
Tue Aug 2 14:08:47 EDT 2005


Hi All,

 

I'm pretty new to python and zope but would like to know how I can adapt
this script below to test to see if nodeValue actually contains a value and
if it doesn't then I would like to return a default value I can check for
using my zpt that references this script:

 

if not attobject:

    return ''

version = attobject.get_viewable()

nodes = version.content.documentElement.getElementsByTagName(attname)

if not nodes:

    return ''

return nodes[0].childNodes[0].nodeValue

 

Two parameters are passed to this script attobject, attname. 'attobject' is
an object id and 'attname' is the childNode with the nodeValue I wish to
return.

 

Hope someone can help, and I hope this makes sense.

 

Thanks

 

Jon

 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.zope.org/pipermail/zope/attachments/20050802/d7cb9640/attachment.htm


More information about the Zope mailing list