Skip to content

Commit

Permalink
Update core.py
Browse files Browse the repository at this point in the history
  • Loading branch information
cxong committed Oct 25, 2018
1 parent a142cc2 commit 084c27a
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions cyrax/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
import os.path as op
import sys
import glob
from io import open

from cyrax.conf import Settings
from cyrax.template import initialize_env
Expand Down Expand Up @@ -33,7 +34,7 @@ def impcallback(relpath, root):

def get_entry(site, path):
try:
Type = (t for t in TYPE_LIST if t.check(site, path)).next()
Type = next(t for t in TYPE_LIST if t.check(site, path))
except StopIteration:
logger.error("Can't determine type for %s" % path)
return
Expand All @@ -49,7 +50,7 @@ def __init__(self, root, dest):
self.settings = Settings(parent_tmpl='_base.html')
conf = op.join(self.root, 'settings.cfg')
if op.exists(conf):
self.settings.read(file(conf).read().decode('utf-8'))
self.settings.read(open(conf, 'rt').read())

site_base_path = base_path(self.url)
self.dest = op.join(dest, url2path(site_base_path[1:]))
Expand Down Expand Up @@ -77,7 +78,7 @@ def __getitem__(self, name):
def __getattr__(self, name):
try:
return self.settings[name]
except KeyError, e:
except KeyError as e:
raise AttributeError(str(e))

def _traverse(self):
Expand Down

0 comments on commit 084c27a

Please sign in to comment.