From 71ea5ae379f7b46e16ad058cc904ce8b93956cf6 Mon Sep 17 00:00:00 2001 From: Henrik Levkowetz Date: Mon, 15 Jul 2019 14:35:25 +0000 Subject: [PATCH] Updated the file header generated by the makeresources managment command to set Copyright and file encoding, and use io.open() for py2/3 compatibility. - Legacy-Id: 16441 --- ietf/api/management/commands/makeresources.py | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/ietf/api/management/commands/makeresources.py b/ietf/api/management/commands/makeresources.py index 6cc011a74..54830b5c1 100644 --- a/ietf/api/management/commands/makeresources.py +++ b/ietf/api/management/commands/makeresources.py @@ -1,10 +1,12 @@ # Copyright The IETF Trust 2014-2019, All Rights Reserved # -*- coding: utf-8 -*- - +from __future__ import absolute_import, print_function, unicode_literals import os import datetime import collections +import io + from importlib import import_module import debug # pyflakes:ignore @@ -16,7 +18,11 @@ from django.template import Template, Context from tastypie.resources import ModelResource -resource_head_template = """# Autogenerated by the makeresources management command {{date}} +resource_head_template = """# Copyright The IETF Trust {{date}}, All Rights Reserved +# -*- coding: utf-8 -*- +# Generated by the makeresources management command {{date}} + + from tastypie.resources import ModelResource from tastypie.fields import ToManyField # pyflakes:ignore from tastypie.constants import ALL, ALL_WITH_RELATIONS # pyflakes:ignore @@ -79,7 +85,7 @@ class Command(AppCommand): if missing_resources: print("Updating resources.py for %s" % app.name) - with open(resource_file_path, "a") as rfile: + with io.open(resource_file_path, "a") as rfile: info = dict( app=app.name, app_label=app.label,