Browse files

Rename StaticFileHandler.get_entity_tag to compute_etag_for_path

  • Loading branch information...
1 parent 8b332d7 commit 46f520a5d6fecf7d59cda684856f430c7164cac4 @alekstorm committed Jun 25, 2012
Showing with 4 additions and 4 deletions.
  1. +4 −4 tornado/web.py
View
8 tornado/web.py
@@ -1555,7 +1555,7 @@ def get(self, path, include_body=True):
stat_result = os.stat(abspath)[stat.ST_MTIME]
modified = datetime.datetime.fromtimestamp(stat_result)
self.set_header("Last-Modified", modified)
- self.set_header("Etag", '"%s"' % self.get_entity_tag(abspath))
+ self.set_header("Etag", '"%s"' % self.compute_etag_for_path(abspath))
mime_type, encoding = mimetypes.guess_type(abspath)
if mime_type:
@@ -1628,19 +1628,19 @@ def get_version(cls, settings, path):
This method may be overridden in subclasses (but note that it
is a class method rather than a static method). The default
- implementation calls `get_entity_tag`.
+ implementation calls `compute_etag_for_path`.
``settings`` is the `Application.settings` dictionary and ``path``
is the relative location of the requested asset on the filesystem.
The returned value should be a string, or ``None`` if no version
could be determined.
"""
- entity_tag = cls.get_entity_tag(os.path.join(settings["static_path"],
+ entity_tag = cls.compute_etag_for_path(os.path.join(settings["static_path"],
path))
return entity_tag[:5] if entity_tag else None
@classmethod
- def get_entity_tag(cls, abspath):
+ def compute_etag_for_path(cls, abspath):
"""Generate the entity tag to be used in static URLs and the Etag
header.

0 comments on commit 46f520a

Please sign in to comment.