Skip to content

Commit

Permalink
Note to self: I stil fail at Unicode on Python 3 :-P
Browse files Browse the repository at this point in the history
  • Loading branch information
xolox committed Oct 12, 2016
1 parent 75992f6 commit 0214ba6
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions npm_accel/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -319,7 +319,7 @@ def write_metadata(self, file_in_cache, **overrides):
cache_metadata['last-accessed'] = int(time.time())
cache_metadata['cache-hits'] = cache_metadata.get('cache-hits', 0) + 1
with self.context.atomic_write(metadata_file) as temporary_file:
self.context.write_file(temporary_file, json.dumps(cache_metadata))
self.context.write_file(temporary_file, json.dumps(cache_metadata).encode('UTF-8'))

def read_metadata(self, file_in_cache):
"""
Expand All @@ -332,7 +332,7 @@ def read_metadata(self, file_in_cache):
"""
metadata_file = self.get_metadata_file(file_in_cache)
if self.context.is_file(metadata_file):
return json.loads(self.context.read_file(metadata_file))
return json.loads(auto_decode(self.context.read_file(metadata_file)))
else:
return {}

Expand Down

0 comments on commit 0214ba6

Please sign in to comment.