コード例 #1
0
    def paths(self):
        config = ConfigRunner()
        path_info = {}
        path_info.update(settings.get('servingfiles', {}))
        # Media files
        media_url = config.media_url
        media_root = config.media_root
        if media_url and media_root:
            path_info.update({ media_url: media_root })
        # Static files
        static_url = config.static_url
        static_root = config.static_root
        if static_url and static_root:
            path_info.update({ static_url: static_root })

        return path_info
コード例 #2
0
    def expires(self):
        session_settings = settings.get('sessions')
        if session_settings is not None:
            # Getting the expires function
            expires_func = None
            expires = session_settings.get('expires', '')
            if expires:
                if isinstance(expires, str):
                    try:
                        expires = import_object(expires)
                    except ImportError as error:
                        raise InvalidSessionSettingsException(error)

                if callable(expires):
                    expires_func = expires
                else:
                    raise InvalidSessionSettingsException(
                        "'expires' setting is not callable"
                    )

            return expires_func or expires
        return ''
コード例 #3
0
 def httponly(self):
     session_settings = settings.get('sessions')
     if session_settings is not None:
         return session_settings.get('httponly', '') or ''
     return ''
コード例 #4
0
 def version(self):
     session_settings = settings.get('sessions')
     if session_settings is not None:
         return session_settings.get('version', '') or ''
     return ''
コード例 #5
0
 def secure(self):
     session_settings = settings.get('sessions')
     if session_settings is not None:
         return session_settings.get('secure', '') or ''
     return ''
コード例 #6
0
 def max_age(self):
     session_settings = settings.get('sessions')
     if session_settings is not None:
         return session_settings.get('max_age', '') or ''
     return ''
コード例 #7
0
 def domain(self):
     session_settings = settings.get('sessions')
     if session_settings is not None:
         return session_settings.get('domain', '') or ''
     return ''
コード例 #8
0
 def comment(self):
     session_settings = settings.get('sessions')
     if session_settings is not None:
         return session_settings.get('comment', '') or ''
     return ''
コード例 #9
0
 def path(self):
     session_settings = settings.get('sessions')
     if session_settings is not None:
         return session_settings.get('path', '') or ''
     return ''