@requires(conf.ALLOW_SUBSCRIPTIONS)<EOL>@csrf_protect<EOL>def create_subscription(request):
if request.POST:<EOL><INDENT>form = NewSubscriptionForm(request.POST)<EOL>if form.is_valid():<EOL><INDENT>unverified = form.save()<EOL>body = """<STR_LIT>""" % dict(<EOL>name=conf.NAME,<EOL>link=urlparse.urljoin(conf.BASE_URL, reverse('<STR_LIT>', args=[unverified.ident]))<EOL>)<EOL>from_mail = conf.FROM_EMAIL<EOL>if not from_mail:<EOL><INDENT>from_mail = '<STR_LIT>' % request.get_host().split('<STR_LIT::>', <NUM_LIT:1>)[<NUM_LIT:0>]<EOL><DEDENT>send_mail('<STR_LIT>', body, from_mail, [unverified.email],<EOL>fail_silently=True)<EOL>return respond('<STR_LIT>', {<EOL>'<STR_LIT>': unverified,<EOL>}, request)<EOL><DEDENT><DEDENT>else:<EOL><INDENT>form = NewSubscriptionForm()<EOL><DEDENT>context = csrf(request)<EOL>context.update({<EOL>'<STR_LIT>': form,<EOL>'<STR_LIT>': Service.objects.all(),<EOL>})<EOL>return respond('<STR_LIT>', context, request)<EOL>
Shows subscriptions options for a new subscriber.