Exemplo n.º 1
0
def new_capcha_request(form, reuse_hash=None):
    if reuse_hash:
        hash = reuse_hash
        capcha_request = CapchaRequest.objects.get(hash=hash)
    else:
        hash = make_random_hash()
        capcha_request = CapchaRequest()
    form["hash"].field.initial = hash
    capcha_request.hash = hash
    capcha_request.letters = get_random_hebrew_alphabet_string()
    capcha_request.save()
    return hash
Exemplo n.º 2
0
def old_join(request):
    email = request.GET['q']
    site = Site.objects.get_current().name
    d = {'site': site, 'email':email}
    if not check_email(email):
        return render_to_response('mailinglist/join_error.html', d
            , context_instance = RequestContext(request))

    if MailingListSubscriber.objects.filter(email=email).count() == 0:
        mls = MailingListSubscriber(email=email, confirmed=False, confirm_code=make_random_hash())
        mls.save()
        d['confirm_code'] = mls.confirm_code
        send_email_to('mailinglist/request_confirmation.txt', email,
                loader.get_template('mailinglist/request_confirmation__subject.txt').render(Context({})), d, fail_silently=False)
        
    return render_to_response('mailinglist/join_confirm.html', d
        , context_instance=RequestContext(request))
Exemplo n.º 3
0
 def email(self, comment, content_object):
     self._hash = make_random_hash()
     hide_hash = HashPoint.new(data=str(comment.id), comment='hide_comment')
     post = content_object # same thing
     if self.really_send_email_to_this_person is None:
         recipient_list = [post.author.email]
     else:
         recipient_list = [self.really_send_email_to_this_person]
     site = Site.objects.get_current().name
     from spamdetector.models import AllowedBanRequests
     AllowedBanRequests(ip_address = comment.ip_address, hash=self._hash).save()
     c = Context({ 'comment': comment,
                   'content_object': content_object,
                   'site': site,
                   'ban_hash': self._hash,
                   'hide_hash': hide_hash})
     subject = u'[%s] New comment posted on "%s"' % (site, content_object)
     send_email_to(template='cityblog/post_comment_notification_email.txt',
             to=recipient_list, subject=subject, context_dict=c,
             fail_silently=True)
Exemplo n.º 4
0
 def new(clazz, data, comment = ''):
       hash = make_random_hash()
       hp = HashPoint(hash=hash, data=data, comment=comment)
       hp.save()
       return hash