Skip to content

Commit

Permalink
Add support for /latest
Browse files Browse the repository at this point in the history
  • Loading branch information
ebidel committed Feb 24, 2015
1 parent df25b53 commit 5c52a4c
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
4 changes: 4 additions & 0 deletions app.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,10 @@ libraries:

handlers:

- url: /latest.*
script: main.app
secure: always

# These needs to be in this order and come for the short URL versions.
- url: /(.+)/components/(.*)/webcomponents(\.min)?.js$
static_files: \1/components/\2/webcomponents.min.js
Expand Down
7 changes: 6 additions & 1 deletion main.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,11 @@ class VersionHandler(webapp2.RequestHandler):

def get(self, version=None):
version_dir = get_default_polymer_version()
self.redirect('/%s%s' % (version_dir, self.request.path))
if self.request.path.startswith('/latest'):
path = self.request.path.replace('/latest', '/%s' % version_dir)
return self.redirect('%s' % path)

return self.redirect('/%s%s' % (version_dir, self.request.path))


routes = [
Expand All @@ -59,6 +63,7 @@ def get(self, version=None):
redirect_to='https://polymer-designer.appspot.com/', strict_slash=True),
RedirectRoute('/apps/polymer-tutorial/finished/', name='tutorial',
redirect_to='https://polymer-tut.appspot.com/', strict_slash=True),
('/latest.*', VersionHandler),
('/docs/.*', VersionHandler),
('/resources/.*', VersionHandler),
('/platform/.*', VersionHandler),
Expand Down

0 comments on commit 5c52a4c

Please sign in to comment.