ajack       2004/03/28 14:01:45

  Modified:    python/gump/output statsdb.py
  Log:
  Try to work with implementations that do not respect get(x, default)

  and complain if no key 'x' exists. At the same time, coerce keys to

  be strings.
  
  Revision  Changes    Path
  1.19      +12 -3     gump/python/gump/output/statsdb.py
  
  Index: statsdb.py
  ===================================================================
  RCS file: /home/cvs/gump/python/gump/output/statsdb.py,v
  retrieving revision 1.18
  retrieving revision 1.19
  diff -u -r1.18 -r1.19
  --- statsdb.py        27 Mar 2004 18:52:09 -0000      1.18
  +++ statsdb.py        28 Mar 2004 22:01:45 -0000      1.19
  @@ -172,13 +172,22 @@
               """ Hopefully means it wasn't there... """
           
       def get(self,key):
  -        return self.db.get(str(key),'')
  +        key=str(key)
  +        val=''
  +        if self.db.has_key(key): val=str(self.db[key])
  +        return val
           
       def getInt(self,key):
  -        return int(self.db.get(str(key),0))
  +        key=str(key)
  +        val=0
  +        if self.db.has_key(key): val=int(self.db[key])
  +        return val
           
       def getFloat(self,key):
  -        return float(self.db.get(str(key),0.0))
  +        key=str(key)
  +        val=0.0
  +        if self.db.has_key(key): val=float(self.db[key])
  +        return val
           
       def getDate(self,key):
           dateF=self.getFloat(key)
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to