diff options
Diffstat (limited to 'app/builder')
-rw-r--r-- | app/builder/base.py | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/app/builder/base.py b/app/builder/base.py index 09e0a95..4265b8d 100644 --- a/app/builder/base.py +++ b/app/builder/base.py @@ -22,12 +22,12 @@ class Build(): file.write(text_object) file.close() if ext == 'js': - import jsmin - compressed = jsmin.jsmin(str(text_object)) + from jsmin import jsmin fpath = '%s%s.min.%s' % (path, filename, ext) - file = open(fpath, 'wt') - file.write(str(compressed)) - file.close() + compressed = jsmin(text_object.decode(encoding='UTF-8')) + with open(fpath, 'wt') as js_file: + minified = js_file.write(compressed) + js_file.close() def build_archive_pages(self, qs=None, base_path='', paginate_by=10): """ @@ -43,7 +43,7 @@ class Build(): path = '%s%s/' % (base_path, page + 1) url = '/%s%s/' % (base_path, str(page + 1)) page_url = base_path + '%d/' - response = c.post(url, {'page_url': page_url, 'page': int(page), 'builder': True}) + response = c.post(url, {'page_url': page_url, 'page': int(page), 'builder': True}, HTTP_HOST='127.0.0.1') if page == 0: self.write_file(base_path, response.content) self.write_file(path, response.content) @@ -236,7 +236,7 @@ class BuildProjects(Build): class BuildSitemap(Build): def build(self): c = Client() - response = c.get('/sitemap.xml') + response = c.get('/sitemap.xml', HTTP_HOST='127.0.0.1') self.write_file('', response.content, 'xml', 'sitemap') @@ -297,7 +297,7 @@ class BuildPages(Build): class BuildContact(Build): def build(self): c = Client() - response = c.get('/contact/') + response = c.get('/contact/', HTTP_HOST = '127.0.0.1') path = '%scontact/' % (settings.BAKED_ROOT) if not os.path.isdir(path): os.makedirs(path) |