Mailinglist Archive: zypp-devel (149 mails)
| < Previous | Next > |
Re: [zypp-devel] python: ResPool object is unsubscriptable
- From: Jano Kupec <jkupec@xxxxxxx>
- Date: Mon, 08 Sep 2008 01:23:52 +0200
- Message-id: <48C46288.5010102@xxxxxxx>
Nikolay Derkach wrote:
But there can be multiple PoolItems with the same name (different versions, different kinds)... Such an interface could be provided, but it would still not point to a single PoolItem, but rather a set.
Better use the byName or byIdent iterators, they use indices.
cheers,
jano
--
To unsubscribe, e-mail: zypp-devel+unsubscribe@xxxxxxxxxxxx
For additional commands, e-mail: zypp-devel+help@xxxxxxxxxxxx
Hi,
I would be nice if ResPool objects would be subscriptable
(dictionaries). For example it'd be very convenient to have an access
to pool items like this:
Z = zypp.ZYppFactory_instance().getZYpp()
...
p = Z.pool()
print p[package_name].isInstalled()
where package_name is a key name (pool item name).
But there can be multiple PoolItems with the same name (different versions, different kinds)... Such an interface could be provided, but it would still not point to a single PoolItem, but rather a set.
Right now the only way I could find to do this is:
for item in Z.pool():
if item.name() == pkg_name:
print item.status().isInstalled()
which makes code a bit bloated.
Better use the byName or byIdent iterators, they use indices.
cheers,
jano
--
To unsubscribe, e-mail: zypp-devel+unsubscribe@xxxxxxxxxxxx
For additional commands, e-mail: zypp-devel+help@xxxxxxxxxxxx
| < Previous | Next > |