From: carl :: allgigs.c. <ca...@al...> - 2004-09-28 15:14:07
|
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. |