Skip to content

Commit

Permalink
fixed encoding troubles for python 2.7
Browse files Browse the repository at this point in the history
  • Loading branch information
yaph committed Sep 8, 2013
1 parent 8238379 commit c9b40fa
Show file tree
Hide file tree
Showing 4 changed files with 3 additions and 5 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,5 @@
MANIFEST
build/
dist/
t/
logya.egg-info
3 changes: 0 additions & 3 deletions logya/compat.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@
from BaseHTTPServer import HTTPServer

execfile = execfile
str = unicode

elif (_ver[0] == 3):
import configparser
Expand All @@ -31,7 +30,5 @@
from http.server import SimpleHTTPRequestHandler
from http.server import HTTPServer

str = str

def execfile(exe, args):
exec(compile(open(exe).read(), exe, 'exec'), args)
2 changes: 1 addition & 1 deletion logya/template.py
Original file line number Diff line number Diff line change
Expand Up @@ -72,5 +72,5 @@ def get_source(self, environment, template):
raise TemplateNotFound(template)
mtime = os.path.getmtime(path)
with open(path, 'r') as f:
source = f.read()
source = f.read().decode('utf-8')
return source, path, lambda: mtime == os.path.getmtime(path)
2 changes: 1 addition & 1 deletion logya/writer.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ def getfile(self, dir_dst, path):
def write(self, file, content):
"""Write content to file and close it."""

file.write(str(content))
file.write(content)
file.close()


Expand Down

0 comments on commit c9b40fa

Please sign in to comment.