[csw-devel] SF.net SVN: gar:[20802] csw/mgar/gar/v2/lib/python/configuration.py

wahwah at users.sourceforge.net wahwah at users.sourceforge.net
Thu Apr 18 17:18:40 CEST 2013


Revision: 20802
          http://gar.svn.sourceforge.net/gar/?rev=20802&view=rev
Author:   wahwah
Date:     2013-04-18 15:18:40 +0000 (Thu, 18 Apr 2013)
Log Message:
-----------
pkgdb: Use 'with' to save the config file.

Modified Paths:
--------------
    csw/mgar/gar/v2/lib/python/configuration.py

Modified: csw/mgar/gar/v2/lib/python/configuration.py
===================================================================
--- csw/mgar/gar/v2/lib/python/configuration.py	2013-04-18 15:18:28 UTC (rev 20801)
+++ csw/mgar/gar/v2/lib/python/configuration.py	2013-04-18 15:18:40 UTC (rev 20802)
@@ -103,9 +103,8 @@
       config.set("database", "user", "")
       config.set("database", "password", "")
       config.set("database", "auto_manage", "yes")
-      fd = open(config_file, "w")
-      config.write(fd)
-      fd.close()
+      with open(config_file, "w") as fd:
+        config.write(fd)
       logging.debug("Configuration has been written.")
   if not config.has_section("database"):
     logging.fatal(

This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.



More information about the devel mailing list