[Bugs] #1673 UNSP: discard network history does nothing

Sugar Labs Bugs bugtracker-noreply at sugarlabs.org
Mon Mar 22 19:11:59 EDT 2010


#1673: discard network history does nothing
------------------------------------------+---------------------------------
    Reporter:  quozl                      |          Owner:  tomeu            
        Type:  defect                     |         Status:  new              
    Priority:  Unspecified by Maintainer  |      Milestone:  0.84             
   Component:  sugar                      |        Version:  Git as of bugdate
    Severity:  Minor                      |       Keywords:  r!, olpc-0.84    
Distribution:  OLPC                       |   Status_field:  Unconfirmed      
------------------------------------------+---------------------------------

Comment(by quozl):

 This does effectively write a blank file, in that the file size is zero.

 The code was copied from load_connections.  If you think that an empty
 file should be created without referring to ConfigParser, then you should
 change how load_connections creates the config file when it does not
 exist:

 {{{
     config = ConfigParser.ConfigParser()

     if not os.path.exists(config_path):
         if not os.path.exists(os.path.dirname(config_path)):
             os.makedirs(os.path.dirname(config_path), 0755)
         f = open(config_path, 'w')
         config.write(f)
         f.close()
 }}}

 to

 {{{
     if not os.path.exists(config_path):
         if not os.path.exists(os.path.dirname(config_path)):
             os.makedirs(os.path.dirname(config_path), 0755)
         f = open(config_path, 'w')
         f.close()

     config = ConfigParser.ConfigParser()
 }}}

 A test program consisting of an import of ConfigParser followed by either
 of these two methods costs 104ms on XO-1.5, averaged over 20 runs.  There
 seems to be no real advantage.

 However, I've not tested that inside Sugar.

-- 
Ticket URL: <https://bugs.sugarlabs.org/ticket/1673#comment:7>
Sugar Labs <http://sugarlabs.org/>
Sugar Labs bug tracking system


More information about the Bugs mailing list