Skip to content

Commit

Permalink
move to granary.io domain: redirect granary-demo.appspot.com and www
Browse files Browse the repository at this point in the history
  • Loading branch information
snarfed committed Nov 25, 2017
1 parent f3dd836 commit 51dc793
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
4 changes: 4 additions & 0 deletions api.py
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,9 @@
'xml',
)

canonicalize_domain = handlers.redirect(
('granary-demo.appspot.com', 'www.granary.io'), 'granary.io')


class Handler(handlers.ModernHandler):
"""Base class for API handlers.
Expand All @@ -92,6 +95,7 @@ class Handler(handlers.ModernHandler):
"""
handle_exception = handlers.handle_exception

@canonicalize_domain
def get(self):
"""Handles an API GET.
Expand Down
6 changes: 6 additions & 0 deletions app.py
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,10 @@ class FrontPageHandler(handlers.TemplateHandler):
"""Renders and serves the front page."""
handle_exception = handlers.handle_exception

@api.canonicalize_domain
def get(self, *args, **kwargs):
return super(FrontPageHandler, self).get(*args, **kwargs)

def template_file(self):
return 'granary/templates/index.html'

Expand All @@ -91,6 +95,7 @@ class DemoHandler(handlers.ModernHandler):
"""Handles silo requests from the interactive demo form on the front page."""
handle_exception = handlers.handle_exception

@api.canonicalize_domain
def get(self):
site = util.get_required_param(self, 'site')
group = self.request.get('group_id') or source.ALL
Expand Down Expand Up @@ -124,6 +129,7 @@ class UrlHandler(api.Handler):
"""
handle_exception = handlers.handle_exception

@api.canonicalize_domain
def get(self):
input = util.get_required_param(self, 'input')
if input not in INPUTS:
Expand Down

0 comments on commit 51dc793

Please sign in to comment.