[Buildbot-commits] [Buildbot] #2024: Documentation for "WithProperties" is incorrect

Buildbot nobody at buildbot.net
Wed Jun 29 20:28:34 UTC 2011


#2024: Documentation for "WithProperties" is incorrect
------------------------+-----------------------
Reporter:  mitcholiver  |      Owner:
    Type:  defect       |     Status:  new
Priority:  minor        |  Milestone:  undecided
 Version:  0.8.4p1      |   Keywords:
------------------------+-----------------------
 The example for using a callable with WithProperites includes an example
 function.  This function does not work.

 The current code:
      def determine_foo(props):
          if props.has_key('bar'):
              return props['bar']
          elif props.has_key('baz'):
              return props['baz']
          return 'qux'

      WithProperties('%(foo)s', foo=determine_foo)

 will fail, as the parameter is of type Build.  Use this instead:
      def determine_foo(build):
          props = build.getProperties()
          if props.has_key('bar'):
              return props['bar']
          elif props.has_key('baz'):
              return props['baz']
          return 'qux'

      WithProperties('%(foo)s', foo=determine_foo)

-- 
Ticket URL: <http://trac.buildbot.net/ticket/2024>
Buildbot <http://buildbot.net/>
Buildbot: build/test automation


More information about the Commits mailing list