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

wahwah at users.sourceforge.net wahwah at users.sourceforge.net
Tue Feb 26 12:40:29 CET 2013


Revision: 20337
          http://gar.svn.sourceforge.net/gar/?rev=20337&view=rev
Author:   wahwah
Date:     2013-02-26 11:40:28 +0000 (Tue, 26 Feb 2013)
Log Message:
-----------
pkgdb: Use anydbm instead of gdbm

We don't care which implementation of dbm we're using.

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

Modified: csw/mgar/gar/v2/lib/python/rest.py
===================================================================
--- csw/mgar/gar/v2/lib/python/rest.py	2013-02-25 14:59:14 UTC (rev 20336)
+++ csw/mgar/gar/v2/lib/python/rest.py	2013-02-26 11:40:28 UTC (rev 20337)
@@ -3,7 +3,7 @@
 import os
 from StringIO import StringIO
 import cjson
-import gdbm
+import anydbm
 import logging
 import urllib2
 import pycurl
@@ -211,10 +211,13 @@
 
   def __init__(self, filename):
     self.filename = filename
-    self.d = gdbm.open("%s.db" % self.filename, "c")
+    self.d = anydbm.open("%s.db" % self.filename, "c")
     self.rest_client = RestClient()
-    self.deps = gdbm.open("%s-deps.db" % self.filename, "c")
+    self.deps = anydbm.open("%s-deps.db" % self.filename, "c")
 
+  def __del__(self):
+    self.d.close()
+
   def GetPkgstats(self, md5):
     if str(md5) in self.d:
       return cjson.decode(self.d[md5])

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