Skip to content

Commit

Permalink
fix for bug#29 - added support for compressed sitemap
Browse files Browse the repository at this point in the history
  • Loading branch information
Brandon Holtsclaw authored and Arachnid committed Feb 25, 2010
1 parent a99b77c commit 6b419de
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions utils.py
Expand Up @@ -78,6 +78,13 @@ def _get_all_paths():

def _regenerate_sitemap():
import static
import gzip
from StringIO import StringIO
paths = _get_all_paths()
rendered = render_template('sitemap.xml', {'paths': paths})
static.set('/sitemap.xml', rendered, 'application/xml', False)
s = StringIO()
gzip.GzipFile(fileobj=s,mode='wb').write(rendered)
s.seek(0)
renderedgz = s.read()
static.set('/sitemap.xml.gz',renderedgz, 'application/x-gzip', False)

0 comments on commit 6b419de

Please sign in to comment.