[Yum-devel] [RFC] return value of TransactionInfo.add*
Tim Lauridsen
tim.lauridsen at googlemail.com
Wed May 28 10:19:32 UTC 2008
Florian Festi wrote:
> Hi!
>
> This is another API issue thta I already tried to address some time ago:
>
> Transaction.add* do not report back what exactly they did. They
> sometimes even return a txmbr that did not get added at all. Not to talk
> about updated txmbrs and others that might also be the result of the
> method call. This causes problems in the depsolver code as it doesn't
> have a reliable and simple way to know that is really going on.
>
> The attached patch tried to solve that by returning a dict with
> different lists of txmbrs. This dict had to be requested by a special
> param because of API compatibility. In general I don't like that
> solution much. We could now make it the default to return something more
> meaning full. I also don't like the idea of returning a dict very much. + result = {
+ 'one' : txmember,
+ 'new' : [],
+ 'all' : [],
+ 'new_conditionals' : [],
+ 'all_conditionals' : [],
+ }
> I currently think about greating a new result class. This class could
> also offer methods like .modified(). The result class should also be
> suited to be returned from YumBase.install(), .update(), .remove() and
> friends. So we would need a way to collapse several result objects into
> one.
>
> I don't have any code yet but want to ask what the general attitude
> towards such a change is.
>
> Florian
>
i agree that return a dict sucks, and a return class is much better and
count make the code more readable.
If the new return type is enabled by a flag like in the current patch,
then i think it is a better idea to do the return class now and skip the
dict.
Tim
More information about the Yum-devel
mailing list