[tor-bugs] #4913 [Stem]: Add stem.util.conf.Config.save()

Tor Bug Tracker & Wiki torproject-admin at torproject.org
Mon Jan 16 02:33:46 UTC 2012


#4913: Add stem.util.conf.Config.save()
-------------------------+--------------------------------------------------
 Reporter:  gsathya      |          Owner:  atagar      
     Type:  enhancement  |         Status:  needs_review
 Priority:  normal       |      Milestone:              
Component:  Stem         |        Version:              
 Keywords:               |         Parent:              
   Points:               |   Actualpoints:              
-------------------------+--------------------------------------------------
Changes (by gsathya):

  * status:  needs_revision => needs_review


Comment:

 Replying to [comment:2 atagar]:
 > Minor thing but please use another variable name, such as 'output_file'.
 Changed.

 > - if we've used the "set" method to add new config entries then those
 will be missed
 We can fix(for some definition of fix) this by adding the unused_keys() at
 the end. But if the user has already requested some of the keys then this
 won't work.

 Oh, this made me realize - I'm using
 {{{
       for entry in sorted(self.iterkeys()):
         output_file.write('%s %s\n' % (entry, self.get(entry)))
 }}}

 which renders the unused_keys() irrelevant(all the keys would've been
 added to requested_keys after calling save() since we iterate over all the
 items in the contents) -- This is a stupid side effect. I can go around
 this by directly parsing self._contents, but is this necessary?

 >Lets go with the first implementation, though with the keys sorted.

 Done

 https://gitweb.torproject.org/user/gsathya/stem.git/shortlog/refs/heads/Config.save

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


More information about the tor-bugs mailing list