Merge lp:~cjohnston/loco-team-portal/openid into lp:loco-team-portal

Proposed by Chris Johnston
Status: Merged
Approved by: Michael Hall
Approved revision: no longer in the source branch.
Merged at revision: 490
Proposed branch: lp:~cjohnston/loco-team-portal/openid
Merge into: lp:loco-team-portal
Diff against target: 248 lines (+92/-16)
5 files modified
loco_directory/common/views.py (+28/-2)
loco_directory/locale/loco-directory.pot (+11/-13)
loco_directory/settings.py (+3/-0)
loco_directory/templates/login_failure.html (+40/-0)
loco_directory/urls.py (+10/-1)
To merge this branch: bzr merge lp:~cjohnston/loco-team-portal/openid
Reviewer Review Type Date Requested Status
Michael Hall (community) Approve
Review via email: mp+78184@code.launchpad.net

Commit message

Updates LTP to work with new django-openid-auth

To post a comment you must log in.
486. By Alan Bell

[r=chrisjohnston] fixed bug in requirements of python-feedreader
added more useful back button to event and meeting
fixing extra cell in attendee table header

487. By Chris Johnston

[r=nigelbabu] Changes LoCo Directory to LoCo Team Portal

488. By Michael Hall

[r=chrisjohnston] Adds a wsgi file so we can stop using mod_python

489. By Chris Johnston

[r=chrisjohnston] Adds missing translation string.

Revision history for this message
Michael Hall (mhall119) wrote :

Needs the new login failure page from my branch

review: Needs Fixing
Revision history for this message
Michael Hall (mhall119) wrote :

Looks good

review: Approve
490. By Michael Hall

