Merge lp:~rajeevs1992/postorius/postorius into lp:postorius
Proposed by
Rajeev S
Status: | Needs review |
---|---|
Proposed branch: | lp:~rajeevs1992/postorius/postorius |
Merge into: | lp:postorius |
Diff against target: |
109 lines (+36/-22) 3 files modified
src/postorius/forms.py (+5/-0) src/postorius/templates/postorius/lists/mass_subscribe.html (+1/-1) src/postorius/views/list.py (+30/-21) |
To merge this branch: | bzr merge lp:~rajeevs1992/postorius/postorius |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Florian Fuchs | Pending | ||
Review via email: mp+207826@code.launchpad.net |
Description of the change
Added a file upload feature to add Mass subscriptions.Also changed email validator to django builtin validator.(DRY)
To post a comment you must log in.
Looks fine to me.
Sent from my BlackBerry 10 smartphone.
Original Message
From: Sumana Harihareswara
Sent: Saturday 10 January 2015 03:13
To: Rajeev S
Reply To: <email address hidden>
Subject: Re: [Merge] lp:~rajeevs1992/postorius/postorius into lp:postorius
Diff comments:
> === modified file 'src/postorius/ forms.py' forms.py 2013-10-22 18:52:15 +0000 forms.py 2014-02-23 14:49:03 +0000 forms.Textarea,
> --- src/postorius/
> +++ src/postorius/
> @@ -706,6 +706,11 @@
> widget=
> )
>
> + upload = forms.FileField(
> + label = ('Or Upload a file,with one email per line'),
I'm sorry that I don't have a more substantive comment on the code to offer, but I can suggest that the label be:
'Or upload a file, with one email address per line'
> + required = False, eld(required= False) templates/ postorius/ lists/mass_ subscribe. html' templates/ postorius/ lists/mass_ subscribe. html 2013-05-31 02:21:03 +0000 templates/ postorius/ lists/mass_ subscribe. html 2014-02-23 14:49:03 +0000 "multipart/ form-data" > {% csrf_token %} views/list. py' views/list. py 2013-10-22 20:01:21 +0000 views/list. py 2014-02-23 14:49:03 +0000 contrib. auth.decorators import (login_required, core.validators import validate_email core.exceptions import ValidationError core.urlresolve rs import reverse utils.decorator s import method_decorator utils.translati on import gettext as _ eView(MailingLi stView) : email(self, email): decorator( list_owner_ required) ption(request. POST) POST["emails" ].splitlines( ) FILES[" upload" ].readlines( ): append( i.strip( )) error(request, 'Please fill out the form correctly.') POST["emails" ].splitlines( )
> + )
> +
> verify_with_email = forms.BooleanFi
>
> class Meta:
>
> === modified file 'src/postorius/
> --- src/postorius/
> +++ src/postorius/
> @@ -6,7 +6,7 @@
> {% block main %}
> {% list_nav 'mass_subscribe' 'Mass Subscription' %}
>
> - <form action="{% url 'mass_subscribe' list.fqdn_listname %}" method="post" class="well"> {% csrf_token %}
> + <form action="{% url 'mass_subscribe' list.fqdn_listname %}" method="post" class="well" enctype=
> {{ form.as_p }}
> <button class="btn btn-primary" type="submit">{% trans "Subscribe users" %}</button>
> </form>
>
> === modified file 'src/postorius/
> --- src/postorius/
> +++ src/postorius/
> @@ -21,13 +21,15 @@
> from django.contrib import messages
> from django.
> user_passes_test)
> +from django.
> +from django.
> from django.
> from django.shortcuts import render_to_response, redirect
> from django.template import RequestContext
> from django.
> from django.
> from urllib2 import HTTPError
> -
> +import csv
> from postorius import utils
> from postorius.models import (Domain, List, MailmanUser,
> MailmanApiError)
> @@ -170,6 +172,12 @@
> class ListMassSubsrib
>
> """Mass subscription."""
> + def verify_
> + try:
> + validate_email( email )
> + return True
> + except ValidationError:
> + return False
>
> @method_
> def get(self, request, *args, **kwargs):
> @@ -180,27 +188,28 @@
>
> def post(self, request, *args, **kwargs):
> form = ListMassSubscri
> - if not form.is_valid():
> + emails = request.
> + if 'upload' in request.FILES:
> + for i in request.
> + emails.
> + if emails == []:
> messages.
> - else:
> - emails = request.
> ...