[Buildbot-devel] compare_attrs in 0.8.12

Pierre Tardy tardyp at gmail.com
Wed Jul 15 09:47:28 UTC 2015

Le mer. 15 juil. 2015 à 06:08, Edmund Wong <ewongbb at pw-wspx.org> a écrit :

> Hi,
> Is compare_attrs supposed to be a list or a tuple?  Right now,
> there are instances where it's a tuple, and there are instances
> where it's a list.

I think it should be iterable.

> Now things would be ok if there's no way to mix them; but,
> I've encountered an issue with a project that I'm involved in
> that has a generic function that creates schedulers based
> on properties of the base_class.
> This generic function is run on different scheduler classes,
> whose base class use different types of compare_attrs.  Of
> course, I can avoid that by checking what type the
> base_class's compare_attrs is and then concatenate accordingly.

Indeed, this is a problem for class that does things like:
    compare_attrs = ClusteredService.compare_attrs + \
        ('builderNames', 'properties', 'codebases')

So you want to create a class that can either derive from a list based
compare_attrs class or a tuple based compare_attrs class?

I think we should rather use the same technic as for renderable.
Each class should declare the attributes they care about, and the
ComparableMixin should gather and concatenate everything.

from twisted.python.reflect import accumulateClassList

            accumulateClassList(self.__class__, 'renderables', renderables)

> But wouldn't it be more consistent to use one single type?
> Or did I miss the point of compare_attrs? (and that's possibly
> the case here)
> Edmund
> ------------------------------------------------------------------------------
> Don't Limit Your Business. Reach for the Cloud.
> GigeNET's Cloud Solutions provide you with the tools and support that
> you need to offload your IT needs and focus on growing your business.
> Configured For All Businesses. Start Your Cloud Today.
> https://www.gigenetcloud.com/
> _______________________________________________
> Buildbot-devel mailing list
> Buildbot-devel at lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/buildbot-devel
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://buildbot.net/pipermail/devel/attachments/20150715/886866a9/attachment.html>

More information about the devel mailing list