Revision 3a9f4931 snf-astakos-app/astakos/im/api.py
b/snf-astakos-app/astakos/im/api.py | ||
---|---|---|
31 | 31 |
# interpreted as representing official policies, either expressed |
32 | 32 |
# or implied, of GRNET S.A. |
33 | 33 |
|
34 |
import logging |
|
35 |
|
|
34 | 36 |
from traceback import format_exc |
35 | 37 |
from time import time, mktime |
36 | 38 |
from urllib import quote |
... | ... | |
45 | 47 |
from astakos.im.models import AstakosUser |
46 | 48 |
from astakos.im.settings import CLOUD_SERVICES, INVITATIONS_ENABLED |
47 | 49 |
|
50 |
logger = logging.getLogger(__name__) |
|
51 |
|
|
48 | 52 |
def render_fault(request, fault): |
49 | 53 |
if isinstance(fault, InternalServerError) and settings.DEBUG: |
50 | 54 |
fault.details = format_exc(fault) |
... | ... | |
94 | 98 |
response['Content-Length'] = len(response.content) |
95 | 99 |
return response |
96 | 100 |
except BaseException, e: |
101 |
logger.exception(e) |
|
97 | 102 |
fault = InternalServerError('Unexpected error') |
98 | 103 |
return render_fault(request, fault) |
99 | 104 |
|
... | ... | |
119 | 124 |
index_url = absolute(reverse('astakos.im.views.index')) |
120 | 125 |
if urlparse(location).query.rfind('next=') == -1: |
121 | 126 |
index_url = '%s?next=%s' % (index_url, quote(location)) |
122 |
l = [{ 'url': index_url, 'name': "login..."}]
|
|
127 |
l = [{ 'url': index_url, 'name': "Sign in"}]
|
|
123 | 128 |
if request.user.is_authenticated(): |
124 | 129 |
l = [] |
125 | 130 |
l.append({ 'url': absolute(reverse('astakos.im.views.edit_profile')), |
126 | 131 |
'name': request.user.email}) |
127 | 132 |
l.append({ 'url': absolute(reverse('astakos.im.views.edit_profile')), |
128 |
'name': "view your profile..." })
|
|
133 |
'name': "View your profile" })
|
|
129 | 134 |
if request.user.password: |
130 | 135 |
l.append({ 'url': absolute(reverse('password_change')), |
131 |
'name': "change your password..." })
|
|
136 |
'name': "Change your password" })
|
|
132 | 137 |
if INVITATIONS_ENABLED: |
133 | 138 |
l.append({ 'url': absolute(reverse('astakos.im.views.invite')), |
134 |
'name': "invite some friends..." })
|
|
139 |
'name': "Invite some friends" })
|
|
135 | 140 |
l.append({ 'url': absolute(reverse('astakos.im.views.send_feedback')), |
136 |
'name': "feedback..." })
|
|
141 |
'name': "Send feedback" })
|
|
137 | 142 |
l.append({ 'url': absolute(reverse('astakos.im.views.logout')), |
138 |
'name': "logout..."})
|
|
143 |
'name': "Sign out"})
|
|
139 | 144 |
|
140 | 145 |
callback = request.GET.get('callback', None) |
141 | 146 |
data = json.dumps(tuple(l)) |
Also available in: Unified diff