Esempio n. 1
0
 def __init__(self, data=None, secret_key=None, algorithm='HS256'):
     ModificationTrackingDict.__init__(self, data or ())
     # explicitly convert it into a bytestring because python 2.6
     # no longer performs an implicit string conversion on hmac
     if secret_key is not None and not isinstance(secret_key, bytes):
         secret_key = bytes(secret_key, 'utf8')
     self.secret_key = secret_key
     self.algorithm = algorithm
Esempio n. 2
0
 def __init__(self, data=None, secret_key=None, new=True):
     ModificationTrackingDict.__init__(self, data or ())
     # explicitly convert it into a bytestring because python 2.6
     # no longer performs an implicit string conversion on hmac
     if secret_key is not None:
         secret_key = str(secret_key)
     self.secret_key = secret_key
     self.new = new
Esempio n. 3
0
 def __init__(self, data=None, secret_key=None, new=True):
     ModificationTrackingDict.__init__(self, data or ())
     # explicitly convert it into a bytestring because python 2.6
     # no longer performs an implicit string conversion on hmac
     if secret_key is not None:
         secret_key = str(secret_key)
     self.secret_key = secret_key
     self.new = new
Esempio n. 4
0
    def __init__(self, data=None, secret_key=None, new=True):
        ModificationTrackingDict.__init__(self, data or ())
        # explicitly convert it into a bytestring because python 2.6
        # no longer performs an implicit string conversion on hmac
        if secret_key is not None:
            secret_key = to_bytes(secret_key, 'utf-8')
        self.secret_key = secret_key
        self.new = new

        if self.serialization_method is pickle:
            warnings.warn(
                'The default SecureCookie.serialization_method will change from pickle'
                ' to json in 1.0. To upgrade existing tokens, override unquote to try'
                ' pickle if json fails.'
            )
    def __init__(self, data=None, secret_key=None, new=True):
        ModificationTrackingDict.__init__(self, data or ())
        # explicitly convert it into a bytestring because python 2.6
        # no longer performs an implicit string conversion on hmac
        if secret_key is not None:
            secret_key = to_bytes(secret_key, 'utf-8')
        self.secret_key = secret_key
        self.new = new

        if self.serialization_method is pickle:
            warnings.warn(
                "The default 'SecureCookie.serialization_method' will"
                " change from pickle to json in version 1.0. To upgrade"
                " existing tokens, override 'unquote' to try pickle if"
                " json fails.",
                stacklevel=2,
            )
Esempio n. 6
0
 def __init__(self, data=None, new=False):
     ModificationTrackingDict.__init__(self, data or ())
     self.new = new
Esempio n. 7
0
 def __init__(self, data=None, secret_key=None, new=True):
     ModificationTrackingDict.__init__(self, data or ())
     if secret_key is not None:
         secret_key = str(secret_key)
     self.secret_key = secret_key
     self.new = new
Esempio n. 8
0
 def __init__(self, data = None, secret_key = None, new = True):
     ModificationTrackingDict.__init__(self, data or ())
     if secret_key is not None:
         secret_key = str(secret_key)
     self.secret_key = secret_key
     self.new = new
Esempio n. 9
0
 def __init__(self, data, sid, new=False):
     ModificationTrackingDict.__init__(self, data)
     self.sid = sid
     self.new = new
Esempio n. 10
0
 def __init__(self, data=None, new=False):
     ModificationTrackingDict.__init__(self, data or ())
     self.new = new
Esempio n. 11
0
 def __init__(self, data, sid, new=False):
     ModificationTrackingDict.__init__(self, data)
     self.sid = sid
     self.new = new
Esempio n. 12
0
 def __init__(self, cookie):
     self.cookie = cookie
     self.entity = Session.get_by_sid(cookie['sid']) or \
         Session.create(cookie['sid'])
     ModificationTrackingDict.__init__(self, self.entity.data)
 def __init__(self, data=None, crypter_or_keys_location=None, new=True):
     ModificationTrackingDict.__init__(self, data or ())
     self.crypter = self._get_crypter(crypter_or_keys_location)
     self.new = new