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

Buildbot nobody at buildbot.net
Sat Jul 2 22:11:45 UTC 2011


#2024: Documentation for "WithProperties" is incorrect
------------------------+--------------------
Reporter:  mitcholiver  |       Owner:
    Type:  defect       |      Status:  new
Priority:  minor        |   Milestone:  0.8.5
 Version:  0.8.4p1      |  Resolution:
Keywords:               |
------------------------+--------------------
Changes (by dustin):

 * milestone:  undecided => 0.8.5


Old description:

> 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)

New description:

 The example for using a callable with WithProperites includes an example
 function.  This function does not work.

 The current code:
 {{{
 #!python
      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:

 {{{
 #!python
      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#comment:1>
Buildbot <http://buildbot.net/>
Buildbot: build/test automation


More information about the Commits mailing list