Skip to content

Commit

Permalink
Corrected to write bytes instead of strings
Browse files Browse the repository at this point in the history
  • Loading branch information
migurski committed Dec 28, 2016
1 parent 7bd20ad commit cf6fe33
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
6 changes: 3 additions & 3 deletions TileStache/Core.py
Original file line number Diff line number Diff line change
Expand Up @@ -146,10 +146,10 @@
import logging
from wsgiref.headers import Headers
try:
from io import StringIO
from io import BytesIO
except ImportError:
# Python 2
from StringIO import StringIO
from StringIO import StringIO as BytesIO
try:
from urllib.parse import urljoin
except ImportError:
Expand Down Expand Up @@ -425,7 +425,7 @@ def getTileResponse(self, coord, extension, ignore_cached=False):

if body is None:
# No one else wrote the tile, do it here.
buff = StringIO()
buff = BytesIO()

try:
tile = self.render(coord, format)
Expand Down
6 changes: 3 additions & 3 deletions TileStache/Providers.py
Original file line number Diff line number Diff line change
Expand Up @@ -74,10 +74,10 @@
import logging

try:
from io import StringIO
from io import BytesIO
except ImportError:
# Python 2
from StringIO import StringIO
from StringIO import StringIO as BytesIO
from string import Template
try:
import urllib.request as urllib2
Expand Down Expand Up @@ -148,7 +148,7 @@ class Verbatim:
''' Wrapper for PIL.Image that saves raw input bytes if modes and formats match.
'''
def __init__(self, bytes):
self.buffer = StringIO(bytes)
self.buffer = BytesIO(bytes)
self.format = None
self._image = None

Expand Down

0 comments on commit cf6fe33

Please sign in to comment.