Merge lp:~cjohnston/summit/csrf into lp:summit

Proposed by Chris Johnston
Status: Merged
Approved by: Michael Hall
Approved revision: 502
Merged at revision: 503
Proposed branch: lp:~cjohnston/summit/csrf
Merge into: lp:summit
Diff against target: 136 lines (+12/-8)
10 files modified
summit/schedule/templates/schedule/attend.html (+1/-1)
summit/schedule/templates/schedule/create_meeting.html (+1/-1)
summit/schedule/templates/schedule/edit_hangout.html (+1/-1)
summit/schedule/templates/schedule/edit_meeting.html (+1/-1)
summit/schedule/templates/schedule/meeting_review.html (+1/-1)
summit/schedule/templates/schedule/org_attend.html (+1/-1)
summit/schedule/templates/schedule/org_edit_meeting.html (+1/-1)
summit/schedule/templates/schedule/propose_meeting.html (+1/-1)
summit/schedule/views.py (+3/-0)
summit/settings.py (+1/-0)
To merge this branch: bzr merge lp:~cjohnston/summit/csrf
Reviewer Review Type Date Requested Status
Michael Hall (community) Approve
Review via email: mp+152298@code.launchpad.net

Commit message

Adds csrf tokens to the schedule app in an attempt to prepare for 1.4

To post a comment you must log in.
Revision history for this message
Michael Hall (mhall119) wrote :
Download full text (5.4 KiB)

======================================================================
ERROR: test_cache_cleared_on_agenda_change (summit.schedule.tests.schedule_cache.ScheduleCacheTestCase)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/home/mhall/projects/Ubuntu/summit/current_work/summit/../summit/schedule/tests/schedule_cache.py", line 154, in test_cache_cleared_on_agenda_change
    ''
TypeError: argument of type 'NoneType' is not iterable

======================================================================
ERROR: test_cache_cleared_on_meeting_change (summit.schedule.tests.schedule_cache.ScheduleCacheTestCase)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/home/mhall/projects/Ubuntu/summit/current_work/summit/../summit/schedule/tests/schedule_cache.py", line 133, in test_cache_cleared_on_meeting_change
    ''
TypeError: argument of type 'NoneType' is not iterable

======================================================================
FAIL: test_percent_in_meeting_name (summit.schedule.tests.render_schedule.RenderScheduleTestCase)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/home/mhall/projects/Ubuntu/summit/current_work/summit/../summit/schedule/tests/render_schedule.py", line 120, in test_percent_in_meeting_name
    self.assertContains(response, 'test%meeting', 1)
  File "/home/mhall/projects/Ubuntu/summit/current_work/env/local/lib/python2.7/site-packages/django/test/testcases.py", line 427, in assertContains
    " (expected %d)" % (real_count, text, count))
AssertionError: Found 0 instances of 'test%meeting' in response (expected 1)

======================================================================
FAIL: test_percent_in_meeting_title (summit.schedule.tests.render_schedule.RenderScheduleTestCase)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/home/mhall/projects/Ubuntu/summit/current_work/summit/../summit/schedule/tests/render_schedule.py", line 128, in test_percent_in_meeting_title
    self.assertContains(response, 'test % meeting', 1)
  File "/home/mhall/projects/Ubuntu/summit/current_work/env/local/lib/python2.7/site-packages/django/test/testcases.py", line 427, in assertContains
    " (expected %d)" % (real_count, text, count))
AssertionError: Found 0 instances of 'test % meeting' in response (expected 1)

