[Buildbot-devel] Subclassing FileUpload step

Dustin J. Mitchell dustin at v.igoro.us
Tue Nov 30 19:00:07 UTC 2010


On Tue, Nov 30, 2010 at 1:51 PM, Dan Savilonis <djs at n-cube.org> wrote:
> I was wondering about that. I found that matching the constructor
> arguments exactly makes it work. Unfortunately, that makes overriding
> the constructor pretty much useless, since the idea was to provide a
> different set of arguments. In my case, I wanted to provide a build
> file and type, and hide the details of the transfer that's actually
> occurring, as you can see in the original case I presented. Any
> thoughts on how I could do this?

It was a clever way to maintain backward-compatibility of the
configuration file, but yes, it has had some bad consequences, too.

Does it work to add all of the FileUpload parameters as parameters to
your constructor, and simply pass them along to the parent class, but
not specify those arguments in master.cfg?

The other thing you could do is to override getStepFactory - so users
instantiate your class in master.cfg, but its getStepFactory method
returns a tuple (cls, kwargs) where cls is another class (maybe just
FileUpload) and kwargs are constructor arguments appropriate to that
class.

Dustin




More information about the devel mailing list