<s> from datetime import datetime <EOL> from hashlib import md5 <EOL> from airy . core . db import * <EOL> class PasswordResetToken ( Document ) : <EOL> expired = DateTimeField ( ) <EOL> token = StringField ( max_length = <NUM_LIT> ) <EOL> class User ( Document ) : <EOL> username = StringField ( max_length = <NUM_LIT:30> ) <EOL> password = StringField ( max_length = <NUM_LIT> ) <EOL> first_name = StringField ( max_length = <NUM_LIT:30> ) <EOL> last_name = StringField ( max_length = <NUM_LIT:30> ) <EOL> email = StringField ( max_length = <NUM_LIT:30> ) <EOL> last_login = DateTimeField ( default = datetime . now ) <EOL> date_joined = DateTimeField ( default = datetime . now ) <EOL> picture_url = StringField ( max_length = <NUM_LIT> , default = '<STR_LIT>' ) <EOL> picture_height = IntField ( default = <NUM_LIT:0> ) <EOL> picture_width = IntField ( default = <NUM_LIT:0> ) <EOL> headline = StringField ( max_length = <NUM_LIT> , default = '<STR_LIT>' ) <EOL> country = StringField ( max_length = <NUM_LIT> , required = False ) <EOL> state = StringField ( max_length = <NUM_LIT> , required = False ) <EOL> city = StringField ( max_length = <NUM_LIT> , required = False ) <EOL> bio = StringField ( default = '<STR_LIT>' ) <EOL> contact = StringField ( default = '<STR_LIT>' ) <EOL> other_sites = StringField ( default = '<STR_LIT>' ) <EOL> interests = ListField ( ReferenceField ( "<STR_LIT>" ) ) <EOL> recommended_books = ListField ( ReferenceField ( "<STR_LIT>" ) ) <EOL> password_reset_token_list = ListField ( ReferenceField ( PasswordResetToken ) ) <EOL> rating = IntField ( default = <NUM_LIT:0> ) <EOL> def __unicode__ ( self ) : <EOL> if self . first_name and self . last_name : <EOL> return u'<STR_LIT>' % ( self . first_name , self . last_name ) <EOL> return u'<STR_LIT:%s>' % self . username <EOL> def get_picture_url ( self ) : <EOL> if self . picture : <EOL> return self . picture . url <EOL> return getattr ( settings , '<STR_LIT>' , <EOL> '<STR_LIT>' ) <EOL> def check_password ( self , raw_password ) : <EOL> if self . password == md5 ( raw_password ) . hexdigest ( ) : <EOL> return True <EOL> return False <EOL> def set_password ( self , raw_password ) : <EOL> self . password = md5 ( raw_password ) . hexdigest ( ) <EOL> class Session ( Document ) : <EOL> user = ReferenceField ( User ) <EOL> session_key = StringField ( max_length = <NUM_LIT:64> ) <EOL> class Tag ( Document ) : <EOL> tag = StringField ( max_length = <NUM_LIT:64> ) <EOL> class Interest ( Tag ) : <EOL> pass <EOL> class Book ( Document ) : <EOL> text = StringField ( max_length = <NUM_LIT> ) <EOL> ref = URLField ( required = False ) </s>
