mirror of
https://github.com/jwinterm/modoboa.git
synced 2026-10-20 06:08:35 +02:00
no imports * and unused import
This commit is contained in:
@@ -1,9 +1,8 @@
|
||||
# coding: utf-8
|
||||
|
||||
from modoboa.lib import parameters, events
|
||||
from django.utils.translation import ugettext_lazy
|
||||
from modoboa.lib import parameters
|
||||
|
||||
parameters.register_user("LANG", type="list", deflt="en",
|
||||
parameters.register_user("LANG", type="list", deflt="en",
|
||||
label=ugettext_lazy("Prefered language"),
|
||||
values=[("de", "deutsch"), ("en", "english"),
|
||||
("es", "español"), ("fr", "français"),
|
||||
|
||||
@@ -1,9 +1,12 @@
|
||||
# coding: utf-8
|
||||
from django import forms
|
||||
from modoboa.admin.models import User, Domain, Mailbox
|
||||
from django.utils.translation import ugettext as _, ugettext_lazy
|
||||
|
||||
from modoboa.admin.models import User, Domain
|
||||
from modoboa.lib.emailutils import split_mailbox
|
||||
from modoboa.lib import parameters
|
||||
|
||||
|
||||
class BadDestination(Exception):
|
||||
pass
|
||||
|
||||
@@ -25,7 +28,7 @@ class ProfileForm(forms.ModelForm):
|
||||
del self.fields["oldpassword"]
|
||||
del self.fields["newpassword"]
|
||||
del self.fields["confirmation"]
|
||||
|
||||
|
||||
def clean_oldpassword(self):
|
||||
if self.cleaned_data["oldpassword"] == "":
|
||||
return self.cleaned_data["oldpassword"]
|
||||
@@ -53,13 +56,13 @@ class ProfileForm(forms.ModelForm):
|
||||
|
||||
class ForwardForm(forms.Form):
|
||||
dest = forms.CharField(
|
||||
label=ugettext_lazy("Recipient(s)"),
|
||||
label=ugettext_lazy("Recipient(s)"),
|
||||
widget=forms.Textarea,
|
||||
required=False,
|
||||
help_text=ugettext_lazy("Indicate one or more recipients separated by a ','")
|
||||
)
|
||||
keepcopies = forms.BooleanField(
|
||||
label=ugettext_lazy("Keep local copies"),
|
||||
label=ugettext_lazy("Keep local copies"),
|
||||
required=False,
|
||||
help_text=ugettext_lazy("Forward messages and store copies into your local mailbox")
|
||||
)
|
||||
@@ -79,4 +82,4 @@ class ForwardForm(forms.Form):
|
||||
self.dests += [d]
|
||||
else:
|
||||
raise BadDestination(_("You can't define a forward to a local destination. Please ask your administrator to create an alias instead."))
|
||||
|
||||
|
||||
|
||||
@@ -1,10 +1,9 @@
|
||||
# coding: utf-8
|
||||
from django import template
|
||||
from django.template.loader import render_to_string
|
||||
from django.utils.translation import ugettext as _
|
||||
from django.core.urlresolvers import reverse
|
||||
from modoboa import userprefs
|
||||
from modoboa.lib import events
|
||||
from modoboa.lib.webutils import static_url
|
||||
|
||||
register = template.Library()
|
||||
|
||||
@@ -29,7 +28,7 @@ def uprefs_menu(selection, user):
|
||||
entries += events.raiseQueryEvent("UserMenuDisplay", "uprefs_menu", user)
|
||||
entries = sorted(entries, key=lambda e: e["label"])
|
||||
return render_to_string('common/menu.html', {
|
||||
"entries" : entries,
|
||||
"entries" : entries,
|
||||
"css" : "nav nav-list",
|
||||
"selection" : selection,
|
||||
"user" : user
|
||||
@@ -63,5 +62,5 @@ def user_menu(user, selection):
|
||||
@register.simple_tag
|
||||
def loadextmenu(selection, user):
|
||||
menu = events.raiseQueryEvent("UserMenuDisplay", "top_menu", user)
|
||||
return render_to_string('common/menulist.html',
|
||||
return render_to_string('common/menulist.html',
|
||||
{"selection" : selection, "entries" : menu, "user" : user})
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
from django.conf.urls.defaults import *
|
||||
# coding: utf-8
|
||||
from django.conf.urls.defaults import patterns, url
|
||||
from modoboa.lib import events
|
||||
|
||||
urlpatterns = patterns('modoboa.userprefs.views',
|
||||
|
||||
@@ -1,19 +1,14 @@
|
||||
# coding: utf-8
|
||||
from django.shortcuts import render
|
||||
from django.template.loader import render_to_string
|
||||
from django.core.urlresolvers import reverse
|
||||
from django.http import HttpResponseRedirect
|
||||
from django.contrib.auth.decorators \
|
||||
import login_required, user_passes_test
|
||||
from django.conf import settings
|
||||
from django.contrib.auth.decorators import login_required, user_passes_test
|
||||
from django.utils.translation import ugettext as _
|
||||
from modoboa.lib import parameters, events
|
||||
from modoboa.lib.exceptions import ModoboaException
|
||||
from modoboa.lib.webutils import ajax_response, ajax_simple_response
|
||||
from forms import *
|
||||
from modoboa.admin.models import Mailbox, Alias
|
||||
from modoboa.admin.lib import AdminError
|
||||
from modoboa.auth.lib import encrypt
|
||||
from forms import ForwardForm, BadDestination, ProfileForm
|
||||
|
||||
@login_required
|
||||
def index(request, tplname="userprefs/index.html"):
|
||||
@@ -31,7 +26,7 @@ def forward(request, tplname='userprefs/forward.html'):
|
||||
except IndexError:
|
||||
raise ModoboaException(_("You need a mailbox in order to define a forward"))
|
||||
try:
|
||||
al = Alias.objects.get(address=mb.address,
|
||||
al = Alias.objects.get(address=mb.address,
|
||||
domain__name=mb.domain.name)
|
||||
except Alias.DoesNotExist:
|
||||
al = None
|
||||
@@ -55,7 +50,7 @@ def forward(request, tplname='userprefs/forward.html'):
|
||||
error = str(e)
|
||||
|
||||
return ajax_simple_response(dict(
|
||||
status="ko",
|
||||
status="ko",
|
||||
content=render_to_string(tplname, {"form" : form}),
|
||||
respmsg=error
|
||||
))
|
||||
@@ -70,7 +65,7 @@ def forward(request, tplname='userprefs/forward.html'):
|
||||
else:
|
||||
form.fields["keepcopies"].initial = True
|
||||
return ajax_simple_response({
|
||||
"status" : "ok",
|
||||
"status" : "ok",
|
||||
"content" : render_to_string(tplname, {
|
||||
"form" : form
|
||||
})
|
||||
@@ -92,13 +87,13 @@ def profile(request, tplname='userprefs/profile.html'):
|
||||
status="ok", respmsg=_("Profile updated")
|
||||
))
|
||||
return ajax_simple_response({
|
||||
"status" : "ko",
|
||||
"status" : "ko",
|
||||
"content" : render_to_string(tplname, {"form" : form})
|
||||
})
|
||||
|
||||
form = ProfileForm(update_password, instance=request.user)
|
||||
return ajax_simple_response({
|
||||
"status" : "ok",
|
||||
"status" : "ok",
|
||||
"content" : render_to_string(tplname, {
|
||||
"form" : form
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user