mirror of
https://github.com/jwinterm/modoboa.git
synced 2026-10-18 05:51:26 +02:00
@@ -180,6 +180,7 @@ class AccountFormMail(forms.Form, DynamicForm):
|
||||
return self.cleaned_data
|
||||
|
||||
def create_mailbox(self, user, account):
|
||||
"""Create a mailbox associated to :kw:`account`."""
|
||||
locpart, domname = split_mailbox(self.cleaned_data["email"])
|
||||
try:
|
||||
domain = Domain.objects.get(name=domname)
|
||||
|
||||
@@ -184,9 +184,9 @@ class Mailbox(AdminObject):
|
||||
|
||||
"""
|
||||
old_mail_home = self.mail_home
|
||||
old_qvalue = self.quota_value
|
||||
self.address = address
|
||||
self.domain = domain
|
||||
old_qvalue = self.quota_value
|
||||
self.quota_value = Quota.objects.create(
|
||||
username=self.full_address, bytes=old_qvalue.bytes,
|
||||
messages=old_qvalue.messages
|
||||
@@ -218,7 +218,8 @@ class Mailbox(AdminObject):
|
||||
self.quota = 0
|
||||
elif int(value) > self.domain.quota and not override_rules:
|
||||
raise BadRequest(
|
||||
_("Quota is greater than the allowed domain's limit (%dM)" % self.domain.quota)
|
||||
_("Quota is greater than the allowed domain's limit (%dM)"
|
||||
% self.domain.quota)
|
||||
)
|
||||
else:
|
||||
self.quota = value
|
||||
@@ -261,9 +262,7 @@ class Mailbox(AdminObject):
|
||||
|
||||
We just make sure a quota record is defined for this mailbox.
|
||||
"""
|
||||
try:
|
||||
q = self.quota_value
|
||||
except Quota.DoesNotExist:
|
||||
if self.quota_value is None:
|
||||
self.quota_value, created = Quota.objects.get_or_create(
|
||||
username=self.full_address)
|
||||
super(Mailbox, self).save(*args, **kwargs)
|
||||
|
||||
Reference in New Issue
Block a user