summaryrefslogtreecommitdiff
path: root/app/builder
diff options
context:
space:
mode:
authorlxf <lxf@d1stkfactory>2014-05-29 14:22:46 +0000
committerlxf <lxf@d1stkfactory>2014-05-29 14:22:46 +0000
commit64b86549829c7b2987707a13e92fa43e3834de97 (patch)
treeab9cccba12e02714c1e29850af0d626b51474b17 /app/builder
parentd6379dbc06393d286eedfd19c842f824100f2968 (diff)
bugs fixes and changed image urls to use https
Diffstat (limited to 'app/builder')
-rw-r--r--app/builder/base.py16
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)