redirect

This utility sets up different redirects from the CS 61A website. To add new redirects, edit the lookup dictionary in main.py. At the end of a semester, edit deploy.yaml to include <semester>.cs61a.org. This target will automatically redirect to inst.eecs.berkeley.edu/~cs61a/<semester>.

This app has no local setup instructions, because it is not meant to be run locally.

Code Documentation

All of the code for redirection is contained in main.py. It tries to retrieve from a set LOOKUP dictionary and if it doesn’t exist tries to directly get a url from the inst.eecs website. catch_all() recieves a path and calls lookup() to get the link. lookup() creates the redirect link.

redirect.main.lookup(hostname)[source]

Gets the URL to redirect to based on a hostname.

Parameters

hostname (string) – redirect link to check

Returns

a string that represents the url to redirect to

redirect.main.catch_all(path)[source]

Gets the URL to redirect to based on a path if it exists.

Parameters

path (string) – path to return to, doesn’t have to exist

Returns

a string that represents the url to redirect to