Merge lp:~benste/mailmanweb/main_dev into lp:mailmanweb

Proposed by benste
Status: Needs review
Proposed branch: lp:~benste/mailmanweb/main_dev
Merge into: lp:mailmanweb
Diff against target: 437 lines (+85/-56) (has conflicts)
3 files modified
dev_setup/settings.py (+2/-0)
src/mailmanweb/templates/mailmanweb/base.html (+7/-0)
src/mailmanweb/views.py (+76/-56)
Text conflict in src/mailmanweb/views.py
To merge this branch: bzr merge lp:~benste/mailmanweb/main_dev
Reviewer Review Type Date Requested Status
Florian Fuchs Approve
Review via email: mp+97469@code.launchpad.net

Commit message

Merge - added Django Messaging Framework - fixes lp920084 - by benste

Description of the change

Dear Terri and Flo,
the long promissed change which got delayed due to my old revisions ...

No CSS for new class mm_message included
+ For some strange reason the message Tag / Type seems not to be stored hence we don't get a special class e.g. for a warningn

To post a comment you must log in.
lp:~benste/mailmanweb/main_dev updated
35. By benste

changed all render error, error and message vars in views.py to new messaging frame

Revision history for this message
Florian Fuchs (flo-fuchs) wrote :

Thank you! I had to add the request param to the messages.success call in line 134. Other than that everything's fine. Added to the trunk...

review: Approve

Unmerged revisions

35. By benste

changed all render error, error and message vars in views.py to new messaging frame

33. By Terri

Made it so that the settings menu doesn't disappear when you change settings.

32. By Terri

Assorted fixes to make sure the settings forms will submit correctly. This
should fix the enums and booleans, but does not fix acceptable_aliases (which
needs to submit a set of unicode strings)

31. By Terri

Fixes to the settings page, mostly making sure we use the right enums for
things.

30. By Terri

Removing settings templates that we've decided not to use

29. By Terri

Merged

28. By Terri

Regrouping of the list settings pages.

27. By Terri

