Revision f627a979 snf-astakos-app/astakos/im/util.py
b/snf-astakos-app/astakos/im/util.py | ||
---|---|---|
105 | 105 |
or user has not a valid token. |
106 | 106 |
""" |
107 | 107 |
renew = renew or (not user.auth_token) |
108 |
renew = renew or (user.auth_token_expires and user.auth_token_expires < datetime.datetime.now())
|
|
108 |
renew = renew or (user.auth_token_expires < datetime.datetime.now()) |
|
109 | 109 |
if renew: |
110 | 110 |
user.renew_token() |
111 | 111 |
try: |
... | ... | |
138 | 138 |
expire_fmt = user.auth_token_expires.strftime('%a, %d-%b-%Y %H:%M:%S %Z') |
139 | 139 |
cookie_value = quote(user.email + '|' + user.auth_token) |
140 | 140 |
response.set_cookie(COOKIE_NAME, value=cookie_value, |
141 |
expires=expire_fmt, path='/', |
|
142 |
domain=COOKIE_DOMAIN, secure=COOKIE_SECURE) |
|
143 |
msg = 'Cookie [expiring %s] set for %s' % (user.auth_token_expires, user.email) |
|
141 |
expires=expire_fmt, path='/', |
|
142 |
domain=COOKIE_DOMAIN, secure=COOKIE_SECURE |
|
143 |
) |
|
144 |
msg = 'Cookie [expiring %s] set for %s' % ( |
|
145 |
user.auth_token_expires, |
|
146 |
user.email |
|
147 |
) |
|
144 | 148 |
logger.log(LOGGING_LEVEL, msg) |
145 | 149 |
|
146 | 150 |
class lazy_string(object): |
... | ... | |
161 | 165 |
return AstakosUser.objects.filter(email = email).count() != 0 |
162 | 166 |
|
163 | 167 |
def get_query(request): |
164 |
return request.__getattribute__(request.method) |
|
168 |
try: |
|
169 |
return request.__getattribute__(request.method) |
|
170 |
except AttributeError: |
|
171 |
return request.GET |
Also available in: Unified diff