summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChris Rossi <chris@archimedeanco.com>2014-07-16 10:42:37 -0400
committerChris Rossi <chris@archimedeanco.com>2014-07-16 10:42:37 -0400
commit46c0294c5e66712e186de96f55ced580d3ae4c0b (patch)
tree78594622ae385e6b8a78705a01284c6474727042
parentdc97173e0c7306792814e3fa44dc0cd8e0e493b9 (diff)
downloadpyramid-46c0294c5e66712e186de96f55ced580d3ae4c0b.tar.gz
pyramid-46c0294c5e66712e186de96f55ced580d3ae4c0b.tar.bz2
pyramid-46c0294c5e66712e186de96f55ced580d3ae4c0b.zip
Use the framework, Luke.
-rw-r--r--pyramid/static.py10
1 files changed, 3 insertions, 7 deletions
diff --git a/pyramid/static.py b/pyramid/static.py
index 290732640..7616b0a29 100644
--- a/pyramid/static.py
+++ b/pyramid/static.py
@@ -28,7 +28,7 @@ from pyramid.httpexceptions import (
HTTPMovedPermanently,
)
-from pyramid.path import caller_package
+from pyramid.path import AssetResolver, caller_package
from pyramid.response import FileResponse
from pyramid.traversal import traversal_path_info
@@ -159,13 +159,9 @@ def _secure_path(path_tuple):
return encoded
def _generate_md5(spec):
- package, filename = resolve_asset_spec(spec)
- if package:
- stream = pkg_resources.resource_stream(package, filename)
- else:
- stream = open(filename, 'rb')
+ asset = AssetResolver(None).resolve(spec)
md5 = hashlib.md5()
- with stream:
+ with asset.stream() as stream:
for block in iter(lambda: stream.read(4096), ''):
md5.update(block)
return md5.hexdigest()