Carl,
Good idea. The mod below for the pemmixin.setALL method this seems
to work....
if ok:
if filt:
try:
ok = eval("kid.%s" % filt)
except:
ok = False
Note: For a complex filter you have to explicitly use kid.property for the
second and subsequent clauses...
For example, if you have a filter set to...
filt = "property1 == val1 and property2 == val2 and property3 == val3"
It gets evaluated as "kid.property1 == val2 and property2== val2 and
property3 == val3"
so to get it to work we would have to put...
filt = "property1 == val1 and kid.property2 == val2 and kid.property3 ==
val3"
Larry
-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On
Behalf Of Carl Karsten
Sent: Tuesday, May 01, 2007 4:16 PM
To: Dabo Users list
Subject: Re: [dabo-users] Filtering setAll - followup 2
[EMAIL PROTECTED] wrote:
> I found the code for the setAll and I think I know what the issue is...
>
> for kid in kids:
> ok = hasattr(kid, prop)
> if ok:
> if filt:
> ok = eval("kid.%s" % filt)
> if ok:
> setattr(kid, prop, val)
> if recurse:
> if hasattr(kid, "setAll"):
> kid.setAll(prop, val, recurse=recurse, filt=filt)
>
Not that it matters, but this code can be sped up by replacing the if
hasattr(
with a try catch pattern. I'm too tangled up in my current project to
adjust it.
> Am I correct in that the substitution will breakdown if there is a complex
> filter with AND's /OR's?
it is probably what it says "RAClasses.RATextBox is not defined"
cut/paste the stack dump showing the error.
Carl K
[excessive quoting removed by server]
_______________________________________________
Post Messages to: [email protected]
Subscription Maintenance: http://leafe.com/mailman/listinfo/dabo-users
Searchable Archives: http://leafe.com/archives/search/dabo-users
This message: http://leafe.com/archives/byMID/dabo-users/!&[EMAIL PROTECTED]