示例#1
0
    def test_constructor(self):
        hmac_hashfunc = lambda msg: hmac.new(b'mysecretkey', msg)

        password = Password(hashfunc=hmac_hashfunc)
        password.set('foo')
        self.assertEquals(password.str,
                          hmac.new(b'mysecretkey', b'foo').hexdigest())
示例#2
0
    def test_constructor(self):
        hmac_hashfunc = lambda msg: hmac.new(b'mysecretkey', msg)

        password = Password(hashfunc=hmac_hashfunc)
        password.set('foo')
        self.assertEquals(password.str,
                          hmac.new(b'mysecretkey', b'foo').hexdigest())
示例#3
0
    def test_constructor(self):
        from boto.utils import Password
        import hmac

        hmac_hashfunc = lambda msg: hmac.new('mysecretkey', msg )

        password = Password(hashfunc=hmac_hashfunc)
        password.set('foo')
        self.assertEquals(password.str, hmac.new('mysecretkey','foo').hexdigest())
示例#4
0
    def test_constructor(self):
        from boto.utils import Password
        import hmac

        hmac_hashfunc = lambda msg: hmac.new('mysecretkey', msg )

        password = Password(hashfunc=hmac_hashfunc)
        password.set('foo')
        self.assertEquals(password.str, hmac.new('mysecretkey', 'foo').hexdigest())
示例#5
0
 def __set__(self, obj, value):
     if not isinstance(value, Password):
         p = Password()
         p.set(value)
         value = p
     Property.__set__(self, obj, value)
示例#6
0
 def __get__(self, obj, objtype):
     return Password(StringProperty.__get__(self, obj, objtype))
示例#7
0
 def __set__(self, obj, value):
     if not isinstance(value, Password):
         p = Password()
         p.set(value)
         value = p
     Property.__set__(self, obj, value)
示例#8
0
 def make_value_from_datastore(self, value):
     p = Password(value)
     return p
示例#9
0
文件: property.py 项目: carlgao/lenga
 def __set__(self, obj, value):
     p = Password()
     p.set(value)
     ScalarProperty.__set__(self, obj, p)
示例#10
0
 def __set__(self, obj, value):
     p = Password()
     p.set(value)
     ScalarProperty.__set__(self, obj, p)
示例#11
0
 def __get__(self, obj, objtype):
     return Password(ScalarProperty.__get__(self, obj, objtype))
示例#12
0
 def decode_password(self, value):
     value = self.get_text_value(value)
     return Password(value)