[Zope-CMF] problem with python script + catalog re: images

Jean-Francois.Doyon at CCRS.NRCan.gc.ca Jean-Francois.Doyon at CCRS.NRCan.gc.ca
Thu Jan 29 10:40:18 EST 2004


Hello,

I'm doing something terribly simple, and it's not working:

for o in context.portal_catalog( meta_type = ['Portal Image'] ):
    obj = o.getObject()
    print obj.Title()

return printed

I keep getting told that "NoneType" has no attribute "Title" ... I've tried
with a variety of methods ("tag", "title_or_id", "absolute_url", etc ...)
always yielding the same result.

BUT, if I print repr(obj) I get what I'd expect, something like "<Image at
...>".

Also, if i simply print obj, then the output is basically what I'd expect
from tag(), which in this case gives me a page full of every single portal
image catalogged!!

If I just use the LazyBrain version "o" everything works ok ... But in this
case I'm going to need the object itself since I need to call some methods
on it.

I fI try with "Image" instead of "Portal Image" it gets worst, "obj" is
ACTUALLY "None" !?!?

But with any other content type, all works as expected ...

Anyone have any clue what might be going on here ?

Jean-François Doyon
Internet Service Development and Systems Support / Développement des
services et soutien de systèmes Internet
GeoAccess Division / Division GéoAccès
Canada Center for Remote Sensing / Centre canadien de télédétection
Natural Resources Canada / Ressources naturelles Canada
http://atlas.gc.ca
Phone: (613) 992-4902
Fax: (613) 947-2410




More information about the Zope-CMF mailing list