~mailmanweb-django/+junk/dev

« back to all changes in this revision

Viewing changes to views.py

  • Committer: Florian Fuchs
  • Date: 2010-12-11 08:54:24 UTC
  • Revision ID: flo.fuchs@gmail.com-20101211085424-363yob0r1g3fni99
* added new version of the client
* changed views accordingly

Show diffs side-by-side

added added

removed removed

Lines of Context:
24
24
import re
25
25
from mailmanclient.rest import MailmanRESTClient, MailmanRESTClientError
26
26
from forms import *
 
27
from settings import API_USER, API_PASS
27
28
 
28
29
def login_required(fn):
29
30
    """
90
91
        if form.is_valid():
91
92
            listname = form.cleaned_data['listname']
92
93
            try:
93
 
                c = MailmanRESTClient('localhost:8001')
 
94
                c = MailmanRESTClient('localhost:8001', API_USER, API_PASS)
94
95
            except Exception, e:
95
96
                return HttpResponse(e)
96
97
 
120
121
    """Show a table of all mailing lists.
121
122
    """
122
123
    try:
123
 
        c = MailmanRESTClient('localhost:8001')
 
124
        c = MailmanRESTClient('localhost:8001', API_USER, API_PASS)
124
125
    except MailmanRESTClientError, e:
125
126
        return render_to_response('mailman-django/errors/generic.html', 
126
127
                                  {'message': e})
142
143
    user to fill in which are evaluated in this function.
143
144
    """
144
145
    try:
145
 
        c = MailmanRESTClient('localhost:8001')
 
146
        c = MailmanRESTClient('localhost:8001', API_USER, API_PASS)
146
147
        the_list = c.get_list(fqdn_listname)
147
148
    except Exception, e:
148
149
        return HttpResponse(e)
209
210
 
210
211
    # create a connection to Mailman and get the list
211
212
    try:
212
 
        c = MailmanRESTClient('localhost:8001')
 
213
        c = MailmanRESTClient('localhost:8001', API_USER, API_PASS)
213
214
        the_list = c.get_list(fqdn_listname)
214
215
    except Exception, e:
215
216
        return HttpResponse(e)
235
236
    """
236
237
    message = ""
237
238
    try:
238
 
        c = MailmanRESTClient('localhost:8001')
 
239
        c = MailmanRESTClient('localhost:8001', API_USER, API_PASS)
239
240
        the_list = c.get_list(fqdn_listname)
240
241
    except Exception, e:
241
242
        return HttpResponse(e)
260
261
    """
261
262
    message = ""
262
263
    try:
263
 
        c = MailmanRESTClient('localhost:8001')
 
264
        c = MailmanRESTClient('localhost:8001', API_USER, API_PASS)
264
265
        the_list = c.get_list(fqdn_listname)
265
266
    except Exception, e:
266
267
        return HttpResponse(e)
306
307
    membership_lists = []
307
308
    listname = ""
308
309
    try:
309
 
        c = MailmanRESTClient('localhost:8001')
 
310
        c = MailmanRESTClient('localhost:8001', API_USER, API_PASS)
310
311
        user_object = c.get_user(member)
311
312
        # address_choices for the 'address' field must be a list of 
312
313
        # tuples of length 2