def get_user_locale(self):
# The planet is always in english.
- if self.request.host == "planet.ipfire.org":
+ if self.hostname == "planet.ipfire.org":
return tornado.locale.get("en_US")
# Otherwise take the browser locale.
return self.get_browser_locale()
+ @property
+ def hostname(self):
+ # Remove the development prefix
+ return self.request.host.replace(".dev.", ".")
+
@property
def render_args(self):
today = datetime.date.today()
- # Get the requested host and remove the development prefix
- hostname = self.request.host.replace(".dev.", ".")
-
return {
"format_size" : backend.util.format_size,
"format_time" : backend.util.format_time,
- "hostname" : hostname,
+ "hostname" : self.hostname,
"lang" : self.locale.code[:2],
"rss_url" : self.rss_url,
"year" : today.year,