Merge lp:~nigelbabu/summit/nuke-brainstorm into lp:summit

Proposed by Nigel Babu
Status: Merged
Approved by: Nigel Babu
Approved revision: 118
Merged at revision: 120
Proposed branch: lp:~nigelbabu/summit/nuke-brainstorm
Merge into: lp:summit
Diff against target: 566 lines (+0/-482)
12 files modified
summit/brainstorm/__init__.py (+0/-15)
summit/brainstorm/admin.py (+0/-81)
summit/brainstorm/fields.py (+0/-82)
summit/brainstorm/forms.py (+0/-27)
summit/brainstorm/models.py (+0/-33)
summit/brainstorm/templates/admin/brainstorm/idea/add_form.html (+0/-17)
summit/brainstorm/views.py (+0/-48)
summit/brainstorm/widgets.py (+0/-33)
summit/media/brainstorm/lookup.js (+0/-108)
summit/schedule/admin/meetingadmin.py (+0/-1)
summit/schedule/models/meetingmodel.py (+0/-2)
summit/sponsor/templates/sponsor/step1.old.html (+0/-35)
To merge this branch: bzr merge lp:~nigelbabu/summit/nuke-brainstorm
Reviewer Review Type Date Requested Status
Chris Johnston Approve
James Westby (community) Approve
Review via email: mp+62963@code.launchpad.net

Commit message

Removed the brainstorm code out of summit.

Description of the change

Removed the brainstorm code out of summit as discussed in bug #783291

To post a comment you must log in.
Revision history for this message
James Westby (james-w) wrote :

Hi,

547 + trackcolor = models.CharField(max_length=15)

I don't think we want that as part of this change, but otherwise
this looks good. Always nice to delete a lot of code :-)

Thanks,

James

review: Approve
lp:~nigelbabu/summit/nuke-brainstorm updated
118. By Nigel Babu

Removed code that was accidentally added.

Revision history for this message
Chris Johnston (cjohnston) wrote :

