[Zope] Help using list within python method
Michael Long
mlong@datalong.com
Fri, 21 Mar 2003 16:26:35 -0500
DOH...that was a bonehead mistake :(.
Thanks for the help.
Mike
> On Fri, Mar 21, 2003 at 03:48:45PM -0500, Michael Long wrote:
>
> > 172 def listEntriesByGroup(self, groups=["All"]):
> > 173 "Method to list Entries"
> > 174 ret=[]
> > 175 if type(groups) != ListType:
> > 176 EntryIDs = [groups]
>
> you don't use EntryIDs again... maybe you mean:
> groups=[groups]
>
> > 177 if groups == "All":
> > 178 for entry in self.Entries.values():
> > 179 ret.append(entry)
> > 180 else:
> > 181 for entry in self.Entries.values():
> > 182 if entry.Group in groups:
>
> (snip)
> > Module Products.dlAddressBook.AddressBook, line 182, in
listEntriesByGroup
> > TypeError: 'in <string>' requires character as left operand
>
> yep, you passed in groups="some string" and didn't convert it to a list
> before looping over it.
>
> --
>
> Paul Winkler
> http://www.slinkp.com
> Look! Up in the sky! It's PUMA NAZI!
> (random hero from isometric.spaceninja.com)
>
> _______________________________________________
> Zope maillist - Zope@zope.org
> http://mail.zope.org/mailman/listinfo/zope
> ** No cross posts or HTML encoding! **
> (Related lists -
> http://mail.zope.org/mailman/listinfo/zope-announce
> http://mail.zope.org/mailman/listinfo/zope-dev )
>
>