From a317287e4efc71b421555432c2ce3450d0f196fb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20P=C3=A9ters?= Date: Tue, 10 Feb 2015 12:08:01 +0100 Subject: [PATCH] tenant: make it possible for create_tenant to get domains from stdin (#6464) --- .../djommon/multitenant/management/commands/create_tenant.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/entrouvert/djommon/multitenant/management/commands/create_tenant.py b/entrouvert/djommon/multitenant/management/commands/create_tenant.py index ed9dded..455475b 100644 --- a/entrouvert/djommon/multitenant/management/commands/create_tenant.py +++ b/entrouvert/djommon/multitenant/management/commands/create_tenant.py @@ -1,4 +1,5 @@ import os +import sys from django.db import connection from django.core.management.base import CommandError, BaseCommand @@ -13,6 +14,12 @@ class Command(BaseCommand): if not args: raise CommandError("you must give at least one tenant hostname") + # if - is given on the command line, get list of hostnames from stdin + if '-' in args: + args = list(args) + args.remove('-') + args.extend([x.strip() for x in sys.stdin.readlines()]) + for hostname in args: try: tenant_base = TenantMiddleware.base() -- 2.1.4