diff --git a/context_processors.py b/context_processors.py new file mode 100644 index 0000000..9512680 --- /dev/null +++ b/context_processors.py @@ -0,0 +1,22 @@ +#WEB List selector → TODO → MOVE to Context Processors + try: + web_host = request.META["HTTP_HOST"].split(":")#TODO Django DEV only ! + web_host = web_host[0] + except: + web_host = request.META["HTTP_HOST"] + d = c.get_domain(None,web_host) + domainname= d.email_host + domain_lists = [] + for list in c.lists: + if list.host_name == domainname: + domain_lists.append(list) + + + + LISTS: domains + + +return [(lists,domain.... + + + diff --git a/views.py b/views.py index 11c22a1..3d16c6a 100644 --- a/views.py +++ b/views.py @@ -101,24 +101,11 @@ form = DomainNew() try: existing_domains = c.domains - - #WEB List selector → TODO → MOVE to Context Processors - try: - web_host = request.META["HTTP_HOST"].split(":")#TODO Django DEV only ! - web_host = web_host[0] - except: - web_host = request.META["HTTP_HOST"] - d = c.get_domain(None,web_host) - domainname= d.email_host - domain_lists = [] - for list in c.lists: - if list.host_name == domainname: - domain_lists.append(list) - + except Exception, e: return HttpResponse(e) - return render_to_response(template, {'form': form,'domains':existing_domains,'lists':domain_lists}) + return render_to_response(template, {'form': form,'domains':existing_domains}) @login_required def administration(request, template = 'mailman-django/lists/new.html'):