0001-misc-add-support-for-importing-site-from-stdin-15665.patch
combo/data/management/commands/import_site.py | ||
---|---|---|
15 | 15 |
# along with this program. If not, see <http://www.gnu.org/licenses/>. |
16 | 16 | |
17 | 17 |
import json |
18 |
import sys |
|
18 | 19 | |
19 | 20 |
from django.core.management.base import BaseCommand |
20 | 21 | |
... | ... | |
24 | 25 |
args = ['...'] |
25 | 26 | |
26 | 27 |
def handle(self, json_file, *args, **kwargs): |
27 |
Page.load_serialized_pages(json.load(open(json_file))) |
|
28 |
if filename == '-': |
|
29 |
fd = sys.stdin |
|
30 |
else: |
|
31 |
fd = open(filename) |
|
32 |
Page.load_serialized_pages(json.load(fd)) |
|
28 |
- |