Example #1
0
def fix_edit_url(url):
    """Add the **shared ssl user name** if is an https protocol and the
    sharedSSL variable is enabled in the applications/settings.py config file.
    """
    if helpers.get_protocol() == 'https' and Config().enableSharedSSL:
        return '~andresru/' + url
    else:
        return url
Example #2
0
 def __init__(self):
     tuple(itertools.starmap(
         super().__setattr__
         ,config.items()
     ))
     self.serverName = os.environ.get('SERVER_NAME') or 'localhost'
     self.databasePath = self.databaseFolder + self.databaseFile
     self.protocol = helpers.get_protocol()
Example #3
0
 def redirect(self, location=''):
     """Set location field"""
     protocol = helpers.get_protocol()
     if location:
         if self.config.serverName in location:
             self.location = 'Location: ' + protocol + '://' \
                           + location + os.linesep
         else:
             if self.config.enableSharedSSL:
                 self.location = 'Location: ' + protocol + '://' \
                               + self.config.sharedSSLPath \
                               + location + os.linesep  
             else:
                 self.location = 'Location: ' + protocol + '://' \
                               + self.config.serverName \
                               + location + os.linesep          
     else:
         self.location = ''
Example #4
0
 def protocol(self):
     """Te protocol (HTTP or HTTPS)"""
     return helpers.get_protocol()