I've added getKind() and iterItems() classmethods to schema.Item, so that you
can more easily get at kinds or do KindQueries. For example, you can replace
code like this:
kind = "//parcels/osaf/contentmodel/mail/IMAPAccount"
for item in ItemQuery.KindQuery().run([view.findPath(kind)]):
if item.isActive and item.host and item.username:
yield item
with this:
for item in Mail.IMAPAccount.iterItems(view):
if item.isActive and item.host and item.username:
yield item
That's a great idea. I'll add the same to the Kind class. There already is an
iterAttributes() method there. An iterItems() makes sense.
It should work as follows:
for item in mailItem.itsKind.iterItems():
.....
Ultimately though, the hope is that there is going to be a lot less use of
KindQuery once the new ItemCollection/Query/AbstractSet stuff becomes
mainstream.
Basically, a KindQuery should be a query of last resort. Using sets, which
ultimately wrap one or more ref collections is a lot more efficient.
Andi..
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
Open Source Applications Foundation "Dev" mailing list
http://lists.osafoundation.org/mailman/listinfo/dev