예제 #1
0
 def __init__(self, *args, **kwargs):
     """
     Initialize the things required by SessionSecureForm to do its job
     This __init__ handles the problem with calling SessionSecureForm.__init__()
     outside of a flask request context.
     """
     self.SECRET_KEY = 'not really secret, this will only happen in a testing context'
     csrf_context = {}
     
     if app:
         # TODO: need to set csrf_context to something? (the flask session maybe?)
         self.SECRET_KEY = app.config['SECRET_KEY']
     
     SessionSecureForm.__init__(self, csrf_context=csrf_context, *args, **kwargs)
 def __init__(self, *args, **kwargs):
     """
     Initialize the things required by SessionSecureForm to do its duty
     This __init__ handles the problem with calling SessionSecureForm.__init__()
     outside of a flask request context.
     """
     # do not validate csrf if we are running tests
     self.no_csrf = 'TESTING' in app.config and app.config['TESTING'] is True
     
     csrf_context = {}
     # only access the session if we're in a request context
     if current_app:
         csrf_context = session
     
     SessionSecureForm.__init__(self, csrf_context=csrf_context, *args, **kwargs)
예제 #3
0
    def __init__(self, *args, **kwargs):
        """
        Initialize the things required by SessionSecureForm to do its duty
        This __init__ handles the problem with calling SessionSecureForm.__init__()
        outside of a flask request context.
        """
        self.SECRET_KEY = 'not really secret, this will only happen in a testing context'
        csrf_context = {}

        if app:
            # TODO: need to set csrf_context to something? (the flask session maybe?)
            self.SECRET_KEY = app.config['SECRET_KEY']

        SessionSecureForm.__init__(self,
                                   csrf_context=csrf_context,
                                   *args,
                                   **kwargs)
    def __init__(self, *args, **kwargs):
        """
        Initialize the things required by SessionSecureForm to do its duty
        This __init__ handles the problem with calling SessionSecureForm.__init__()
        outside of a flask request context.
        """
        # do not validate csrf if we are running tests
        self.no_csrf = 'TESTING' in app.config and app.config['TESTING'] is True

        csrf_context = {}
        # only access the session if we're in a request context
        if current_app:
            csrf_context = session

        SessionSecureForm.__init__(self,
                                   csrf_context=csrf_context,
                                   *args,
                                   **kwargs)