1 import logging
, re
, datetime
, uuid
, hashlib
4 from pylons
import session
, app_globals
as g
6 class InvalidAccount(Exception): pass
10 def __init__(self
, acc
):
11 if acc
is None or len(acc
._id
) is 0 or len(acc
.idname
) is 0:
17 return str(self
.account
._id
)
20 return self
.account
.idname
23 return self
.account
.name
26 return self
.account
.idname
and '/user/' + self
.account
.idname
or ''
29 def get_current_user():
30 acc_id
= session
.get('account.id')
31 if acc_id
is not None and len(acc_id
):
32 acc
= g
.db
.col(Account
).find_one(_id
=acc_id
)
37 acc_id
= session
.get('account.id')
38 return acc_id
is not None and len(acc_id
) is not 0
40 def create_login_url(dest_url
):
41 #TODO: implement the redirection parameterization
45 def create_logout_url(dest_url
):