Example #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
Example #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
Example #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
Example #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,
            )
Example #6
0
 def __init__(self, data=None, new=False):
     ModificationTrackingDict.__init__(self, data or ())
     self.new = new
Example #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
Example #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
Example #9
0
 def __init__(self, data, sid, new=False):
     ModificationTrackingDict.__init__(self, data)
     self.sid = sid
     self.new = new
Example #10
0
 def __init__(self, data=None, new=False):
     ModificationTrackingDict.__init__(self, data or ())
     self.new = new
Example #11
0
 def __init__(self, data, sid, new=False):
     ModificationTrackingDict.__init__(self, data)
     self.sid = sid
     self.new = new
Example #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