905558: Mixin class for dealing with HTTPS URL related stuff

Added 6 years ago by Peter Bengtsson


2 Add your love!


I add this mixin class to my request handlers like this for example:

class DashboardHandler(tornado.web.RequestHandler, HTTPSMixin):
    def get(self):
        if self.get_current_user() and not self.is_secure():
            return self.redirect(self.httpsify_url())
        elif not self.get_current_user() and self.is_secure():
            return self.redirect(self.httpify_url('/not_allowed_https/'))

File: gistfile1.py