Skip to content
This repository has been archived by the owner on Apr 9, 2024. It is now read-only.

Commit

Permalink
Redirect index page to default location when it is set in configurati…
Browse files Browse the repository at this point in the history
…on.ini.
  • Loading branch information
frgtn committed Dec 1, 2012
1 parent a2fa977 commit fdf8377
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
4 changes: 4 additions & 0 deletions development.ini
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,10 @@ sms_payment3_credits = 350

small_file_size = 1048576

#Index page redirects to location at this path when set
#Example:
#default_location = vu/mif
default_location =
facebook.appid = 110714995621590
facebook.apikey = ac42e361df48e15229cfdaf95ffc1421
facebook.secret = bc023d5ed577224f99ee66d855a29ec9
Expand Down
8 changes: 8 additions & 0 deletions src/ututi/controllers/home.py
Original file line number Diff line number Diff line change
Expand Up @@ -207,6 +207,14 @@ def index(self):
if c.user is not None:
redirect(url(controller='profile', action='home'))
else:
# If default_location is set in configuration.ini, try
# redirecting to it.
default_location_path = config.get('default_location', None)
if default_location_path:
default_location = LocationTag.get(default_location_path)
if default_location:
return redirect(default_location.url())

self._get_unis()
(c.subjects, c.groups, c.universities) = (self._subjects(), self._groups(), self._universities(limit=12))

Expand Down

0 comments on commit fdf8377

Please sign in to comment.