[Zope] ZClass question - array of arrays

Chris Beaven Chris@d-designz.co.nz
Mon, 16 Sep 2002 14:41:20 +1200


Check each item in the overall list like this:

# in an external method
if type(item)==type([]):
  print "it's a list"

# in a Python Script
if same_type(item,[]):
  print "it's a list"


-----Original Message-----
From: Dianne Van Dulken [mailto:Dianne.VanDulken@team.ozemail.com.au]
Sent: Monday, 16 September 2002 2:24 p.m.
To: 'zope@zope.org'
Subject: [Zope] ZClass question - array of arrays


Hi, 

I'm having a little bit of a problem working out what ZClass property I
should be setting.  I want to record an array that can either contain
strings or more arrays.

eg:

It can be 

['a', 'b', 'c'] 

or 

['a', ['b', 'c'], 'd']

or 

[['a','b'], ['c','d'], ['e','f']]

The problem is that I can't work out what property type I should be setting
this to be.  I tried tokens, but tokens won't allow arrays to be saved, and
both lines and strings assume that there will be a string (obviously), which
means that I have to do a lot of splitting on [ and , before I can work with
the data.  The whole idea of the property is that if there is a scalar in
position X, it shows the scalar, otherwise with an array, it shows a random
value from that array.

Is there an obvious type that I am missing?

Thanks

Dianne

_______________________________________________
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 )