Revision 18ffbee1 snf-astakos-app/astakos/im/util.py
b/snf-astakos-app/astakos/im/util.py | ||
---|---|---|
33 | 33 |
|
34 | 34 |
import logging |
35 | 35 |
import datetime |
36 |
import time |
|
36 | 37 |
|
37 | 38 |
from urllib import quote |
38 | 39 |
from urlparse import urlsplit, urlunsplit |
... | ... | |
66 | 67 |
|
67 | 68 |
return d.replace(tzinfo=UTC()).isoformat() |
68 | 69 |
|
70 |
def epoch(datetime): |
|
71 |
return int(time.mktime(datetime.timetuple())*1000) |
|
72 |
|
|
69 | 73 |
def get_or_create_user(email, realname='', first_name='', last_name='', affiliation='', level=0, provider='local', password=''): |
70 | 74 |
"""Find or register a user into the internal database |
71 | 75 |
and issue a token for subsequent requests. |
... | ... | |
103 | 107 |
code = request.GET.get('code') |
104 | 108 |
if request.method == 'POST': |
105 | 109 |
code = request.POST.get('code') |
106 |
if not code: |
|
107 |
if 'invitation_code' in request.session: |
|
108 |
code = request.session.pop('invitation_code') |
|
110 |
#if not code:
|
|
111 |
# if 'invitation_code' in request.session:
|
|
112 |
# code = request.session.pop('invitation_code')
|
|
109 | 113 |
if not code: |
110 | 114 |
return |
111 | 115 |
invitation = Invitation.objects.get(code = code) |
116 |
print '>>>', invitation |
|
112 | 117 |
if invitation.is_consumed: |
113 | 118 |
raise ValueError(_('Invitation is used')) |
114 | 119 |
try: |
Also available in: Unified diff