[Buildbot-devel] Write our buildstep
A.T.Hofkamp
a.t.hofkamp at tue.nl
Fri Sep 16 12:32:21 UTC 2011
On 16/09/11 14:22, Tom Prince wrote:
> You could try something like this instead
>
>
> class ChangeAttribute:
> implements(IRenderable)
>
> def __init__(self, attr):
> self.attr = attr
>
> def getRenderingFor(self, props):
> try:
> return getattr(props.getBuild().allChanges[0], self.attr)
> except:
> return ""
IEKS!
NEVER use "except:" unless you re-raise the exception.
Doing a "except:" hides any error you make in the code, making it non-debuggable.
Instead, explicitly catch the error you want to catch (and let the others propagate upwards).
As the Zen of Python says, explicit is better than implicit.
Albert
More information about the devel
mailing list