======================================================================
FAIL: test_percent_in_meeting_track_slug (summit.schedule.tests.render_schedule.RenderScheduleTestCase)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/home/mhall/projects/Ubuntu/summit/current_work/summit/../summit/schedule/tests/render_schedule.py", line 159, in test_percent_in_meeting_track_slug
    self.assertContains(response, 'test%track', 1)
  File "/home/mhall/projects/Ubuntu/summit/current_work/env/local/lib/python2.7/site-packages/django/test/testcases.py", line 427, in assertContains
    " (expected %d)" % (real_count, text...

Read more...

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

Fixed my local environment, everything passes now, looks good

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'summit/schedule/templates/schedule/attend.html'
2--- summit/schedule/templates/schedule/attend.html 2013-03-05 00:53:54 +0000
3+++ summit/schedule/templates/schedule/attend.html 2013-03-07 22:37:27 +0000
4@@ -26,7 +26,7 @@
5 </p>
6 {% endif %}
7
8- <form action="{{ request.path_info }}" method="POST">
9+ <form action="{{ request.path_info }}" method="POST">{% csrf_token %}
10 <fieldset>
11 <h3>Attend "{{ meeting.title }}"</h3>
12 {{ form.as_template }}
13
14=== modified file 'summit/schedule/templates/schedule/create_meeting.html'
15--- summit/schedule/templates/schedule/create_meeting.html 2012-08-13 21:09:00 +0000
16+++ summit/schedule/templates/schedule/create_meeting.html 2013-03-07 22:37:27 +0000
17@@ -33,7 +33,7 @@
18 </p>
19 {% endif %}
20
21- <form action="{{ request.path_info }}" method="POST">
22+ <form action="{{ request.path_info }}" method="POST">{% csrf_token %}
23 <fieldset>
24 <h3>Create a Meeting</h3>
25 {{ form.as_template }}
26
27=== modified file 'summit/schedule/templates/schedule/edit_hangout.html'
28--- summit/schedule/templates/schedule/edit_hangout.html 2013-03-01 19:51:16 +0000
29+++ summit/schedule/templates/schedule/edit_hangout.html 2013-03-07 22:37:27 +0000
30@@ -33,7 +33,7 @@
31 </p>
32 {% endif %}
33
34- <form action="{{ request.path_info }}" method="POST">
35+ <form action="{{ request.path_info }}" method="POST">{% csrf_token %}
36 <fieldset>
37 <h3>{{form.instance.title}}</h3>
38 {{ form.as_template }}
39
40=== modified file 'summit/schedule/templates/schedule/edit_meeting.html'
41--- summit/schedule/templates/schedule/edit_meeting.html 2012-08-13 21:09:00 +0000
42+++ summit/schedule/templates/schedule/edit_meeting.html 2013-03-07 22:37:27 +0000
43@@ -33,7 +33,7 @@
44 </p>
45 {% endif %}
46
47- <form action="{{ request.path_info }}" method="POST">
48+ <form action="{{ request.path_info }}" method="POST">{% csrf_token %}
49 <fieldset>
50 <h3>Edit Meeting</h3>
51 {{ form.as_template }}
52
53=== modified file 'summit/schedule/templates/schedule/meeting_review.html'
54--- summit/schedule/templates/schedule/meeting_review.html 2012-08-13 21:09:00 +0000
55+++ summit/schedule/templates/schedule/meeting_review.html 2013-03-07 22:37:27 +0000
56@@ -26,7 +26,7 @@
57 </p>
58 {% endif %}
59
60- <form action="{{ request.path_info }}" method="POST">
61+ <form action="{{ request.path_info }}" method="POST">{% csrf_token %}
62 <fieldset>
63 <h3>Review Meeting</h3>
64 {{ form.as_template }}
65
66=== modified file 'summit/schedule/templates/schedule/org_attend.html'
67--- summit/schedule/templates/schedule/org_attend.html 2012-08-13 21:09:00 +0000
68+++ summit/schedule/templates/schedule/org_attend.html 2013-03-07 22:37:27 +0000
69@@ -26,7 +26,7 @@
70 </p>
71 {% endif %}
72
73- <form action="{{ request.path_info }}" method="POST">
74+ <form action="{{ request.path_info }}" method="POST">{% csrf_token %}
75 <fieldset>
76 <h3>Change {{ attendee.name }}'s attendance to "{{ meeting.title }}"</h3>
77 {{ form.as_template }}
78
79=== modified file 'summit/schedule/templates/schedule/org_edit_meeting.html'
80--- summit/schedule/templates/schedule/org_edit_meeting.html 2012-08-13 21:09:00 +0000
81+++ summit/schedule/templates/schedule/org_edit_meeting.html 2013-03-07 22:37:27 +0000
82@@ -33,7 +33,7 @@
83 </p>
84 {% endif %}
85
86- <form action="{{ request.path_info }}" method="POST">
87+ <form action="{{ request.path_info }}" method="POST">{% csrf_token %}
88 <fieldset>
89 <h3>Edit Meeting</h3>
90 {{ form.as_template }}
91
92=== modified file 'summit/schedule/templates/schedule/propose_meeting.html'
93--- summit/schedule/templates/schedule/propose_meeting.html 2012-08-13 21:09:00 +0000
94+++ summit/schedule/templates/schedule/propose_meeting.html 2013-03-07 22:37:27 +0000
95@@ -33,7 +33,7 @@
96 </p>
97 {% endif %}
98
99- <form action="{{ request.path_info }}" method="POST">
100+ <form action="{{ request.path_info }}" method="POST">{% csrf_token %}
101 <fieldset>
102 <h3>Propose a Meeting</h3>
103 {{ form.as_template }}
104
105=== modified file 'summit/schedule/views.py'
106--- summit/schedule/views.py 2013-03-04 17:47:31 +0000
107+++ summit/schedule/views.py 2013-03-07 22:37:27 +0000
108@@ -23,6 +23,8 @@
109 from django.template import RequestContext
110 from django.core.urlresolvers import reverse
111 from django.utils.datastructures import SortedDict
112+from django.views.decorators.csrf import csrf_exempt
113+from django.views.decorators.csrf import csrf_protect
114
115 from summit.schedule.decorators import (
116 summit_required,
117@@ -165,6 +167,7 @@
118 pass
119
120
121+@csrf_exempt
122 @summit_required
123 def by_date(request, summit, attendee, date):
124 return _process_date_view(request, summit, attendee, date)
125
126=== modified file 'summit/settings.py'
127--- summit/settings.py 2013-03-01 22:14:29 +0000
128+++ summit/settings.py 2013-03-07 22:37:27 +0000
129@@ -104,6 +104,7 @@
130 )
131
132 MIDDLEWARE_CLASSES = (
133+ 'django.middleware.csrf.CsrfViewMiddleware',
134 'django.middleware.common.CommonMiddleware',
135 'django.middleware.locale.LocaleMiddleware',
136 'django.contrib.sessions.middleware.SessionMiddleware',

Subscribers

People subscribed via source and target branches