~azzar1/unity/add-show-desktop-key

« back to all changes in this revision

Viewing changes to ivle/database.py

  • Committer: me at id
  • Date: 2009-01-15 01:18:00 UTC
  • mto: This revision was merged to the branch mainline in revision 1090.
  • Revision ID: svn-v3-trunk0:2b9c9e99-6f39-0410-b283-7f802c844ae2:branches%2Fstorm:1145
Give ivle.database.User {password,account}_expired attributes, and get
ivle.dispatch.login to use them.

Show diffs side-by-side

added added

removed removed

Lines of Context:
25
25
"""
26
26
 
27
27
import md5
 
28
import datetime
28
29
 
29
30
from storm.locals import create_database, Store, Int, Unicode, DateTime, \
30
31
                         Reference
109
110
        """
110
111
        return self.role.hasCap(capability)
111
112
 
112
 
    # XXX Should be @property
113
 
    def pass_expired(self):
114
 
        """Determines whether the pass_exp field indicates that
115
 
           login should be denied.
116
 
        """
 
113
    @property
 
114
    def password_expired(self):
117
115
        fieldval = self.pass_exp
118
 
        return fieldval is not None and time.localtime() > fieldval
119
 
    # XXX Should be @property
120
 
    def acct_expired(self):
121
 
        """Determines whether the acct_exp field indicates that
122
 
           login should be denied.
123
 
        """
 
116
        return fieldval is not None and datetime.datetime.now() > fieldval
 
117
 
 
118
    @property
 
119
    def account_expired(self):
124
120
        fieldval = self.acct_exp
125
 
        return fieldval is not None and time.localtime() > fieldval
 
121
        return fieldval is not None and datetime.datetime.now() > fieldval
126
122
 
127
123
    @staticmethod
128
124
    def hash_password(password):