summaryrefslogtreecommitdiff
path: root/pypers/oxford/passwd.py
blob: c25a12947945e2032507a90920465d09e9c295e3 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
class User(object):
    def __init__(self, un, pw):
        self.un, self.pw = un, pw

from crypt import crypt

def cryptedAttribute(seed):
    def get(self):
        return getattr(self, "_pw", None)
    def set(self, value):
        self._pw = crypt(value, seed)
    return property(get, set)
    
class User(object):
    pw = cryptedAttribute("a")
    def __init__(self, un, pw):
        self.un, self.pw = un, pw

   
class SpecificUser(User):
    pw = cryptedAttribute("b")
    


u = User("michele", "secret")
print u.un, u.pw

su = SpecificUser("michele", "secret")
print su.un, su.pw

print su._pw