[CalendarServer-changes] [3971] CalendarServer/trunk/memcache.py

source_changes at macosforge.org source_changes at macosforge.org
Fri Apr 10 17:18:47 PDT 2009


Revision: 3971
          http://trac.macosforge.org/projects/calendarserver/changeset/3971
Author:   sagen at apple.com
Date:     2009-04-10 17:18:46 -0700 (Fri, 10 Apr 2009)
Log Message:
-----------
Raise an exception when a get fails (rather than silently return None)

Modified Paths:
--------------
    CalendarServer/trunk/memcache.py

Modified: CalendarServer/trunk/memcache.py
===================================================================
--- CalendarServer/trunk/memcache.py	2009-04-10 22:26:46 UTC (rev 3970)
+++ CalendarServer/trunk/memcache.py	2009-04-11 00:18:46 UTC (rev 3971)
@@ -85,6 +85,11 @@
 class _Error(Exception):
     pass
 
+class MemcacheError(_Error):
+    """
+    Memcache connection error
+    """
+
 try:
     # Only exists in Python 2.4+
     from threading import local
@@ -698,7 +703,7 @@
         check_key(key)
         server, key = self._get_server(key)
         if not server:
-            return None
+            raise MemcacheError("Memcache connection error")
 
         self._statlog('get')
 
@@ -712,7 +717,7 @@
         except (_Error, socket.error), msg:
             if type(msg) is types.TupleType: msg = msg[1]
             server.mark_dead(msg)
-            return None
+            raise MemcacheError("Memcache connection error")
         return value
 
     def get_multi(self, keys, key_prefix=''):
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/calendarserver-changes/attachments/20090410/d472aba0/attachment-0001.html>


More information about the calendarserver-changes mailing list