Looks good to me.

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== removed directory 'summit/brainstorm'
2=== removed file 'summit/brainstorm/__init__.py'
3--- summit/brainstorm/__init__.py 2010-03-05 10:33:36 +0000
4+++ summit/brainstorm/__init__.py 1970-01-01 00:00:00 +0000
5@@ -1,15 +0,0 @@
6-# Ubuntu Developer Summit web application
7-# Copyright (C) 2008, 2009, 2010 Canonical Ltd
8-#
9-# This program is free software: you can redistribute it and/or modify
10-# it under the terms of the GNU Affero General Public License as
11-# published by the Free Software Foundation, either version 3 of the
12-# License, or (at your option) any later version.
13-#
14-# This program is distributed in the hope that it will be useful,
15-# but WITHOUT ANY WARRANTY; without even the implied warranty of
16-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17-# GNU Affero General Public License for more details.
18-#
19-# You should have received a copy of the GNU Affero General Public License
20-# along with this program. If not, see <http://www.gnu.org/licenses/>.
21
22=== removed file 'summit/brainstorm/admin.py'
23--- summit/brainstorm/admin.py 2010-03-05 10:33:36 +0000
24+++ summit/brainstorm/admin.py 1970-01-01 00:00:00 +0000
25@@ -1,81 +0,0 @@
26-# Ubuntu Developer Summit web application
27-# Copyright (C) 2008, 2009, 2010 Canonical Ltd
28-#
29-# This program is free software: you can redistribute it and/or modify
30-# it under the terms of the GNU Affero General Public License as
31-# published by the Free Software Foundation, either version 3 of the
32-# License, or (at your option) any later version.
33-#
34-# This program is distributed in the hope that it will be useful,
35-# but WITHOUT ANY WARRANTY; without even the implied warranty of
36-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
37-# GNU Affero General Public License for more details.
38-#
39-# You should have received a copy of the GNU Affero General Public License
40-# along with this program. If not, see <http://www.gnu.org/licenses/>.
41-
42-from django.core.exceptions import PermissionDenied
43-from django.contrib import admin
44-from django.shortcuts import render_to_response
45-from django.template import RequestContext
46-from django.utils.encoding import force_unicode
47-from django.utils.safestring import mark_safe
48-from django.utils.translation import ugettext as _
49-
50-from summit.brainstorm.models import Idea
51-
52-from summit.brainstorm.forms import IdeaForm
53-
54-__all__ = (
55-)
56-
57-
58-class IdeaAdmin(admin.ModelAdmin):
59- list_display = ('url', 'title')
60- fieldsets = (
61- (None, {
62- 'fields': ('id', 'title', 'url'),
63- }),
64- )
65-
66- add_form = IdeaForm
67-
68- def add_view(self, request):
69- if not self.has_add_permission(request):
70- raise PermissionDenied
71-
72- new_idea = None
73- if request.method == 'POST':
74- form = self.add_form(request.POST)
75- if form.is_valid():
76- # We're using the wrong field, so this is wrong
77- new_idea = form.cleaned_data['idea']
78- self.log_addition(request, new_idea)
79-
80- return self.response_add(request, new_idea)
81- else:
82- form = self.add_form()
83-
84- context = {
85- 'title': _('Add %s') % force_unicode(self.model._meta.verbose_name),
86- 'form': form,
87- 'is_popup': '_popup' in request.REQUEST,
88- 'add': True,
89- 'change': False,
90- 'has_add_permission': self.has_add_permission(request),
91- 'has_delete_permission': self.has_delete_permission(request, new_idea),
92- 'has_change_permission': self.has_change_permission(request, new_idea),
93- 'has_file_field': False,
94- 'has_absolute_url': False,
95- 'opts': self.model._meta,
96- 'save_as': False,
97- 'root_path': self.admin_site.root_path,
98- 'show_delete': False,
99- 'media': mark_safe(self.media + form.media),
100- 'app_label': self.model._meta.app_label,
101- }
102- return render_to_response('admin/brainstorm/idea/add_form.html',
103- context,
104- context_instance=RequestContext(request))
105-
106-admin.site.register(Idea, IdeaAdmin)
107
108=== removed file 'summit/brainstorm/fields.py'
109--- summit/brainstorm/fields.py 2010-03-05 10:33:36 +0000
110+++ summit/brainstorm/fields.py 1970-01-01 00:00:00 +0000
111@@ -1,82 +0,0 @@
112-# Ubuntu Developer Summit web application
113-# Copyright (C) 2008, 2009, 2010 Canonical Ltd
114-#
115-# This program is free software: you can redistribute it and/or modify
116-# it under the terms of the GNU Affero General Public License as
117-# published by the Free Software Foundation, either version 3 of the
118-# License, or (at your option) any later version.
119-#
120-# This program is distributed in the hope that it will be useful,
121-# but WITHOUT ANY WARRANTY; without even the implied warranty of
122-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
123-# GNU Affero General Public License for more details.
124-#
125-# You should have received a copy of the GNU Affero General Public License
126-# along with this program. If not, see <http://www.gnu.org/licenses/>.
127-
128-import re
129-import urlparse
130-
131-from django import forms
132-from django.forms.util import ValidationError
133-from django.utils.translation import ugettext_lazy as _
134-
135-from summit.brainstorm.models import Idea
136-from summit.brainstorm.widgets import BrainstormURLWidget
137-
138-__all__ = (
139- 'BrainstormURLField',
140-)
141-
142-
143-class BrainstormURLField(forms.URLField):
144- # FIXME this is a little too magic
145- # we should have a field that simply validates a brainstorm url
146- # and a different field that validates an entire brainstorm idea ref
147-
148- default_error_messages = {
149- 'not_brainstorm': _(u'This URL does not appear to be for Brainstorm'),
150- }
151-
152- valid_schemes = ("http", "https")
153- valid_netlocs = ("brainstorm.ubuntu.com", )
154- path_re = re.compile(r'^/idea/(\d+)/')
155-
156- widget = BrainstormURLWidget
157-
158- def clean(self, value):
159- url = super(BrainstormURLField, self).clean(value)
160-
161- info = urlparse.urlsplit(url)
162- if info[0] not in self.valid_schemes:
163- raise ValidationError(self.error_messages['not_brainstorm'])
164- if info[1] not in self.valid_netlocs:
165- raise ValidationError(self.error_messages['not_brainstorm'])
166-
167- match = self.path_re.match(info[2])
168- if not match:
169- raise ValidationError(self.error_messages['not_brainstorm'])
170-
171- idea_id = match.group(1)
172-
173- try:
174- idea = Idea.objects.get(pk=idea_id)
175- except Idea.DoesNotExist:
176- import urllib2
177- from BeautifulSoup import BeautifulSoup
178- try:
179- u = urllib2.urlopen(url)
180- soup = BeautifulSoup(u)
181- except urllib2.HTTPError:
182- raise ValidationError(self.error_messages['not_brainstorm'])
183-
184- try:
185- title = soup('h1')[0].string
186- title.index("\nIdea\n")
187- title = title[title.index(":")+1:].strip()
188- except (IndexError, ValueError):
189- raise ValidationError(self.error_messages['not_brainstorm'])
190-
191- idea = Idea.objects.create(id=idea_id, url=url, title=title)
192-
193- return idea
194
195=== removed file 'summit/brainstorm/forms.py'
196--- summit/brainstorm/forms.py 2010-03-05 10:33:36 +0000
197+++ summit/brainstorm/forms.py 1970-01-01 00:00:00 +0000
198@@ -1,27 +0,0 @@
199-# Ubuntu Developer Summit web application
200-# Copyright (C) 2008, 2009, 2010 Canonical Ltd
201-#
202-# This program is free software: you can redistribute it and/or modify
203-# it under the terms of the GNU Affero General Public License as
204-# published by the Free Software Foundation, either version 3 of the
205-# License, or (at your option) any later version.
206-#
207-# This program is distributed in the hope that it will be useful,
208-# but WITHOUT ANY WARRANTY; without even the implied warranty of
209-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
210-# GNU Affero General Public License for more details.
211-#
212-# You should have received a copy of the GNU Affero General Public License
213-# along with this program. If not, see <http://www.gnu.org/licenses/>.
214-
215-from django import forms
216-
217-from summit.brainstorm.fields import BrainstormURLField
218-
219-__all__ = (
220- 'IdeaForm',
221-)
222-
223-
224-class IdeaForm(forms.Form):
225- idea = BrainstormURLField()
226
227=== removed file 'summit/brainstorm/models.py'
228--- summit/brainstorm/models.py 2010-03-05 10:33:36 +0000
229+++ summit/brainstorm/models.py 1970-01-01 00:00:00 +0000
230@@ -1,33 +0,0 @@
231-# Ubuntu Developer Summit web application
232-# Copyright (C) 2008, 2009, 2010 Canonical Ltd
233-#
234-# This program is free software: you can redistribute it and/or modify
235-# it under the terms of the GNU Affero General Public License as
236-# published by the Free Software Foundation, either version 3 of the
237-# License, or (at your option) any later version.
238-#
239-# This program is distributed in the hope that it will be useful,
240-# but WITHOUT ANY WARRANTY; without even the implied warranty of
241-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
242-# GNU Affero General Public License for more details.
243-#
244-# You should have received a copy of the GNU Affero General Public License
245-# along with this program. If not, see <http://www.gnu.org/licenses/>.
246-
247-from django.db import models
248-
249-__all__ = (
250- 'Idea',
251-)
252-
253-
254-class Idea(models.Model):
255- id = models.IntegerField(primary_key=True)
256- title = models.CharField(max_length=2047)
257- url = models.URLField()
258-
259- class Meta:
260- ordering = ('id', )
261-
262- def __unicode__(self):
263- return u'Idea #%d: %s' % (self.id, self.title)
264
265=== removed directory 'summit/brainstorm/templates'
266=== removed directory 'summit/brainstorm/templates/admin'
267=== removed directory 'summit/brainstorm/templates/admin/brainstorm'
268=== removed directory 'summit/brainstorm/templates/admin/brainstorm/idea'
269=== removed file 'summit/brainstorm/templates/admin/brainstorm/idea/add_form.html'
270--- summit/brainstorm/templates/admin/brainstorm/idea/add_form.html 2010-03-05 10:33:36 +0000
271+++ summit/brainstorm/templates/admin/brainstorm/idea/add_form.html 1970-01-01 00:00:00 +0000
272@@ -1,17 +0,0 @@
273-{% extends "admin/change_form.html" %}
274-{% load i18n %}
275-
276-{% block after_field_sets %}
277-
278-<p>Visit <a href="http://brainstorm.ubuntu.com/" target="_new">Ubuntu Brainstorm</a>
279-to find a relevant idea for this meeting. Copy the URL and paste into the
280-box below.</p>
281-
282-<table>
283-<tr>
284-<td><label for="id_idea" class="required">{% trans 'URL' %}:</label></td>
285-<td>{{ form.idea.errors }}{{ form.idea }}{{ form.idea.help_text }}</td>
286-</tr>
287-</table>
288-
289-{% endblock %}
290
291=== removed file 'summit/brainstorm/views.py'
292--- summit/brainstorm/views.py 2010-03-05 10:33:36 +0000
293+++ summit/brainstorm/views.py 1970-01-01 00:00:00 +0000
294@@ -1,48 +0,0 @@
295-# Ubuntu Developer Summit web application
296-# Copyright (C) 2008, 2009, 2010 Canonical Ltd
297-#
298-# This program is free software: you can redistribute it and/or modify
299-# it under the terms of the GNU Affero General Public License as
300-# published by the Free Software Foundation, either version 3 of the
301-# License, or (at your option) any later version.
302-#
303-# This program is distributed in the hope that it will be useful,
304-# but WITHOUT ANY WARRANTY; without even the implied warranty of
305-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
306-# GNU Affero General Public License for more details.
307-#
308-# You should have received a copy of the GNU Affero General Public License
309-# along with this program. If not, see <http://www.gnu.org/licenses/>.
310-
311-from django.http import HttpResponse, HttpResponseServerError
312-from django.utils.html import escape
313-
314-from summit.brainstorm.forms import IdeaForm
315-
316-__all__ = (
317- 'lookup',
318-)
319-
320-
321-def lookup(request):
322- if request.method == 'GET':
323- form = IdeaForm(request.GET)
324- if form.is_valid():
325- idea = form.cleaned_data['idea']
326-
327- xml = u"<idea>\n"
328- xml += u" <id>%s</id>\n" % escape(idea.id)
329- xml += u" <title>%s</title>\n" % escape(idea.title)
330- xml += u" <url>%s</url>\n" % escape(idea.url)
331- xml += u"</idea>\n"
332-
333- return HttpResponse(xml, mimetype='text/xml')
334- else:
335- xml = u"<errors>\n"
336- for error in form.errors['idea']:
337- xml += u" <error>%s</error>\n" % escape(unicode(error))
338- xml += u"</errors>\n"
339-
340- return HttpResponse(xml, mimetype='text/xml')
341- else:
342- return HttpResponseServerError('<h1>Wrong method</h1>')
343
344=== removed file 'summit/brainstorm/widgets.py'
345--- summit/brainstorm/widgets.py 2010-03-05 10:33:36 +0000
346+++ summit/brainstorm/widgets.py 1970-01-01 00:00:00 +0000
347@@ -1,33 +0,0 @@
348-# Ubuntu Developer Summit web application
349-# Copyright (C) 2008, 2009, 2010 Canonical Ltd
350-#
351-# This program is free software: you can redistribute it and/or modify
352-# it under the terms of the GNU Affero General Public License as
353-# published by the Free Software Foundation, either version 3 of the
354-# License, or (at your option) any later version.
355-#
356-# This program is distributed in the hope that it will be useful,
357-# but WITHOUT ANY WARRANTY; without even the implied warranty of
358-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
359-# GNU Affero General Public License for more details.
360-#
361-# You should have received a copy of the GNU Affero General Public License
362-# along with this program. If not, see <http://www.gnu.org/licenses/>.
363-
364-from django import forms
365-
366-__all__ = (
367- 'BrainstormURLWidget',
368-)
369-
370-
371-class BrainstormURLWidget(forms.TextInput):
372-
373- class Media:
374- js = ('ajax.js', 'brainstorm/lookup.js')
375-
376- def __init__(self, attrs={}):
377- new_attrs = attrs.copy()
378- new_attrs.update({'class': 'BrainstormURLField',
379- 'size': '30'})
380- super(BrainstormURLWidget, self).__init__(new_attrs)
381
382=== removed directory 'summit/media/brainstorm'
383=== removed file 'summit/media/brainstorm/lookup.js'
384--- summit/media/brainstorm/lookup.js 2010-03-05 10:33:36 +0000
385+++ summit/media/brainstorm/lookup.js 1970-01-01 00:00:00 +0000
386@@ -1,108 +0,0 @@
387-var Brainstorm = {
388- init: function() {
389- // Locate Brainstorm URL fields
390- var inputs = document.getElementsByTagName('INPUT');
391- for (var i = 0; i < inputs.length; i++) {
392- var input = inputs[i];
393-
394- if (input.getAttribute('type') == 'text'
395- && input.className.match(/BrainstormURLField/)) {
396- input.addEventListener('blur', Brainstorm.init, false);
397- input.addEventListener('change', Brainstorm.update, false);
398-
399- Brainstorm.lookup(input);
400- }
401- }
402- },
403-
404- update: function(ev) {
405- Brainstorm.lookup(this);
406- },
407-
408- lookup: function(tag) {
409- var url = tag.value;
410- if (url == null || url == '')
411- return;
412-
413- Ajax("GET", "/brainstorm?idea=" + escape(url), Brainstorm.gotIdea,
414- tag);
415- },
416-
417- cleanTag: function(tag) {
418- var td = Brainstorm.findTD(tag);
419-
420- // Get rid of any errors
421- var uls = td.getElementsByTagName('UL');
422- for (var i = 0; i < uls.length; i++) {
423- var ul = uls[i];
424-
425- if (ul.className.match(/errorlist/))
426- ul.parentNode.removeChild(ul);
427- }
428-
429- // Get rid of any info
430- var ps = td.getElementsByTagName('P');
431- for (var i = 0; i < ps.length; i++) {
432- var p = ps[i];
433-
434- if (p.className.match(/result/))
435- p.parentNode.removeChild(p);
436- }
437- },
438-
439- gotIdea: function(elem, tag) {
440- Brainstorm.cleanTag(tag);
441-
442- if (elem.tagName == 'idea') {
443- Brainstorm.updateInfo(tag, elem);
444- } else if (elem.tagName == 'errors') {
445- Brainstorm.updateErrors(tag, elem);
446- }
447- },
448-
449- findTD: function(tag) {
450- while (tag && tag.tagName != 'TD') {
451- tag = tag.parentNode;
452- }
453-
454- return tag
455- },
456-
457- updateInfo: function(tag, elem) {
458- var td = Brainstorm.findTD(tag);
459-
460- // Add result
461- var p = document.createElement('P');
462- p.className = 'result';
463-
464- var id = elem.getElementsByTagName('id')[0].textContent;
465- var title = elem.getElementsByTagName('title')[0].textContent;
466-
467- var text = document.createTextNode("Idea #" + id + ": " + title);
468- p.appendChild(text);
469-
470- td.insertBefore(p, tag);//.nextSibling);
471- },
472-
473- updateErrors: function(tag, elem) {
474- var td = Brainstorm.findTD(tag);
475-
476- // Add new errors
477- var ul = document.createElement('UL');
478- ul.className = 'errorlist';
479-
480- var errors = elem.getElementsByTagName('error');
481- for (var i = 0; i < errors.length; i++) {
482- var error = errors[i];
483-
484- var li = document.createElement('LI');
485- var text = document.createTextNode(error.textContent);
486- li.appendChild(text);
487- ul.appendChild(li);
488- }
489-
490- td.insertBefore(ul, tag);
491- },
492-};
493-
494-window.addEventListener('load', Brainstorm.init, false);
495
496=== modified file 'summit/schedule/admin/meetingadmin.py'
497--- summit/schedule/admin/meetingadmin.py 2011-05-09 17:09:28 +0000
498+++ summit/schedule/admin/meetingadmin.py 2011-06-10 04:54:42 +0000
499@@ -157,7 +157,6 @@
500 'type', 'tracks', 'topics'),
501 }),
502 ("References", {
503-# 'fields': ('spec_url', 'wiki_url', 'brainstorm'),
504 'fields': ('spec_url', 'wiki_url', 'pad_url'),
505 }),
506 ("Scheduling details", {
507
508=== modified file 'summit/schedule/models/meetingmodel.py'
509--- summit/schedule/models/meetingmodel.py 2011-05-22 19:14:22 +0000
510+++ summit/schedule/models/meetingmodel.py 2011-06-10 04:54:42 +0000
511@@ -24,7 +24,6 @@
512 from django.core.exceptions import ObjectDoesNotExist
513 from django.conf import settings
514 from django.core.urlresolvers import reverse
515-#from summit.brainstorm.models import Idea
516
517 from summit.schedule.fields import NameField
518
519@@ -90,7 +89,6 @@
520 verbose_name="Wiki URL")
521 pad_url = models.URLField(verify_exists=False,
522 verbose_name="Pad URL", null=True, blank=True)
523-# brainstorm = models.ManyToManyField(Idea, blank=True)
524 slots = models.IntegerField(default=1)
525 private = models.BooleanField(default=False)
526 # FIXME attendees must be for the same summit
527
528=== removed file 'summit/sponsor/templates/sponsor/step1.old.html'
529--- summit/sponsor/templates/sponsor/step1.old.html 2010-03-05 10:33:36 +0000
530+++ summit/sponsor/templates/sponsor/step1.old.html 1970-01-01 00:00:00 +0000
531@@ -1,35 +0,0 @@
532-{% extends "base.html" %}
533-
534-{% block head %}
535-{{ form.media }}
536-{% endblock %}
537-
538-{% block content %}
539-<h1>Request Sponsorship</h1>
540-<h2>Brainstorm discussions</h2>
541-<p>
542-UDS is all about discussing ideas and producing plans for developing them,
543-you should already have in mind some ideas that you want to discuss or even
544-lead the development of, and certainly some general topics that interest
545-you.
546-</p>
547-<ol>
548-<li>Visit <a href="http://brainstorm.ubuntu.com/" target="_new">Ubuntu Brainstorm</a>
549- to find the ideas that interest you.</li>
550-<li>Copy the idea URL from Brainstorm and paste into the <b>URL</b> box below.</li>
551-<li>Choose the closest matching conference <b>Topic</b> for the idea.</li>
552-<li>Indicate what your <b>Participation</b> will be, it's ok to say you're
553- not interested if you just want the idea discussed by others.</li>
554-<li>Repeat for as many ideas as you like (the form should grow automatically).</li>
555-</ol>
556-
557-<form method="post">
558-<table class="formset">
559-<tr><th>Brainstorm URL</th><th>Topic</th><th>Participation</th></tr>
560-{{ form }}
561-</table>
562-<input type="hidden" name="{{ step_field }}" value="{{ step0 }}" />
563-{{ previous_fields|safe }}
564-<input type="submit" value="Next"/>
565-</form>
566-{% endblock %}

Subscribers

People subscribed via source and target branches