[Zope] recipe-question
Sven Hohage
hohage@muenster.de
Fri, 23 Nov 2001 22:30:53 +0100
This is a multi-part message in MIME format.
------=_NextPart_000_0009_01C1746E.82C44550
Content-Type: text/plain;
charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable
I'm using a nice small python-script from zopelabs:
objects =3D context.objectValues() #get the =
objects in this folder
for object in objects:
print "id:", object.id
property_names =3D object.propertyIds() # list of dictionaries =
of property names.
for property in property_names:
print property + ": " + object.getProperty(property)
print
print
return printed
The things I don't get are use of the double print statement and more =
importantly the need for returning printed.
Why isn't print enough.
Thanks.
------=_NextPart_000_0009_01C1746E.82C44550
Content-Type: text/html;
charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META http-equiv=3DContent-Type content=3D"text/html; =
charset=3Diso-8859-1">
<META content=3D"MSHTML 6.00.2600.0" name=3DGENERATOR>
<STYLE></STYLE>
</HEAD>
<BODY bgColor=3D#ffffff>
<DIV><FONT face=3DArial size=3D2>I'm using a nice small =
python-script from=20
zopelabs:</FONT></DIV>
<DIV><PRE><FONT face=3D"Lucida,Courier New"><FONT =
color=3D#000000>objects</FONT> <FONT class=3Doperator =
color=3D#0000c0>=3D</FONT> <FONT color=3D#000000>context</FONT><FONT =
class=3Doperator color=3D#0000c0>.</FONT><FONT =
color=3D#000000>objectValues</FONT><FONT class=3Doperator =
color=3D#0000c0>(</FONT><FONT class=3Doperator color=3D#0000c0>)</FONT> =
<FONT class=3Dcomment color=3D#008000>#get the =
objects in this folder</FONT>
<FONT class=3Dkeyword color=3D#c00000>for</FONT> <FONT =
color=3D#000000>object</FONT> <FONT class=3Dkeyword =
color=3D#c00000>in</FONT> <FONT color=3D#000000>objects</FONT><FONT =
class=3Doperator color=3D#0000c0>:</FONT>
<FONT class=3Dkeyword color=3D#c00000>print</FONT> <FONT =
class=3Dstring color=3D#004080>"id:"</FONT><FONT class=3Doperator =
color=3D#0000c0>,</FONT> <FONT color=3D#000000>object</FONT><FONT =
class=3Doperator color=3D#0000c0>.</FONT><FONT color=3D#000000>id</FONT>
<FONT color=3D#000000>property_names</FONT> <FONT class=3Doperator =
color=3D#0000c0>=3D</FONT> <FONT color=3D#000000>object</FONT><FONT =
class=3Doperator color=3D#0000c0>.</FONT><FONT =
color=3D#000000>propertyIds</FONT><FONT class=3Doperator =
color=3D#0000c0>(</FONT><FONT class=3Doperator color=3D#0000c0>)</FONT> =
<FONT class=3Dcomment color=3D#008000># list of dictionaries of =
property names.</FONT>
<FONT class=3Dkeyword color=3D#c00000>for</FONT> <FONT =
color=3D#000000>property</FONT> <FONT class=3Dkeyword =
color=3D#c00000>in</FONT> <FONT =
color=3D#000000>property_names</FONT><FONT class=3Doperator =
color=3D#0000c0>:</FONT>
<FONT class=3Dkeyword color=3D#c00000>print</FONT> <FONT =
color=3D#000000>property</FONT> <FONT class=3Doperator =
color=3D#0000c0>+</FONT> <FONT class=3Dstring color=3D#004080>": =
"</FONT> <FONT class=3Doperator color=3D#0000c0>+</FONT> <FONT =
color=3D#000000>object</FONT><FONT class=3Doperator =
color=3D#0000c0>.</FONT><FONT color=3D#000000>getProperty</FONT><FONT =
class=3Doperator color=3D#0000c0>(</FONT><FONT =
color=3D#000000>property</FONT><FONT class=3Doperator =
color=3D#0000c0>)</FONT>
<FONT class=3Dkeyword color=3D#c00000>print</FONT>
<FONT class=3Dkeyword color=3D#c00000>print</FONT>
<FONT class=3Dkeyword color=3D#c00000>return</FONT> <FONT =
color=3D#000000>printed</FONT></FONT></PRE><PRE><FONT =
face=3D"Lucida,Courier New">The things I don't get are use of the double =
print statement and more importantly the need for returning =
printed.</FONT></PRE><PRE>Why isn't print =
enough.</PRE><PRE>Thanks.</PRE><PRE><FONT face=3D"Lucida,Courier =
New"><FONT =
color=3D#000000></FONT></FONT> </PRE></DIV></BODY></HTML>
------=_NextPart_000_0009_01C1746E.82C44550--