[Zope] Generating lists of dicionaries from properties

Meilicke, Scott scott.meilicke@intp.com
Tue, 15 Oct 2002 15:53:11 -0700


Sure, you could use something itemValues() to get a list of items in a
folder, then some combination of:

propertyItems():
Return a list of (id, property) tuples.

propertyIds():
Returns a list of property ids.

getProperty(id, d=None):
Get the property id, returning the optional second argument or None if no
such property is found.

to put the properties into a dictionary for each item in the folder.

Scott

-----Original Message-----
From: Andreas Brinner [mailto:abrinner@gmx.de]
Sent: Tuesday, October 15, 2002 3:38 PM
To: zope@zope.org
Subject: [Zope] Generating lists of dicionaries from properties


Hello,

I'm looking for a way to generate lists of dicionaries from string 
properties. As this is for a public website eval doesn't seem to be the 
best choice.

For an example, I want to get this list of dictionaries:

  prop = ( { "id":"first_entry", "title":"first_title" },
           { "id":"second_entry", "title":"second_title" },
         )

It should be possible, that this information is entered in a human readable 
way as a string property.

Any suggestions?

Thanks

 Andreas


_______________________________________________
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 )
The information contained in this email message may be privileged and is
confidential information intended only for the use of the recipient or any
employee or agent responsible for delivering it to the intended recipient.
Any unauthorized use, distribution or copying of this information is
strictly prohibited and may be unlawful.  If you have received this
communication in error, please notify the sender immediately and destroy the
original message and all attachments from your electronic files.