[r=mhall119] Updates LTP to work with new django-openid-auth

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'loco_directory/common/views.py'
2--- loco_directory/common/views.py 2011-06-01 22:19:20 +0000
3+++ loco_directory/common/views.py 2011-10-10 20:54:23 +0000
4@@ -1,11 +1,22 @@
5 # -*- coding: utf-8 -*-
6-from django.http import HttpResponseRedirect
7+from django.http import HttpResponse, HttpResponseRedirect
8 from django.shortcuts import render_to_response
9 from django.template import RequestContext
10+from django.template.loader import render_to_string
11 from django.contrib.auth import logout
12 from django.utils.translation import check_for_language
13 from django.conf import settings
14
15+try:
16+ from django_openid_auth.exceptions import (
17+ MissingPhysicalMultiFactor,
18+ MissingUsernameViolation,
19+ )
20+except ImportError:
21+ MissingPhysicalMultiFactor = None
22+ MissingUsernameViolation = None
23+
24+
25 def index(request):
26 from events.models import GlobalEvent, TeamEvent
27 from meetings.models import TeamMeeting
28@@ -132,5 +143,20 @@
29 meeting_list = meeting_list.filter(Q(name__icontains=q) | Q(teams__name__icontains=q) | Q(agenda__title__icontains=q)).distinct()
30 return meeting_list
31
32-
33+def login_failure(request, message, status=403,
34+ template_name='login_failure.html',
35+ exception=None):
36+ """Render an error page to the user."""
37+ context = {
38+ 'message': message,
39+ 'exception': exception,
40+ }
41+ if isinstance(exception, MissingPhysicalMultiFactor):
42+ context['solution'] = 'Try logging in again using your Yubikey'
43+ elif isinstance(exception, MissingUsernameViolation):
44+ context['solution'] = 'You will need to create a <a href="https://launchpad.net/people/+me">Launchpad profile</a> to use the LoCo Teams Directory'
45+
46+ data = render_to_string(template_name, context,
47+ context_instance=RequestContext(request))
48+ return HttpResponse(data, status=status)
49
50
51=== modified file 'loco_directory/locale/loco-directory.pot'
52--- loco_directory/locale/loco-directory.pot 2011-10-10 14:16:42 +0000
53+++ loco_directory/locale/loco-directory.pot 2011-10-10 20:54:23 +0000
54@@ -8,7 +8,7 @@
55 msgstr ""
56 "Project-Id-Version: PACKAGE VERSION\n"
57 "Report-Msgid-Bugs-To: \n"
58-"POT-Creation-Date: 2011-10-10 14:16+0000\n"
59+"POT-Creation-Date: 2011-10-05 00:49+0000\n"
60 "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
61 "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
62 "Language-Team: LANGUAGE <LL@li.org>\n"
63@@ -184,7 +184,7 @@
64 msgstr ""
65
66 #: events/models.py:229
67-#: templates/events/team_event_detail_attendees.inc.html:37
68+#: templates/events/team_event_detail_attendees.inc.html:35
69 msgid "Additional Guests"
70 msgstr ""
71
72@@ -942,10 +942,6 @@
73 msgid "Click on your continent to find teams near you."
74 msgstr ""
75
76-#: templates/index.html:60
77-msgid "Latest blog articles"
78-msgstr ""
79-
80 #: templates/index.html:79
81 msgid "Read More"
82 msgstr ""
83@@ -1140,6 +1136,7 @@
84
85 #: templates/events/event_history_list.html:7
86 #: templates/events/global_event_detail.html:24
87+#: templates/events/team_event_detail.html:7
88 msgid "Back to Events List"
89 msgstr ""
90
91@@ -1256,14 +1253,14 @@
92 msgstr ""
93
94 #: templates/events/global_event_detail.html:27
95-#: templates/events/team_event_detail.html:12
96+#: templates/events/team_event_detail.html:11
97 #: templates/meetings/team_meeting_detail.html:10
98 #: templates/teams/team_detail.html:9
99 msgid "Edit Details"
100 msgstr ""
101
102 #: templates/events/global_event_detail.html:28
103-#: templates/events/team_event_detail.html:13
104+#: templates/events/team_event_detail.html:12
105 msgid "Delete Event"
106 msgstr ""
107
108@@ -1391,16 +1388,16 @@
109 msgid "Delete"
110 msgstr ""
111
112-#: templates/events/team_event_detail.html:9
113+#: templates/events/team_event_detail.html:8
114 #: templates/events/team_event_detail_comments.inc.html:6
115 msgid "Add Comment"
116 msgstr ""
117
118-#: templates/events/team_event_detail.html:14
119+#: templates/events/team_event_detail.html:13
120 msgid "Copy Event"
121 msgstr ""
122
123-#: templates/events/team_event_detail.html:17
124+#: templates/events/team_event_detail.html:16
125 #: templates/meetings/team_meeting_detail.html:15
126 #: templates/teams/team_detail.html:160
127 msgid "iCal Feed"
128@@ -1417,7 +1414,7 @@
129 msgstr ""
130
131 #: templates/events/team_event_detail.inc.html:25
132-#: templates/events/team_event_detail_attendees.inc.html:35
133+#: templates/events/team_event_detail_attendees.inc.html:33
134 msgid "Attendees"
135 msgstr ""
136
137@@ -1438,7 +1435,7 @@
138 msgid "Maybe attending:"
139 msgstr ""
140
141-#: templates/events/team_event_detail_attendees.inc.html:36
142+#: templates/events/team_event_detail_attendees.inc.html:34
143 msgid "Registration Status"
144 msgstr ""
145
146@@ -1605,6 +1602,7 @@
147 msgstr ""
148
149 #: templates/meetings/meeting_history_list.html:7
150+#: templates/meetings/team_meeting_detail.html:7
151 msgid "Back to Meetings List"
152 msgstr ""
153
154
155=== modified file 'loco_directory/settings.py'
156--- loco_directory/settings.py 2011-10-05 00:50:53 +0000
157+++ loco_directory/settings.py 2011-10-10 20:54:23 +0000
158@@ -32,6 +32,9 @@
159 TEMPLATE_DEBUG = DEBUG
160 STATIC_SERVE = True
161
162+OPENID_STRICT_USERNAMES=True
163+OPENID_FOLLOW_RENAMES=True
164+
165 from common import utils
166 VERSION_STRING = utils.get_locodirectory_version(
167 os.path.join(PROJECT_PATH, "version"),
168
169=== added file 'loco_directory/templates/login_failure.html'
170--- loco_directory/templates/login_failure.html 1970-01-01 00:00:00 +0000
171+++ loco_directory/templates/login_failure.html 2011-10-10 20:54:23 +0000
172@@ -0,0 +1,40 @@
173+{% extends "base.html" %}
174+{% load i18n %}
175+
176+{% block title %} {% trans "Login Failure" %} | {% trans "Ubuntu LoCo Team Directory" %} {% endblock %}
177+
178+{% block defaulthead %}
179+{% with '/ubuntu-website/media/' as ubuntu_website_media %}
180+{{ block.super }}
181+{% endwith %}
182+{% endblock %}
183+
184+{% block extrahead %}
185+{% with '/media/' as MEDIA_URL %}
186+{{ block.super }}
187+{% endwith %}
188+{% endblock %}
189+{% block main_nav_links %}{% endblock %}
190+
191+{% block sub_nav %}{% endblock %}
192+
193+{% block content %}
194+
195+<article class="main-content">
196+ <h2>{{message|safe}}</h2>
197+
198+ {% if exception %}
199+ <p>{{exception.message|safe}}</p>
200+ {% endif %}
201+
202+ {% if solution %}
203+ <p>{{solution|safe}}</p>
204+ {% endif %}
205+
206+ <p>{% trans "If you continue to experience problems with LoCo Team Directory, please " %} <a href='https://bugs.launchpad.net/loco-directory'>{% trans "Report it!" %}</a>
207+ </p>
208+</article>
209+
210+{% endblock %}
211+
212+
213
214=== modified file 'loco_directory/urls.py'
215--- loco_directory/urls.py 2011-03-15 13:08:01 +0000
216+++ loco_directory/urls.py 2011-10-10 20:54:23 +0000
217@@ -3,6 +3,8 @@
218 from django.contrib import admin
219 import ubuntu_website
220
221+from common.views import login_failure
222+
223 admin.autodiscover()
224
225 urlpatterns = patterns('',
226@@ -12,7 +14,6 @@
227 url(r'^irc/$', 'common.views.irc_chat', name='irc_chat'),
228 url(r'^about-loco/$', 'common.views.about_loco', name='about_loco'),
229 url(r'^using-locodir/$', 'common.views.using_locodir', name='using_locodir'),
230- url(r'^openid/', include('django_openid_auth.urls')),
231 url(r'^admin/(.*)', admin.site.root),
232 url(r'^data/xml', 'teams.views.xml_team_data', name='xml_team_data'),
233 url(r'^teams/', include('teams.urls')),
234@@ -27,6 +28,14 @@
235 url(r'^search/', 'common.views.site_search', name='site_search'),
236 )
237
238+urlpatterns += patterns('django_openid_auth.views',
239+ url(r'^openid/login/$', 'login_begin', name='openid-login',
240+ kwargs={'render_failure': login_failure}),
241+ url(r'^openid/complete/$', 'login_complete', name='openid-complete',
242+ kwargs={'render_failure': login_failure}),
243+ url(r'^openid/logo.gif$', 'logo', name='openid-logo'),
244+)
245+
246 if settings.STATIC_SERVE:
247 urlpatterns += patterns('',
248 (r'^media/(?P<path>.*)$', 'django.views.static.serve',

Subscribers

People subscribed via source and target branches