Esempio n. 1
0
    def __init__(
                    self,
                    states_history=True,
                    security_cookie_name='_nagare',
                    serializer=serializer.Dummy, pickler=None, unpickler=None
                ):
        """Initialization

        In:
          - ``states_history`` -- are all the states kept or only the latest?
          - ``security_cookie_name`` -- name of the cookie where the session secure id is stored
          - ``serializer`` -- serializer / deserializer of the states
          - ``pickler`` -- pickler used by the serializer
          - ``unpickler`` -- unpickler used by the serializer
        """
        self.states_history = states_history
        self.security_cookie_name = security_cookie_name
        self.serializer = serializer(pickler, unpickler)
Esempio n. 2
0
    def set_config(self, filename, conf, error):
        """Read the configuration parameters

        In:
          - ``filename`` -- the path to the configuration file
          - ``conf`` -- the ``ConfigObj`` object, created from the configuration file
          - ``error`` -- the function to call in case of configuration errors
        """
        conf = {k: v for k, v in conf.iteritems() if k in self.spec}
        conf = configobj.ConfigObj(conf, configspec=self.spec)
        config.validate(filename, conf, error)

        self.states_history = conf['states_history']
        self.security_cookie_name = conf['security_cookie_name']

        pickler = reference.load_object(conf['pickler'])[0]
        unpickler = reference.load_object(conf['unpickler'])[0]
        serializer = reference.load_object(conf['serializer'])[0]
        self.serializer = serializer(pickler, unpickler)

        return conf
Esempio n. 3
0
    def set_config(self, filename, conf, error):
        """Read the configuration parameters

        In:
          - ``filename`` -- the path to the configuration file
          - ``conf`` -- the ``ConfigObj`` object, created from the configuration file
          - ``error`` -- the function to call in case of configuration errors
        """
        conf = {k: v for k, v in conf.iteritems() if k in self.spec}
        conf = configobj.ConfigObj(conf, configspec=self.spec)
        config.validate(filename, conf, error)

        self.states_history = conf['states_history']
        self.security_cookie_name = conf['security_cookie_name']

        pickler = reference.load_object(conf['pickler'])[0]
        unpickler = reference.load_object(conf['unpickler'])[0]
        serializer = reference.load_object(conf['serializer'])[0]
        self.serializer = serializer(pickler, unpickler)

        return conf
Esempio n. 4
0
    def __init__(self,
                 states_history=True,
                 security_cookie_httponly=True,
                 security_cookie_name='_nagare',
                 security_cookie_secure=False,
                 serializer=serializer.Dummy,
                 pickler=None,
                 unpickler=None):
        """Initialization

        In:
          - ``states_history`` -- are all the states kept or only the latest?
          - ``security_cookie_name`` -- name of the cookie where the session secure id is stored
          - ``serializer`` -- serializer / deserializer of the states
          - ``pickler`` -- pickler used by the serializer
          - ``unpickler`` -- unpickler used by the serializer
        """
        self.states_history = states_history
        self.security_cookie_httponly = security_cookie_httponly
        self.security_cookie_name = security_cookie_name
        self.security_cookie_secure = security_cookie_secure
        self.serializer = serializer(pickler, unpickler)