Mercurial > p > roundup > code
comparison roundup/password.py @ 2098:18addf2a8596
Implemented proper datatypes in mysql and postgresql backends...
...(well, sqlite too, but that doesn't care).
Probably should use BOOLEAN instead of INTEGER for the Boolean props.
Need to fix a bizzaro MySQL error (gee, how unusual)
Need to finish MySQL migration from "version 1" database schemas.
| author | Richard Jones <richard@users.sourceforge.net> |
|---|---|
| date | Mon, 22 Mar 2004 07:45:40 +0000 |
| parents | fc52d57c6c3e |
| children | c9e52addda42 |
comparison
equal
deleted
inserted
replaced
| 2097:37ede7c5f5c5 | 2098:18addf2a8596 |
|---|---|
| 13 # BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS | 13 # BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS |
| 14 # FOR A PARTICULAR PURPOSE. THE CODE PROVIDED HEREUNDER IS ON AN "AS IS" | 14 # FOR A PARTICULAR PURPOSE. THE CODE PROVIDED HEREUNDER IS ON AN "AS IS" |
| 15 # BASIS, AND THERE IS NO OBLIGATION WHATSOEVER TO PROVIDE MAINTENANCE, | 15 # BASIS, AND THERE IS NO OBLIGATION WHATSOEVER TO PROVIDE MAINTENANCE, |
| 16 # SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. | 16 # SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. |
| 17 # | 17 # |
| 18 # $Id: password.py,v 1.11 2004-02-11 23:55:08 richard Exp $ | 18 # $Id: password.py,v 1.12 2004-03-22 07:45:39 richard Exp $ |
| 19 | 19 |
| 20 """Password handling (encoding, decoding). | 20 """Password handling (encoding, decoding). |
| 21 """ | 21 """ |
| 22 __docformat__ = 'restructuredtext' | 22 __docformat__ = 'restructuredtext' |
| 23 | 23 |
| 80 ''' | 80 ''' |
| 81 | 81 |
| 82 default_scheme = 'SHA' # new encryptions use this scheme | 82 default_scheme = 'SHA' # new encryptions use this scheme |
| 83 pwre = re.compile(r'{(\w+)}(.+)') | 83 pwre = re.compile(r'{(\w+)}(.+)') |
| 84 | 84 |
| 85 def __init__(self, plaintext=None, scheme=None): | 85 def __init__(self, plaintext=None, scheme=None, encrypted=None): |
| 86 '''Call setPassword if plaintext is not None.''' | 86 '''Call setPassword if plaintext is not None.''' |
| 87 if scheme is None: | 87 if scheme is None: |
| 88 scheme = self.default_scheme | 88 scheme = self.default_scheme |
| 89 if plaintext is not None: | 89 if plaintext is not None: |
| 90 self.password = encodePassword(plaintext, self.default_scheme) | 90 self.password = encodePassword(plaintext, self.default_scheme) |
| 91 self.scheme = self.default_scheme | 91 self.scheme = self.default_scheme |
| 92 elif encrypted is not None: | |
| 93 self.unpack(encrypted) | |
| 92 else: | 94 else: |
| 93 self.password = None | 95 self.password = None |
| 94 self.scheme = self.default_scheme | 96 self.scheme = self.default_scheme |
| 95 | 97 |
| 96 def unpack(self, encrypted): | 98 def unpack(self, encrypted): |
