mirror of
https://github.com/jwinterm/modoboa.git
synced 2026-10-17 05:41:25 +02:00
Merge pull request #1092 from modoboa/fix/csv_import_enabled_flag
Allowed more values.
This commit is contained in:
@@ -187,7 +187,7 @@ class Alias(AdminObject):
|
||||
raise Conflict
|
||||
self.address = address
|
||||
self.domain = domain
|
||||
self.enabled = (row[2].strip() in ["True", "1", "yes", "y"])
|
||||
self.enabled = (row[2].strip().lower() in ["true", "1", "yes", "y"])
|
||||
self.save()
|
||||
self.set_recipients([raddress.strip() for raddress in row[3:]])
|
||||
self.post_create(user)
|
||||
|
||||
@@ -269,7 +269,7 @@ class Domain(AdminObject):
|
||||
_("Default mailbox quota cannot be greater than domain "
|
||||
"quota")
|
||||
)
|
||||
self.enabled = (row[4].strip() in ["True", "1", "yes", "y"])
|
||||
self.enabled = (row[4].strip().lower() in ["true", "1", "yes", "y"])
|
||||
core_signals.can_create_object.send(
|
||||
sender=self.__class__, context=user, klass=Domain,
|
||||
instance=self)
|
||||
|
||||
@@ -80,7 +80,7 @@ class DomainAlias(AdminObject):
|
||||
raise BadRequest(_("Unknown domain %s") % domname)
|
||||
core_signals.can_create_object.send(
|
||||
sender="import", context=self.target, object_type="domain_aliases")
|
||||
self.enabled = row[3].strip() in ["True", "1", "yes", "y"]
|
||||
self.enabled = row[3].strip().lower() in ["true", "1", "yes", "y"]
|
||||
self.save(creator=user)
|
||||
|
||||
def to_csv(self, csvwriter):
|
||||
|
||||
@@ -392,7 +392,7 @@ class User(PermissionsMixin):
|
||||
self.password = row[2].strip()
|
||||
self.first_name = row[3].strip()
|
||||
self.last_name = row[4].strip()
|
||||
self.is_active = (row[5].strip() in ["True", "1", "yes", "y"])
|
||||
self.is_active = (row[5].strip().lower() in ["true", "1", "yes", "y"])
|
||||
self.save()
|
||||
self.role = desired_role
|
||||
self.post_create(user)
|
||||
|
||||
@@ -122,14 +122,15 @@ class RelayDomain(admin_models.AdminObject):
|
||||
raise BadRequest(_("Invalid line"))
|
||||
self.domain = admin_models.Domain(
|
||||
name=row[1].strip(), type="relaydomain", quota=0,
|
||||
enabled=(row[5].strip() in ["True", "1", "yes", "y"])
|
||||
enabled=(row[5].strip().lower() in ["true", "1", "yes", "y"])
|
||||
)
|
||||
self.domain.save(creator=user)
|
||||
self.target_host = row[2].strip()
|
||||
self.target_port = row[3].strip()
|
||||
self.service, created = Service.objects.get_or_create(
|
||||
name=row[4].strip())
|
||||
self.verify_recipients = (row[6].strip() in ["True", "1", "yes", "y"])
|
||||
self.verify_recipients = (
|
||||
row[6].strip().lower() in ["true", "1", "yes", "y"])
|
||||
self.save(creator=user)
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user