diff options
author | luxagraf <sng@luxagraf.net> | 2014-05-28 03:15:17 +0000 |
---|---|---|
committer | luxagraf <sng@luxagraf.net> | 2014-05-28 03:15:17 +0000 |
commit | d6379dbc06393d286eedfd19c842f824100f2968 (patch) | |
tree | 33202251b122aa0d9a12ba47c6ceedbf7b8b1012 /app/builder | |
parent | f840e5310215ffb894ea8a648ea03d463d029fbc (diff) |
bug fixes, lots o bugs
Diffstat (limited to 'app/builder')
-rw-r--r-- | app/builder/base.py | 17 |
1 files changed, 9 insertions, 8 deletions
diff --git a/app/builder/base.py b/app/builder/base.py index 017cbd6..09e0a95 100644 --- a/app/builder/base.py +++ b/app/builder/base.py @@ -18,8 +18,8 @@ class Build(): if not os.path.isdir(path): os.makedirs(path) fpath = '%s%s.%s' % (path, filename, ext) - file = open(fpath, 'wt') - file.write(str(text_object)) + file = open(fpath, 'wb') + file.write(text_object) file.close() if ext == 'js': import jsmin @@ -86,7 +86,7 @@ class BuildWriting(Build): blog = get_model('blog', 'entry') regions = model.objects.all() for c in regions: - qs = blog.objects.filter(status__exact=1, location__state__country__region=c.id).order_by('-pub_date') + qs = blog.objects.filter(status__exact=1, location__state__country__lux_region=c.id).order_by('-pub_date') path = 'writing/%s/' % (c.slug) self.build_archive_pages(qs, path) @@ -156,9 +156,9 @@ class BuildPhotos(Build): fpath = '%sdesign/templates/js/leaflet-providers.js' % settings.PROJ_ROOT leaflet_providers_js = open(fpath, 'r').read() fpath = '%sapp/photos/photos.js' % settings.PROJ_ROOT - photos_js = open(fpath, 'r').read() + photos_js = open(fpath, 'r', encoding='UTF8').read() js = leaflet_providers_js + photos_js - self.write_file('media/js/', str(js), 'js', 'photos') + self.write_file('media/js/', js.encode('utf-8'), 'js', 'photos') class BuildProjects(Build): def build(self): @@ -166,6 +166,7 @@ class BuildProjects(Build): self.build_project_details() self.build_project_data() self.build_gifs() + self.build_np_basejs() def get_projects(self): all_proj = [] @@ -221,7 +222,7 @@ class BuildProjects(Build): for park in model.objects.filter(visited__exact=True): path = 'projects/data/natparks/' json = park.mpoly.json - self.write_file(path, json, 'json', park.id) + self.write_file(path, json.encode('utf-8'), 'json', park.id) def build_np_basejs(self): fpath = '%sdesign/templates/js/leaflet-providers.js' % settings.PROJ_ROOT @@ -229,7 +230,7 @@ class BuildProjects(Build): fpath = '%sapp/projects/natparks.js' % settings.PROJ_ROOT natparks_js = open(fpath, 'r').read() js = leaflet_providers_js + natparks_js - self.write_file('media/js/', str(js), 'js', 'natparks') + self.write_file('media/js/', js.encode('utf-8'), 'js', 'natparks') class BuildSitemap(Build): @@ -266,7 +267,7 @@ class BuildMap(Build): fpath = '%sdesign/templates/js/leaflet-providers.js' % settings.PROJ_ROOT leaflet_providers_js = open(fpath, 'r').read() js = leaflet_providers_js + t.decode(encoding='UTF-8') - self.write_file('media/js/', str(js), 'js', 'mainmap') + self.write_file('media/js/', js.encode('utf-8'), 'js', 'mainmap') c = Context({ 'country_list': cl, 'region_list': rl, |