[tor-bugs] #6114 [Stem]: Implement GETCONF parsing in Stem (was: Implement GETINFO parsing in Stem)

Tor Bug Tracker & Wiki torproject-admin at torproject.org
Sat Jun 9 04:54:46 UTC 2012


#6114: Implement GETCONF parsing in Stem
--------------------+-------------------------------------------------------
 Reporter:  neena   |          Owner:  neena       
     Type:  task    |         Status:  needs_review
 Priority:  normal  |      Milestone:              
Component:  Stem    |        Version:              
 Keywords:          |         Parent:              
   Points:          |   Actualpoints:              
--------------------+-------------------------------------------------------
Changes (by neena):

  * status:  assigned => needs_review


Comment:

 Few things to note:

 - I added another exception class for when the request made by the user is
 invalid instead of raising a ProtocolError. (Since, this isn't really an
 error with the tor following protocol). If this the right way to do it,
 the GETINFO code should probably use it too.

 - This code could probably be made to use a dict mapping strings to
 classes

 {{{
   import stem.response.getinfo
   import stem.response.getconf
   import stem.response.protocolinfo

   if not isinstance(message, ControlMessage):
     raise TypeError("Only able to convert stem.response.ControlMessage
 instances")

   if response_type == "GETINFO":
     response_class = stem.response.getinfo.GetInfoResponse
   elif response_type == "GETCONF":
     response_class = stem.response.getconf.GetConfResponse
   elif response_type == "PROTOCOLINFO":
     response_class = stem.response.protocolinfo.ProtocolInfoResponse
   else: raise TypeError("Unsupported response type: %s" % response_type)
 }}}

   I didn't do this because merging would be a pain (with SAFECOOKIE using
 the preset if-elif chain).

 - That said, atagar, would it be easier for you if I did all my controller
 class work in a single branch? Since, merging multiple branches dealing
 with the same code might be painful? Or is that not a problem?

-- 
Ticket URL: <https://trac.torproject.org/projects/tor/ticket/6114#comment:2>
Tor Bug Tracker & Wiki <https://trac.torproject.org/>
The Tor Project: anonymity online


More information about the tor-bugs mailing list