Esempio n. 1
0
 def send_if_not_subscriber(self, relay, mlist, target, address, template, host='postosaurus.com'):
     
     name, addr = parseaddr(address)
     user = mailinglist.find_user(addr)
     if user:
         if not mailinglist.find_subscription(addr, mlist.name):
             return self.send(relay, mlist, target, address, template, host)
     else:
         return self.send(relay, mlist, target, address, template, host)
Esempio n. 2
0
def members(request, listname):

    user = request.user.get_profile()
    mlist = mailinglist.find_list(listname)
    _authorize_or_raise(user, mlist)

    subscriptions = mlist.subscription_set.all()
    
    if request.method == 'POST':

        if not request.POST.has_key('confirmed'):
            # not confirmed yet.
            toremove = []
            for email in request.POST.keys():
                if request.POST[email]:
                    toremove.append(email)
            if len(toremove) > 0:
                return render_to_response('postosaurus/members-confirm.html', locals(), context_instance = RequestContext(request))

        # they confirmed, now remove the members.
        toremove = [key for key in request.POST.keys() if key != 'confirmed']
        for email in toremove:
            sub = mailinglist.find_subscription(email, listname)
            if sub:
                sub.delete()

        return render_to_response('postosaurus/members.html', {
                'mlist' : mlist,
                'subscriptions' : subscriptions,
                'membertab' : True,
                }, context_instance = RequestContext(request))

    else:
        return render_to_response('postosaurus/members.html', {
                'mlist' : mlist,
                'subscriptions' : subscriptions,
                'membertab' : True,
                }, context_instance = RequestContext(request))