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
This commit is contained in:
Henrik Levkowetz 2019-07-15 14:35:25 +00:00
parent ccf58c9526
commit 71ea5ae379

View file

@ -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,