Rearranging settings in a way that hopefully makes sense.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'dev_setup/settings.py'
--- dev_setup/settings.py 2012-03-13 03:58:06 +0000
+++ dev_setup/settings.py 2012-03-14 19:51:23 +0000
@@ -102,6 +102,7 @@
102102
103TEMPLATE_CONTEXT_PROCESSORS = (103TEMPLATE_CONTEXT_PROCESSORS = (
104 "django.contrib.auth.context_processors.auth",104 "django.contrib.auth.context_processors.auth",
105 "django.contrib.messages.context_processors.messages",
105 "django.core.context_processors.debug",106 "django.core.context_processors.debug",
106 "django.core.context_processors.i18n",107 "django.core.context_processors.i18n",
107 "django.core.context_processors.media",108 "django.core.context_processors.media",
@@ -138,6 +139,7 @@
138139
139INSTALLED_APPS = (140INSTALLED_APPS = (
140 'django.contrib.auth',141 'django.contrib.auth',
142 'django.contrib.messages',
141 'django.contrib.contenttypes',143 'django.contrib.contenttypes',
142 'django.contrib.sessions',144 'django.contrib.sessions',
143 'django.contrib.sites',145 'django.contrib.sites',
144146
=== modified file 'src/mailmanweb/templates/mailmanweb/base.html'
--- src/mailmanweb/templates/mailmanweb/base.html 2012-03-14 17:43:32 +0000
+++ src/mailmanweb/templates/mailmanweb/base.html 2012-03-14 19:51:23 +0000
@@ -50,6 +50,13 @@
50 </header>50 </header>
5151
52 <div class="mm_main mm_canvas">52 <div class="mm_main mm_canvas">
53 {% if messages %}
54 <ul class="mm_messages">
55 {% for message in messages %}
56 <li{% if message.tags %} class="{{ message.tags }}"{% endif %}>{{ message }}</li>
57 {% endfor %}
58 </ul>
59 {% endif %}
53 {% block main %}{% endblock main %}60 {% block main %}{% endblock main %}
54 </div>61 </div>
55 <div id="mm_footer">62 <div id="mm_footer">
5663
=== modified file 'src/mailmanweb/views.py'
--- src/mailmanweb/views.py 2012-03-14 17:45:34 +0000
+++ src/mailmanweb/views.py 2012-03-14 19:51:23 +0000
@@ -23,6 +23,7 @@
2323
2424
25from django.conf import settings25from django.conf import settings
26from django.contrib import messages
26from django.contrib.auth import logout, authenticate, login27from django.contrib.auth import logout, authenticate, login
27from django.contrib.auth.decorators import login_required, permission_required28from django.contrib.auth.decorators import login_required, permission_required
28from django.contrib.auth.forms import AuthenticationForm29from django.contrib.auth.forms import AuthenticationForm
@@ -53,15 +54,26 @@
53 try:54 try:
54 existing_domains = Domain.objects.all()55 existing_domains = Domain.objects.all()
55 logger.debug(Domain.objects)56 logger.debug(Domain.objects)
57<<<<<<< TREE
56 except MailmanApiError:58 except MailmanApiError:
57 return utils.render_api_error(request)59 return utils.render_api_error(request)
58 return render_to_response('mailmanweb/domain_index.html', {'domains':existing_domains,},60 return render_to_response('mailmanweb/domain_index.html', {'domains':existing_domains,},
61=======
62 except MailmanApiError, e:
63 messages.error(request,e)
64 return render_to_response('mailmanweb/errors/generic.html',context_instance=RequestContext(request))
65 return render_to_response(template, {'domains':existing_domains,},
66>>>>>>> MERGE-SOURCE
59 context_instance=RequestContext(request))67 context_instance=RequestContext(request))
6068
61@login_required69@login_required
62@permission_required('server_admin')70@permission_required('server_admin')
71<<<<<<< TREE
63def domain_new(request):72def domain_new(request):
64 message = None73 message = None
74=======
75def domain_new(request, template = 'mailmanweb/domain_new.html'):
76>>>>>>> MERGE-SOURCE
65 if request.method == 'POST':77 if request.method == 'POST':
66 form = DomainNew(request.POST)78 form = DomainNew(request.POST)
67 if form.is_valid():79 if form.is_valid():
@@ -70,15 +82,23 @@
70 description=form.cleaned_data['description'])82 description=form.cleaned_data['description'])
71 try:83 try:
72 domain.save()84 domain.save()
73 except MailmanApiError:85 except MailmanApiError, e:
74 return utils.render_api_error(request)86 messages.error(request,e)
87 return render_to_response('mailmanweb/errors/generic.html',context_instance=RequestContext(request))
75 except HTTPError, e:88 except HTTPError, e:
76 message=e89 messages.error(request,e)
90 else:
91 messages.success(request,_("New Domain registered"))
77 return redirect("domain_index")92 return redirect("domain_index")
78 else:93 else:
79 form = DomainNew()94 form = DomainNew()
95<<<<<<< TREE
80 return render_to_response('mailmanweb/domain_new.html',96 return render_to_response('mailmanweb/domain_new.html',
81 {'form': form,'message': message},97 {'form': form,'message': message},
98=======
99 return render_to_response(template,
100 {'form': form},
101>>>>>>> MERGE-SOURCE
82 context_instance=RequestContext(request))102 context_instance=RequestContext(request))
83103
84@login_required104@login_required
@@ -92,14 +112,13 @@
92 filled in before the last POST request is returned. The user must112 filled in before the last POST request is returned. The user must
93 be logged in to create a new list.113 be logged in to create a new list.
94 """114 """
95 error = None
96 message = None
97 mailing_list = None115 mailing_list = None
98 if request.method == 'POST':116 if request.method == 'POST':
99 try:117 try:
100 domains = Domain.objects.all()118 domains = Domain.objects.all()
101 except MailmanApiError:119 except MailmanApiError, e:
102 return utils.render_api_error(request)120 messages.error(request,e)
121 return render_to_response('mailmanweb/errors/generic.html',context_instance=RequestContext(request))
103 choosable_domains = [("",_("Choose a Domain"))]122 choosable_domains = [("",_("Choose a Domain"))]
104 for domain in domains:123 for domain in domains:
105 choosable_domains.append((domain.mail_host,124 choosable_domains.append((domain.mail_host,
@@ -118,29 +137,31 @@
118 #settings["???"] = form.cleaned_data['languages'] #TODO not found in REST:137 #settings["???"] = form.cleaned_data['languages'] #TODO not found in REST:
119 list_settings["advertised"] = form.cleaned_data['advertised']138 list_settings["advertised"] = form.cleaned_data['advertised']
120 list_settings.save()139 list_settings.save()
140 messages.success(_("List created"))
121 return redirect("list_summary",fqdn_listname=mailing_list.fqdn_listname)141 return redirect("list_summary",fqdn_listname=mailing_list.fqdn_listname)
122 #TODO catch correct Error class:142 #TODO catch correct Error class:
123 except HTTPError, e:143 except HTTPError, e:
124 return render_to_response('mailmanweb/errors/generic.html', 144 messages.error(request,e)
125 {'error':e},145 return render_to_response('mailmanweb/errors/generic.html',context_instance=RequestContext(request))
126 context_instance=RequestContext(request))146 else:
147 messages.success(_("New List created"))
127 else:148 else:
128 try:149 try:
129 domains = Domain.objects.all()150 domains = Domain.objects.all()
130 except MailmanApiError:151 except MailmanApiError, e:
131 return utils.render_api_error(request)152 messages.error(request,e)
153 return render_to_response('mailmanweb/errors/generic.html',context_instance=RequestContext(request))
132 choosable_domains = [("",_("Choose a Domain"))]154 choosable_domains = [("",_("Choose a Domain"))]
133 for domain in domains:155 for domain in domains:
134 choosable_domains.append((domain.mail_host,domain.mail_host))156 choosable_domains.append((domain.mail_host,domain.mail_host))
135 form = ListNew(choosable_domains,initial={'list_owner': request.user.username})157 form = ListNew(choosable_domains,initial={'list_owner': request.user.username})
136 return render_to_response(template, {'form': form, error:None},158 return render_to_response(template, {'form': form},
137 context_instance=RequestContext(request))159 context_instance=RequestContext(request))
138160
139def list_index(request, template = 'mailmanweb/lists/index.html'):161def list_index(request, template = 'mailmanweb/lists/index.html'):
140 """Show a table of all public mailing lists.162 """Show a table of all public mailing lists.
141 """163 """
142 lists = []164 lists = []
143 error = None
144 domain = None165 domain = None
145 only_public = True166 only_public = True
146 if request.user.is_authenticated():167 if request.user.is_authenticated():
@@ -148,13 +169,13 @@
148 try:169 try:
149 lists = List.objects.all(only_public=only_public)170 lists = List.objects.all(only_public=only_public)
150 except MailmanApiError:171 except MailmanApiError:
151 return utils.render_api_error(request)172 messages.error(request,e)
173 return render_to_response('mailmanweb/errors/generic.html',context_instance=RequestContext(request))
152 if request.method == 'POST':174 if request.method == 'POST':
153 return redirect("list_summary", fqdn_listname=request.POST["list"])175 return redirect("list_summary", fqdn_listname=request.POST["list"])
154 else:176 else:
155 return render_to_response(template,177 return render_to_response(template,
156 {'error': error,178 {'lists': lists,},
157 'lists': lists,},
158 context_instance=RequestContext(request))179 context_instance=RequestContext(request))
159180
160def list_metrics(request,fqdn_listname=None,option=None,template='mailmanweb/lists/metrics.html'):181def list_metrics(request,fqdn_listname=None,option=None,template='mailmanweb/lists/metrics.html'):
@@ -164,7 +185,6 @@
164 information about the list such as the date of the last post and the185 information about the list such as the date of the last post and the
165 time the last digest is sent.186 time the last digest is sent.
166 """187 """
167 error=None
168 user_is_subscribed = False188 user_is_subscribed = False
169 if request.method == 'POST':189 if request.method == 'POST':
170 return redirect("list_summary", fqdn_listname=request.POST["list"])190 return redirect("list_summary", fqdn_listname=request.POST["list"])
@@ -177,7 +197,8 @@
177 except:197 except:
178 pass #init198 pass #init
179 except MailmanApiError:199 except MailmanApiError:
180 return render_api_error(request)200 messages.error(request,e)
201 return render_to_response('mailmanweb/errors/generic.html',context_instance=RequestContext(request))
181 return render_to_response(template,202 return render_to_response(template,
182 {'list':the_list,203 {'list':the_list,
183 'message': None,204 'message': None,
@@ -193,7 +214,8 @@
193 try:214 try:
194 the_list = List.objects.get_or_404(fqdn_listname=fqdn_listname)215 the_list = List.objects.get_or_404(fqdn_listname=fqdn_listname)
195 except MailmanApiError:216 except MailmanApiError:
196 return utils.render_api_error(request)217 messages.error(request,e)
218 return render_to_response('mailmanweb/errors/generic.html',context_instance=RequestContext(request))
197 return render_to_response(template, 219 return render_to_response(template,
198 {'list': the_list,220 {'list': the_list,
199 'subscribe_form': ListSubscribe(),221 'subscribe_form': ListSubscribe(),
@@ -206,7 +228,8 @@
206 try:228 try:
207 the_list = List.objects.get_or_404(fqdn_listname=fqdn_listname)229 the_list = List.objects.get_or_404(fqdn_listname=fqdn_listname)
208 except MailmanApiError:230 except MailmanApiError:
209 return utils.render_api_error(request)231 messages.error(request,e)
232 return render_to_response('mailmanweb/errors/generic.html',context_instance=RequestContext(request))
210 if request.method == 'POST':233 if request.method == 'POST':
211 form = ListSubscribe(request.POST)234 form = ListSubscribe(request.POST)
212 else:235 else:
@@ -224,8 +247,6 @@
224 user to fill in which are evaluated in this function.247 user to fill in which are evaluated in this function.
225 """248 """
226 #create Values for Template usage 249 #create Values for Template usage
227 message = None
228 error = None
229 form_subscribe = None250 form_subscribe = None
230 form_unsubscribe = None251 form_unsubscribe = None
231 if request.POST.get('fqdn_listname', ''):252 if request.POST.get('fqdn_listname', ''):
@@ -233,9 +254,9 @@
233 # connect REST and catch issues getting the list254 # connect REST and catch issues getting the list
234 try:255 try:
235 the_list = List.objects.get_or_404(fqdn_listname=fqdn_listname)256 the_list = List.objects.get_or_404(fqdn_listname=fqdn_listname)
236 except AttributeError, e:257 except MailmanApiError, e:
258 messages.error(request,"REST API not found / Offline")
237 return render_to_response('mailmanweb/errors/generic.html', 259 return render_to_response('mailmanweb/errors/generic.html',
238 {'error': "REST API not found / Offline"},
239 context_instance=RequestContext(request))260 context_instance=RequestContext(request))
240 #process submitted form 261 #process submitted form
241 if request.method == 'POST':262 if request.method == 'POST':
@@ -254,8 +275,8 @@
254 'option':option,275 'option':option,
255 'message':_("Subscribed ")+ email },context_instance=RequestContext(request))276 'message':_("Subscribed ")+ email },context_instance=RequestContext(request))
256 except HTTPError, e:277 except HTTPError, e:
257 return render_to_response('mailmanweb/errors/generic.html', 278 messages.error(request,e)
258 {'error':e}, context_instance=RequestContext(request))279 return render_to_response('mailmanweb/errors/generic.html', context_instance=RequestContext(request))
259 else: #invalid subscribe form280 else: #invalid subscribe form
260 form_subscribe = form281 form_subscribe = form
261 form_unsubscribe = ListUnsubscribe(initial = {'fqdn_listname': fqdn_listname, 'name' : 'unsubscribe'}) 282 form_unsubscribe = ListUnsubscribe(initial = {'fqdn_listname': fqdn_listname, 'name' : 'unsubscribe'})
@@ -269,8 +290,8 @@
269 return render_to_response('mailmanweb/lists/summary.html', 290 return render_to_response('mailmanweb/lists/summary.html',
270 {'list': the_list, 'message':_("Unsubscribed ")+ email },context_instance=RequestContext(request))291 {'list': the_list, 'message':_("Unsubscribed ")+ email },context_instance=RequestContext(request))
271 except ValueError, e:292 except ValueError, e:
272 return render_to_response('mailmanweb/errors/generic.html', 293 messages.error(request,e)
273 {'error':e}, context_instance=RequestContext(request)) 294 return render_to_response('mailmanweb/errors/generic.html', context_instance=RequestContext(request))
274 else:#invalid unsubscribe form295 else:#invalid unsubscribe form
275 form_subscribe = ListSubscribe(initial = {'fqdn_listname': fqdn_listname,296 form_subscribe = ListSubscribe(initial = {'fqdn_listname': fqdn_listname,
276 'option':option,297 'option':option,
@@ -288,8 +309,6 @@
288 the_list = List.objects.get_or_404(fqdn_listname=fqdn_listname)#TODO309 the_list = List.objects.get_or_404(fqdn_listname=fqdn_listname)#TODO
289 return render_to_response(template, {'form_subscribe': form_subscribe,310 return render_to_response(template, {'form_subscribe': form_subscribe,
290 'form_unsubscribe': form_unsubscribe,311 'form_unsubscribe': form_unsubscribe,
291 'message':message,
292 'error':error,
293 'list': the_list,312 'list': the_list,
294 }313 }
295 ,context_instance=RequestContext(request))314 ,context_instance=RequestContext(request))
@@ -301,7 +320,8 @@
301 try:320 try:
302 the_list = List.objects.get_or_404(fqdn_listname=fqdn_listname)321 the_list = List.objects.get_or_404(fqdn_listname=fqdn_listname)
303 except MailmanApiError:322 except MailmanApiError:
304 return utils.render_api_error(request)323 messages.error(request,e)
324 return render_to_response('mailmanweb/errors/generic.html',context_instance=RequestContext(request))
305 if request.method == 'POST':325 if request.method == 'POST':
306 the_list.delete()326 the_list.delete()
307 # let the user return to the list index page327 # let the user return to the list index page
@@ -328,7 +348,6 @@
328 to show only parts of the settings348 to show only parts of the settings
329 <param> is optional / is used to differ in between section and option might result in using //option349 <param> is optional / is used to differ in between section and option might result in using //option
330 """350 """
331 message = ""
332 logger.debug(visible_section)351 logger.debug(visible_section)
333 if visible_section == None:352 if visible_section == None:
334 visible_section = 'List Identity'353 visible_section = 'List Identity'
@@ -336,14 +355,15 @@
336 try:355 try:
337 the_list = List.objects.get_or_404(fqdn_listname=fqdn_listname)356 the_list = List.objects.get_or_404(fqdn_listname=fqdn_listname)
338 except MailmanApiError:357 except MailmanApiError:
339 return utils.render_api_error(request)358 messages.error(request,e)
359 return render_to_response('mailmanweb/errors/generic.html',context_instance=RequestContext(request))
340 #collect all Form sections for the links:360 #collect all Form sections for the links:
341 temp = ListSettings('','')361 temp = ListSettings('','')
342 for section in temp.layout:362 for section in temp.layout:
343 try:363 try:
344 form_sections.append((section[0],temp.section_descriptions[section[0]]))364 form_sections.append((section[0],temp.section_descriptions[section[0]]))
345 except KeyError, e:365 except KeyError, e:
346 error=e366 messages.error(e)
347 del temp367 del temp
348 #Save a Form Processed by POST 368 #Save a Form Processed by POST
349 if request.method == 'POST':369 if request.method == 'POST':
@@ -354,9 +374,9 @@
354 for key in form.fields.keys():374 for key in form.fields.keys():
355 list_settings[key] = form.cleaned_data[key]375 list_settings[key] = form.cleaned_data[key]
356 list_settings.save() 376 list_settings.save()
357 message = _("The list has been updated.")377 messages.success(_("The list has been updated."))
358 else:378 else:
359 message = _("Validation Error - The list has not been updated.")379 messages.success(_("Validation Error - The list has not been updated."))
360 380
361 else:381 else:
362 #Provide a form with existing values382 #Provide a form with existing values
@@ -372,7 +392,6 @@
372 form.truncate()392 form.truncate()
373 return render_to_response(template, {'form': form,393 return render_to_response(template, {'form': form,
374 'form_sections': form_sections,394 'form_sections': form_sections,
375 'message': message,
376 'list': the_list,395 'list': the_list,
377 'visible_option':visible_option,396 'visible_option':visible_option,
378 'visible_section':visible_section,397 'visible_section':visible_section,
@@ -387,11 +406,11 @@
387 This functions is part of the settings for a list and requires the406 This functions is part of the settings for a list and requires the
388 user to be logged in to perform the action.407 user to be logged in to perform the action.
389 """408 """
390 message = ""
391 try:409 try:
392 the_list = List.objects.get_or_404(fqdn_listname=fqdn_listname)410 the_list = List.objects.get_or_404(fqdn_listname=fqdn_listname)
393 except MailmanApiError:411 except MailmanApiError:
394 return utils.render_api_error(request)412 messages.error(request,e)
413 return render_to_response('mailmanweb/errors/generic.html',context_instance=RequestContext(request))
395 if request.method == 'POST':414 if request.method == 'POST':
396 form = ListMassSubscription(request.POST)415 form = ListMassSubscription(request.POST)
397 if form.is_valid():416 if form.is_valid():
@@ -405,16 +424,15 @@
405 if len(parts) == 2 and '.' in parts[1]: #TODO - move check to clean method of the form - see example in django docs424 if len(parts) == 2 and '.' in parts[1]: #TODO - move check to clean method of the form - see example in django docs
406 try:425 try:
407 the_list.subscribe(address=email, real_name="")426 the_list.subscribe(address=email, real_name="")
408 message = "The mass subscription was successful."427 messages.success(_("The mass subscription was successful."))
409 except Exception, e: #TODO find right exception and catch only this one428 except Exception, e: #TODO find right exception and catch only this one
410 return render_to_response('mailmanweb/errors/generic.html', 429 messages.error(request,str(e))
411 {'error': str(e)})430 return render_to_response('mailmanweb/errors/generic.html', )
412
413 else:431 else:
414 # At least one email address wasn't valid so 432 # At least one email address wasn't valid so
415 # overwrite the success message and ask them to433 # overwrite the success message and ask them to
416 # try again.434 # try again.
417 message = "Please enter valid email addresses."435 messages.error(_("Please enter valid email addresses."))
418 except Exception, e:436 except Exception, e:
419 return HttpResponse(e)437 return HttpResponse(e)
420 else:438 else:
@@ -422,7 +440,6 @@
422 # mass subscribe users.440 # mass subscribe users.
423 form = ListMassSubscription()441 form = ListMassSubscription()
424 return render_to_response(template, {'form': form,442 return render_to_response(template, {'form': form,
425 'message': message,
426 'list': the_list}443 'list': the_list}
427 ,context_instance=RequestContext(request))444 ,context_instance=RequestContext(request))
428445
@@ -438,7 +455,6 @@
438 change to the correct calls here455 change to the correct calls here
439 """456 """
440 member = request.user.username457 member = request.user.username
441 message = ''
442 form = None458 form = None
443 the_list=None459 the_list=None
444 membership_lists = []460 membership_lists = []
@@ -450,8 +466,14 @@
450 the_list = List.objects.get(fqdn_listname=fqdn_listname)466 the_list = List.objects.get(fqdn_listname=fqdn_listname)
451 user_object = the_list.get_member(member)467 user_object = the_list.get_member(member)
452 else:468 else:
469<<<<<<< TREE
453 message = ("Using a workaround to replace missing Client functionality → LP:820827")470 message = ("Using a workaround to replace missing Client functionality → LP:820827")
454 for mlist in List.objects.all(): 471 for mlist in List.objects.all():
472=======
473 messages.debug("Using a workaround to replace missing Client functionality → LP:820827") #Todo - no translation neededf
474 #### BEGIN workaround
475 for mlist in Lists.objects.all():
476>>>>>>> MERGE-SOURCE
455 try: 477 try:
456 mlist.get_member(member)478 mlist.get_member(member)
457 membership_lists.append(mlist)479 membership_lists.append(mlist)
@@ -462,17 +484,16 @@
462 # tuples of length 2484 # tuples of length 2
463 raise Exception("WORK in PROGRRESS needs REST Auth Middleware! - TODO")485 raise Exception("WORK in PROGRRESS needs REST Auth Middleware! - TODO")
464 address_choices = [[addr, addr] for addr in user_object.address]486 address_choices = [[addr, addr] for addr in user_object.address]
465 except AttributeError, e:487 except MailmanApiError, e:
466 return render_to_response('mailmanweb/errors/generic.html', 488 messages.error(request,str(e)+"REST API not found / Offline")
467 {'error': str(e)+"REST API not found / Offline"},489 return render_to_response('mailmanweb/errors/generic.html',context_instance=RequestContext(request))
468 context_instance=RequestContext(request))
469 except ValueError, e:490 except ValueError, e:
491 messages.error(request,e)
470 return render_to_response('mailmanweb/errors/generic.html', 492 return render_to_response('mailmanweb/errors/generic.html',
471 {'error': e},
472 context_instance=RequestContext(request))493 context_instance=RequestContext(request))
473 except HTTPError,e :494 except HTTPError,e :
495 messages.error(request,_("List ")+fqdn_listname+_(" does not exist"))
474 return render_to_response('mailmanweb/errors/generic.html', 496 return render_to_response('mailmanweb/errors/generic.html',
475 {'error': _("List ")+fqdn_listname+_(" does not exist")},
476 context_instance=RequestContext(request))497 context_instance=RequestContext(request))
477 #-----------------------------------------------------------------498 #-----------------------------------------------------------------
478 if request.method == 'POST':499 if request.method == 'POST':
@@ -484,7 +505,7 @@
484 if form.is_valid():505 if form.is_valid():
485 member_object = c.get_member(member, request.GET["list"])506 member_object = c.get_member(member, request.GET["list"])
486 member_object.update(request.POST)507 member_object.update(request.POST)
487 message = "The membership settings have been updated."508 messages.success(_("The membership settings have been updated."))
488 else:509 else:
489 # the post request came from the user tab510 # the post request came from the user tab
490 # the 'address' field need choices as a tuple of length 2511 # the 'address' field need choices as a tuple of length 2
@@ -498,7 +519,7 @@
498 # not just the address_choices (add mock data to _User 519 # not just the address_choices (add mock data to _User
499 # class and make the call with 'user_object.info')520 # class and make the call with 'user_object.info')
500 form = UserSettings(address_choices)521 form = UserSettings(address_choices)
501 message = "The user settings have been updated."522 messages.success(_("The user settings have been updated."))
502523
503 else:524 else:
504 if tab == "membership" and fqdn_listname :525 if tab == "membership" and fqdn_listname :
@@ -533,7 +554,6 @@
533 'tab': tab,554 'tab': tab,
534 'list': the_list,555 'list': the_list,
535 'membership_lists': membership_lists,556 'membership_lists': membership_lists,
536 'message': message,
537 'member': member}557 'member': member}
538 ,context_instance=RequestContext(request))558 ,context_instance=RequestContext(request))
539559

Subscribers

People subscribed via source and target branches