Skip to content

Commit

Permalink
0.8.4 Branch fixups for properties
Browse files Browse the repository at this point in the history
Do not render properties in MailNotifier extraHeaders (Refs #2021)

Make the WithProperties callable example work (Refs #2024)
  • Loading branch information
djmitche committed Jul 2, 2011
1 parent e258afa commit ee833ea
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 12 deletions.
4 changes: 4 additions & 0 deletions master/buildbot/process/build.py
Expand Up @@ -106,6 +106,10 @@ def getProperties(self):
def getProperty(self, propname):
return self.build_status.getProperty(propname)

def hasProperty(self, propname):
return self.build_status.properties.has_key(propname)
has_key = hasProperty

def render(self, value):
"""
Return a variant of value that has any WithProperties objects
Expand Down
8 changes: 1 addition & 7 deletions master/buildbot/status/mail.py
Expand Up @@ -541,18 +541,12 @@ def createEmail(self, msgdict, builderName, title, results, builds=None,
# interpolation if only one build was given
if self.extraHeaders:
for k,v in self.extraHeaders.items():
if len(builds) == 1:
k = builds[0].render(k)
if k in m:
twlog.msg("Warning: Got header " + k +
" in self.extraHeaders "
"but it already exists in the Message - "
"not adding it.")
continue
if len(builds == 1):
m[k] = builds[0].render(v)
else:
m[k] = v
m[k] = v

return m

Expand Down
2 changes: 1 addition & 1 deletion master/buildbot/test/unit/test_process_builder.py
Expand Up @@ -19,7 +19,7 @@
from twisted.python import failure
from twisted.internet import defer
from buildbot.test.fake import fakedb, fakemaster
from buildbot.process import builder, buildrequest
from buildbot.process import builder
from buildbot.db import buildrequests
from buildbot.util import epoch2datetime

Expand Down
4 changes: 2 additions & 2 deletions master/docs/cfg-buildsteps.texinfo
Expand Up @@ -226,9 +226,9 @@ WithProperties('%(now)s', now=lambda _: time.clock())

@example
def determine_foo(props):
if props.has_key('bar'):
if props.hasProperty('bar'):
return props['bar']
elif props.has_key('baz'):
elif props.hasProperty('baz'):
return props['baz']
return 'qux'
Expand Down
3 changes: 1 addition & 2 deletions master/docs/cfg-statustargets.texinfo
Expand Up @@ -997,8 +997,7 @@ text of the message. The @code{type} key is the message type ('plain' or

@item extraHeaders
(dictionary) A dictionary containing key/value pairs of extra headers to add
to sent e-mails. If buildSetStatus is False, both the keys and the values may be
a WithProperties instance.
to sent e-mails. Property interpolation is not supported in this version.

@end table

Expand Down

0 comments on commit ee833ea

Please sign in to comment.