> def getCachedResult(cache, key):
>
>      def release(result, item):
>          item.release()
>          return result
>
>      def renew(data):
>          return renew(data)
>
>      def notFound(fail):
>          fail.trap(NotFound)
>
>      def checkObsolete(item):
>          if item.obsolete():
>              return None
>          else:
>              d = item.read()
>              d.addBoth(release, item)
>              d.addCallback(renew)
>              return d
>
>      d = cache.open(key)
>      d.addCallbacks(checkObsolete, notFound)
>      return d
>    
Hi Terry
If item.obsolete() raise exception item remain not released.
Additional try ... except ... safe us but looks ugly

_______________________________________________
Twisted-Python mailing list
Twisted-Python@twistedmatrix.com
http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-python

Reply via email to