Jason R. Coombs avatar Jason R. Coombs committed dbd740e

Removed excess whitespace

Comments (0)

Files changed (1)


 		if request.get_method() is not 'GET':
 			# defer to other handlers
 			return None
 		# check the request cache-control header
 		cc = self._parse_cache_control(request.headers)
 		# check that the user-agent hasn't asked us to bypass the cache
 		if 'no-cache' in cc:
 			return None
 		# get the cached response, or None if it's not found
 		cached_resp = CachedResponse.load(self.store.get(key))
 		if not cached_resp and 'only-if-cached' in cc:
 			raise urllib2.HTTPError(request.get_full_url(), 504,
 				'content is not cached', hdrs=None, fp=None)
 		if cached_resp and not cached_resp.fresh_for(request.headers):
 			log.debug('request is stale')
 			self._add_stale_cache_request_headers(request, cached_resp)
 	def _parse_cache_control(headers):
 		Parse the cache-control header.
 		>>> pcc = CacheHandler._parse_cache_control
 		>>> sample = {'cache-control':'max-age=3, bar=baz, Foo'}
 		>>> sorted(pcc(sample).items())
 			name, sep, val = map(str.lower, map(str.strip,
 			return name, (val or None)
 		cc_header = headers.get('cache-control', '')
 		return dict(map(parse_part, cc_header.split(',')))
 	cached responses.
 	cached = True
 	def from_response(cls, response):
 		cr = cls(response.read())
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.