From 279dc0fa47c46513a5e95c0f1641437a68a94bf4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20P=C3=A9ters?= Date: Sun, 2 Apr 2017 14:29:10 +0200 Subject: [PATCH] misc: add support for importing site from stdin (#15665) --- combo/data/management/commands/import_site.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/combo/data/management/commands/import_site.py b/combo/data/management/commands/import_site.py index a97d864..0192ff3 100644 --- a/combo/data/management/commands/import_site.py +++ b/combo/data/management/commands/import_site.py @@ -15,6 +15,7 @@ # along with this program. If not, see . import json +import sys from django.core.management.base import BaseCommand @@ -24,4 +25,8 @@ class Command(BaseCommand): args = ['...'] def handle(self, json_file, *args, **kwargs): - Page.load_serialized_pages(json.load(open(json_file))) + if filename == '-': + fd = sys.stdin + else: + fd = open(filename) + Page.load_serialized_pages(json.load(fd)) -- 2.11.0