diff options
Diffstat (limited to 'hyperkitty/views')
-rw-r--r-- | hyperkitty/views/accounts.py | 9 | ||||
-rw-r--r-- | hyperkitty/views/api.py | 20 | ||||
-rw-r--r-- | hyperkitty/views/list.py | 35 | ||||
-rw-r--r-- | hyperkitty/views/message.py | 23 | ||||
-rw-r--r-- | hyperkitty/views/pages.py | 26 | ||||
-rw-r--r-- | hyperkitty/views/thread.py | 21 |
6 files changed, 109 insertions, 25 deletions
diff --git a/hyperkitty/views/accounts.py b/hyperkitty/views/accounts.py index 49d726f..26568e5 100644 --- a/hyperkitty/views/accounts.py +++ b/hyperkitty/views/accounts.py @@ -21,6 +21,7 @@ import re import sys +import logging from django.conf import settings from django.contrib import messages @@ -40,10 +41,12 @@ from urllib2 import HTTPError from urlparse import urlparse from forms import RegistrationForm -from hyperkitty.utils import log from hyperkitty.lib import get_store +logger = logging.getLogger(__name__) + + def user_logout(request): logout(request) return redirect('user_login') @@ -62,7 +65,7 @@ def user_login(request, template='login.html'): password=request.POST.get('password')) if user is not None: - log('debug', user) + logger.debug(user) if user.is_active: login(request, user) return redirect(next_var) @@ -127,7 +130,7 @@ def user_registration(request): password=form.cleaned_data['password1']) if user is not None: - log('debug', user) + logger.debug(user) if user.is_active: login(request, user) return redirect('index') diff --git a/hyperkitty/views/api.py b/hyperkitty/views/api.py index d3c2260..c88923d 100644 --- a/hyperkitty/views/api.py +++ b/hyperkitty/views/api.py @@ -1,3 +1,22 @@ +#-*- coding: utf-8 -*- +# Copyright (C) 1998-2012 by the Free Software Foundation, Inc. +# +# This file is part of HyperKitty. +# +# HyperKitty is free software: you can redistribute it and/or modify it under +# the terms of the GNU General Public License as published by the Free +# Software Foundation, either version 3 of the License, or (at your option) +# any later version. +# +# HyperKitty is distributed in the hope that it will be useful, but WITHOUT +# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or +# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for +# more details. +# +# You should have received a copy of the GNU General Public License along with +# HyperKitty. If not, see <http://www.gnu.org/licenses/>. +# + import re import os import json @@ -15,7 +34,6 @@ from django.core.paginator import Paginator, EmptyPage, PageNotAnInteger, Invali from django.contrib.auth.decorators import (login_required, permission_required, user_passes_test) -from hyperkitty.utils import log def api(request): diff --git a/hyperkitty/views/list.py b/hyperkitty/views/list.py index a8cae9b..900b7f5 100644 --- a/hyperkitty/views/list.py +++ b/hyperkitty/views/list.py @@ -1,14 +1,31 @@ # -*- coding: utf-8 -*- +# Copyright (C) 1998-2012 by the Free Software Foundation, Inc. +# +# This file is part of HyperKitty. +# +# HyperKitty is free software: you can redistribute it and/or modify it under +# the terms of the GNU General Public License as published by the Free +# Software Foundation, either version 3 of the License, or (at your option) +# any later version. +# +# HyperKitty is distributed in the hope that it will be useful, but WITHOUT +# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or +# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for +# more details. +# +# You should have received a copy of the GNU General Public License along with +# HyperKitty. If not, see <http://www.gnu.org/licenses/>. +# + import re import os import json import urllib -import django.utils.simplejson as simplejson - from calendar import timegm from datetime import datetime, timedelta - from urlparse import urljoin + +import django.utils.simplejson as simplejson from django.http import HttpResponse, HttpResponseRedirect from django.template import RequestContext, loader from django.conf import settings @@ -18,10 +35,8 @@ from django.contrib.auth.decorators import (login_required, user_passes_test) from hyperkitty.models import Rating, Tag -#from hyperkitty.lib.mockup import * from hyperkitty.lib import get_months, get_store from forms import * -from hyperkitty.utils import log # @TODO : Move this into settings.py @@ -186,7 +201,7 @@ def list(request, mlist_fqdn=None): month = '0%s' % month day = msg.date.day if day < 10: - day = '0%s' % day + day = '0%s' % day key = '%s%s%s' % (msg.date.year, month, day) if key in dates: dates[key] = dates[key] + 1 @@ -334,21 +349,21 @@ def search_keyword(request, mlist_fqdn, target, keyword, page=1): threads = store.search_content(mlist_fqdn, keyword) elif target.lower() == 'from': threads = store.search_sender(mlist_fqdn, keyword) - + return _search_results_page(request, mlist_fqdn, threads, 'Search', page) def search_tag(request, mlist_fqdn, tag=None, page=1): '''Returns emails having a particular tag''' - + store = get_store(settings.KITTYSTORE_URL) list_name = mlist_fqdn.split('@')[0] - + try: thread_ids = Tag.objects.filter(tag=tag) except Tag.DoesNotExist: thread_ids = {} - + threads = [] for thread in thread_ids: threads_tmp = store.get_messages_in_thread(mlist_fqdn, thread.threadid) diff --git a/hyperkitty/views/message.py b/hyperkitty/views/message.py index dd80709..18aab87 100644 --- a/hyperkitty/views/message.py +++ b/hyperkitty/views/message.py @@ -1,7 +1,26 @@ +#-*- coding: utf-8 -*- +# Copyright (C) 1998-2012 by the Free Software Foundation, Inc. +# +# This file is part of HyperKitty. +# +# HyperKitty is free software: you can redistribute it and/or modify it under +# the terms of the GNU General Public License as published by the Free +# Software Foundation, either version 3 of the License, or (at your option) +# any later version. +# +# HyperKitty is distributed in the hope that it will be useful, but WITHOUT +# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or +# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for +# more details. +# +# You should have received a copy of the GNU General Public License along with +# HyperKitty. If not, see <http://www.gnu.org/licenses/>. +# + import re import os -import django.utils.simplejson as simplejson +import django.utils.simplejson as simplejson from django.http import HttpResponse, HttpResponseRedirect from django.template import RequestContext, loader from django.conf import settings @@ -11,10 +30,8 @@ from django.contrib.auth.decorators import (login_required, user_passes_test) from hyperkitty.models import Rating -#from hyperkitty.lib.mockup import * from hyperkitty.lib import get_store from forms import * -from hyperkitty.utils import log def index (request, mlist_fqdn, hashid): diff --git a/hyperkitty/views/pages.py b/hyperkitty/views/pages.py index c9d6e19..a61f17f 100644 --- a/hyperkitty/views/pages.py +++ b/hyperkitty/views/pages.py @@ -1,15 +1,31 @@ #-*- coding: utf-8 -*- +# Copyright (C) 1998-2012 by the Free Software Foundation, Inc. +# +# This file is part of HyperKitty. +# +# HyperKitty is free software: you can redistribute it and/or modify it under +# the terms of the GNU General Public License as published by the Free +# Software Foundation, either version 3 of the License, or (at your option) +# any later version. +# +# HyperKitty is distributed in the hope that it will be useful, but WITHOUT +# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or +# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for +# more details. +# +# You should have received a copy of the GNU General Public License along with +# HyperKitty. If not, see <http://www.gnu.org/licenses/>. +# import re import os import json import urllib -import django.utils.simplejson as simplejson - from calendar import timegm from datetime import datetime, timedelta - from urlparse import urljoin + +import django.utils.simplejson as simplejson from django.http import HttpResponse, HttpResponseRedirect from django.template import RequestContext, loader from django.conf import settings @@ -19,10 +35,9 @@ from django.contrib.auth.decorators import (login_required, user_passes_test) from hyperkitty.models import Rating -#from hyperkitty.lib.mockup import * from hyperkitty.lib import get_store from forms import * -from hyperkitty.utils import log + def index(request): t = loader.get_template('index.html') @@ -33,7 +48,6 @@ def index(request): store = get_store(request) list_data = store.get_list_names() - log("warn", repr(list_data)) c = RequestContext(request, { 'lists': list_data, diff --git a/hyperkitty/views/thread.py b/hyperkitty/views/thread.py index b5bf80a..cef8b58 100644 --- a/hyperkitty/views/thread.py +++ b/hyperkitty/views/thread.py @@ -1,3 +1,22 @@ +# -*- coding: utf-8 -*- +# Copyright (C) 1998-2012 by the Free Software Foundation, Inc. +# +# This file is part of HyperKitty. +# +# HyperKitty is free software: you can redistribute it and/or modify it under +# the terms of the GNU General Public License as published by the Free +# Software Foundation, either version 3 of the License, or (at your option) +# any later version. +# +# HyperKitty is distributed in the hope that it will be useful, but WITHOUT +# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or +# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for +# more details. +# +# You should have received a copy of the GNU General Public License along with +# HyperKitty. If not, see <http://www.gnu.org/licenses/>. +# + import datetime import django.utils.simplejson as simplejson @@ -13,11 +32,9 @@ from django.contrib.auth.decorators import (login_required, from hyperkitty.models import Rating, Tag #from hyperkitty.lib.mockup import * from forms import * -from hyperkitty.utils import log from hyperkitty.lib import get_months, get_store - def thread_index (request, mlist_fqdn, threadid): ''' Displays all the email for a given thread identifier ''' list_name = mlist_fqdn.split('@')[0] |