def __stat_GET(self, start_response, path, body, env): if __debug__: logging.debug('path: %s', path) key = urllib.unquote_plus(path) try: timestamp = self.__cluster_client.stat(key) except NotAvailableException: start_response('503 Service Unavailable', []) return [''] if timestamp: start_response('200 OK', [ ('Content-Type', 'application/octet-stream'), ('Last-Modified', email.utils.formatdate(timestamper.to_seconds(timestamp))), ('X-Timestamp', timestamper.dumps(timestamp)), ]) return [timestamper.dumps(timestamp)] else: start_response('404 Not Found', []) return ['']
def __values_POST(self, start_response, path, body, env): if __debug__: logging.debug("path: %s", path) key = urllib.unquote_plus(path) value = body.read() timestamp = self.__get_timestamp(env) try: new_timestamp = self.__cluster_client.set(key, timestamp, value) except NotAvailableException: start_response('503 Service Unavailable', []) return [''] if new_timestamp: start_response('200 OK', [ ('Content-Type', 'application/octet-stream'), ('X-Timestamp', timestamper.dumps(new_timestamp)), ]) return [''] else: start_response('503 Service Unavailable', []) return ['']