Yep, much better not to use eval(). thanks.

On Thursday, January 23, 2014 1:40:26 PM UTC-8, Christian Hammond wrote:
>
> For the update call, instead of using eval, just do:
>
>     fields = {
>         RRDField: RRDValue,
>     }
>     draft.update(fields)
>
> or:
>
>     draft.update(**{
>         RRDField: RRDValue,
>     })
>
> -- 
> Christian Hammond - chi...@chipx86.com <javascript:>
> Review Board - http://www.reviewboard.org
> Beanbag, Inc. - http://www.beanbaginc.com
>
>
> On Thu, Jan 23, 2014 at 12:52 PM, <markd...@gmail.com <javascript:>>wrote:
>
>> How about
>>
>> from rbtools.api.client import RBClient
>>
>> server_url = "https://<server root>
>>
>> # choose the review request Id
>> # RRId=<some review request number>
>>
>> # choose the field to update
>> RRDField="changedescription"
>>
>> # the value to set
>> RRDValue="This is a change description"
>>
>> # connect to the server
>> client=RBClient(server_url)
>>
>> # find the root object
>> root=client.get_root()
>>
>> # get the review request
>> rr=root.get_review_request(review_request_id=RRId)
>>
>> # make a new draft
>> draft=rr.get_or_create_draft()
>>
>> # change the specified field
>> update_args = RRDField + " = \""  + RRDValue+ "\""
>> eval ("draft.update(" + update_args + ")" )
>>
>> #publish the draft
>> draft.update(public=True)
>>
>>
>> On Tuesday, October 1, 2013 5:25:05 AM UTC-7, Lynn Lin wrote:
>>>
>>> Thanks,any hint to us to write a customize script to support this?
>>>
>>> On Tuesday, October 1, 2013 5:53:14 AM UTC+8, Christian Hammond wrote:
>>>>
>>>> --change-only really is intended only for Perforce, and will not work 
>>>> for this case.
>>>>
>>>> Today, you cannot set only a field without uploading a diff using 
>>>> post-review or rbt post. That would need to be added.
>>>>
>>>> It would be pretty easy, though, to write a custom script using the 
>>>> RBTools Python API to just upload the fields you want. We probably should 
>>>> introduce a command for setting fields only, but we don't have that today.
>>>>
>>>> Christian
>>>>
>>>> -- 
>>>> Christian Hammond - chi...@chipx86.com
>>>> Review Board - http://www.reviewboard.org
>>>> Beanbag, Inc. - http://www.beanbaginc.com
>>>>
>>>>
>>>> On Mon, Sep 30, 2013 at 2:34 PM, Steve <seide...@gmail.com> wrote:
>>>>
>>>>> I haven't tried this, but does it work if you include the 
>>>>> --change-only option?
>>>>>
>>>>> --steve
>>>>>
>>>>>
>>>>> On Saturday, September 28, 2013 8:04:36 PM UTC-7, Lynn Lin wrote:
>>>>>>
>>>>>> Environment: 
>>>>>> Git source code repostior
>>>>>> y Linux ubuntu 
>>>>>> RBTools:0.5.2
>>>>>> Reviewboard:1.6.1 
>>>>>>  
>>>>>>  
>>>>>>
>>>>>> I try to *ONLY* update testing-done field for a existing review 
>>>>>> request on reviewboard through post-review
>>>>>>
>>>>>> here is my command: 
>>>>>>
>>>>>> post-review --testing-done="cppcheck results,unit test results link abc 
>>>>>> " -r 9906  -p 
>>>>>>
>>>>>> output:
>>>>>>
>>>>>> There don't seem to be any diffs!
>>>>>>
>>>>>> Could post-review support only update testing-done field?
>>>>>>
>>>>>  -- 
>>>>> Get the Review Board Power Pack at http://www.reviewboard.org/
>>>>> powerpack/
>>>>> ---
>>>>> Sign up for Review Board hosting at RBCommons: https://rbcommons.com/
>>>>> ---
>>>>> Happy user? Let us know at http://www.reviewboard.org/users/
>>>>> --- 
>>>>> You received this message because you are subscribed to the Google 
>>>>> Groups "reviewboard" group.
>>>>> To unsubscribe from this group and stop receiving emails from it, send 
>>>>> an email to reviewboard...@googlegroups.com.
>>>>> For more options, visit https://groups.google.com/groups/opt_out.
>>>>>
>>>>
>>>>  -- 
>> Get the Review Board Power Pack at http://www.reviewboard.org/powerpack/
>> ---
>> Sign up for Review Board hosting at RBCommons: https://rbcommons.com/
>> ---
>> Happy user? Let us know at http://www.reviewboard.org/users/
>> --- 
>> You received this message because you are subscribed to the Google Groups 
>> "reviewboard" group.
>> To unsubscribe from this group and stop receiving emails from it, send an 
>> email to reviewboard...@googlegroups.com <javascript:>.
>>
>> For more options, visit https://groups.google.com/groups/opt_out.
>>
>
>

-- 
Get the Review Board Power Pack at http://www.reviewboard.org/powerpack/
---
Sign up for Review Board hosting at RBCommons: https://rbcommons.com/
---
Happy user? Let us know at http://www.reviewboard.org/users/
--- 
You received this message because you are subscribed to the Google Groups 
"reviewboard" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to reviewboard+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to