Hi,

I'm new both to Python and Webware, so please excuse my ignorance if it's an
obvious answer!  I'm using the latest CVS version of Webware, if that has
any impact.

I have two classes defined in my Classes.csv (Some fields removed for
clarity) :

Class,Attribute,Type,Default,isRequired,Min,Max,Notes
Person,,,,,,,
,Username,string,,1,4,40,
Developer,,,,,,,
,Person,Person,,1,,,

Now, I can very easily retrieve a person using the fetchObjectsOfClass.
That all works fine.  I have a isDeveloper method in Person, and is
currently defined as :

class Person:
    ...
    Bits cut
    ...

    def isDeveloper( self ):
        devResults = store.fetchObjectsOfClass( Developer )
 

        for developer in devResults:
            if developer.Person() == self:
                return developer
 

        return False

It seems to me to be very inefficient to get all Developers, and see which
one matches the Person I'm testing for.  I'm sure I'm missing something, and
any pointers to a more efficient solution would be gratefully received!

Best Regards,
Carl.




-------------------------------------------------------
This SF.Net email is sponsored by: YOU BE THE JUDGE. Be one of 170
Project Admins to receive an Apple iPod Mini FREE for your judgement on
who ports your project to Linux PPC the best. Sponsored by IBM.
Deadline: Sept. 24. Go here: http://sf.net/ppc_contest.php
_______________________________________________
Webware-discuss mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/webware-discuss

Reply via email to