ankursinha.in/blog

neuroscience/fedora/musings

Fri 17 February 2012

Fedora free-media tool: making modifications to the trac?

Posted by ankur in Tech (248 words, approximately a 1 minute read)

I got a feature request for the free-media tool that I've been working on. Benedikt Schäfer asked me if resolving a ticket in the tool could also change the ticket status on the trac. While this is on the TODO already, I sat up last night and looked into it.

I'm making use of cURLpp, which is just a C++ wrapper around libcURL for the tool. Getting the report wasn't really complex:

  1. Log in and save auth cookie
  2. Use saved auth and get report

It seems making modifications is way more complex. I am required to POST data to the server. The complexity is because of the numerous POST fields that I need to first GET, modify (manually here) and then POST back to the server. Here's what the POST data looks like: (I used the firefox tamperdata add-on to get this info. Great add on!)

__FORM_TOKEN=xxxxxxxxxxxxxxxxxx&comment=&field_summary=Test&field_version=i386+DVD&field_keywords=&field_blockedby=&field_blocking=&field_email=&field_country=&action=resolve&action_resolve_resolve_resolution=fixed&ts=&replyto=&cnum=8&submit=Submit+changes

The __FORM_TOKEN needs to be extracted from the cookie the server sends. The rest are values I need to get from the ticket. To make any changes, I need to modify the action, comment, cnum etc fields. I spent about three hours tussling with cURL trying to successfully make a modification, and.. failed :/ (I've never been a web dev really, so it could just be that).

Would anyone know how I could get this done? I've looked around for a TRAC API which would've made life much simpler, but I haven't really found anything. Any and all help would be appreciated :)


 
    
 
 

Comments