Exemple #1
0
def motd(request):
    message = unmemoized_get_config("mkt_developers_motd")
    form = MOTDForm(request.POST or None, initial={"motd": message})
    if request.method == "POST" and form and form.is_valid():
        set_config("mkt_developers_motd", form.cleaned_data["motd"])
        messages.success(request, _("Changes successfully saved."))
        return redirect(reverse("mkt.developers.motd"))
    return render(request, "developers/motd.html", {"form": form})
Exemple #2
0
def motd(request):
    message = unmemoized_get_config('mkt_developers_motd')
    form = MOTDForm(request.POST or None, initial={'motd': message})
    if request.method == 'POST' and form and form.is_valid():
        set_config('mkt_developers_motd', form.cleaned_data['motd'])
        messages.success(request, _('Changes successfully saved.'))
        return redirect(reverse('mkt.developers.motd'))
    return render(request, 'developers/motd.html', {'form': form})
Exemple #3
0
def motd(request):
    message = unmemoized_get_config('mkt_developers_motd')
    form = MOTDForm(request.POST or None, initial={'motd': message})
    if request.method == 'POST' and form and form.is_valid():
        set_config('mkt_developers_motd', form.cleaned_data['motd'])
        messages.success(request, _('Changes successfully saved.'))
        return redirect(reverse('mkt.developers.motd'))
    return render(request, 'developers/motd.html', {'form': form})
Exemple #4
0
def motd(request):
    form = None
    motd = unmemoized_get_config('mkt_reviewers_motd')
    if acl.action_allowed(request, 'AppReviewerMOTD', 'Edit'):
        form = MOTDForm(request.POST or None, initial={'motd': motd})
    if form and request.method == 'POST' and form.is_valid():
        set_config(u'mkt_reviewers_motd', form.cleaned_data['motd'])
        messages.success(request, _('Changes successfully saved.'))
        return redirect(reverse('reviewers.apps.motd'))
    data = context(request, form=form)
    return render(request, 'reviewers/motd.html', data)
Exemple #5
0
def motd(request):
    form = None
    motd = unmemoized_get_config('mkt_reviewers_motd')
    if acl.action_allowed(request, 'AppReviewerMOTD', 'Edit'):
        form = MOTDForm(request.POST or None, initial={'motd': motd})
    if form and request.method == 'POST' and form.is_valid():
        set_config(u'mkt_reviewers_motd', form.cleaned_data['motd'])
        messages.success(request, _('Changes successfully saved.'))
        return redirect(reverse('reviewers.apps.motd'))
    data = context(request, form=form)
    return render(request, 'reviewers/motd.html', data)
Exemple #6
0
 def test_real_list(self):
     to = "*****@*****.**"
     to2 = "*****@*****.**"
     to3 = "*****@*****.**"
     set_config("real_email_whitelist", to3)
     success = send_mail("test subject", "test_real_list", recipient_list=[to, to2, to3], fail_silently=False)
     assert success
     eq_(len(mail.outbox), 1)
     eq_(mail.outbox[0].to, [to3])
     assert "test_real_list" in mail.outbox[0].body
     eq_(FakeEmail.objects.count(), 1)  # Only one mail, two recipients.
     fakeemail = FakeEmail.objects.get()
     eq_(fakeemail.message.endswith("test_real_list"), True)
     assert ("To: %s, %s" % (to, to2)) in fakeemail.message
 def test_real_list(self):
     to = '*****@*****.**'
     to2 = '*****@*****.**'
     to3 = '*****@*****.**'
     set_config('real_email_whitelist', to3)
     success = send_mail('test subject', 'test_real_list',
                         recipient_list=[to, to2, to3], fail_silently=False)
     assert success
     eq_(len(mail.outbox), 1)
     eq_(mail.outbox[0].to, [to3])
     assert 'test_real_list' in mail.outbox[0].body
     eq_(FakeEmail.objects.count(), 1) # Only one mail, two recipients.
     fakeemail = FakeEmail.objects.get()
     eq_(fakeemail.message.endswith('test_real_list'), True)
     assert ('To: %s, %s' % (to, to2)) in fakeemail.message
Exemple #8
0
 def test_real_list(self):
     to = '*****@*****.**'
     to2 = '*****@*****.**'
     to3 = '*****@*****.**'
     set_config('real_email_whitelist', to3)
     success = send_mail('test subject',
                         'test_real_list',
                         recipient_list=[to, to2, to3],
                         fail_silently=False)
     assert success
     eq_(len(mail.outbox), 1)
     eq_(mail.outbox[0].to, [to3])
     assert 'test_real_list' in mail.outbox[0].body
     eq_(FakeEmail.objects.count(), 1)  # Only one mail, two recipients.
     fakeemail = FakeEmail.objects.get()
     eq_(fakeemail.message.endswith('test_real_list'), True)
     assert ('To: %s, %s' % (to, to2)) in fakeemail.message
Exemple #9
0
 def test_bad_regexes(self):
     set_config('real_email_allowed_regex',
                'reallywantsemail(\+[^@]+)[email protected],bad(regex{3')
     email_regexes = _real_email_regexes()
     eq_(len(email_regexes), 1)
     eq_(email_regexes[0].pattern, 'reallywantsemail(\+[^@]+)[email protected]')
Exemple #10
0
 def test_bad_regexes(self):
     set_config('real_email_regex_whitelist',
                'reallywantsemail(\+[^@]+)[email protected],bad(regex{3')
     email_regexes = _real_email_regexes()
     eq_(len(email_regexes), 1)
     eq_(email_regexes[0].pattern, 'reallywantsemail(\+[^@]+)[email protected]')