Skip to content

Commit 71ea5ae

Browse files
committed
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
1 parent ccf58c9 commit 71ea5ae

1 file changed

Lines changed: 9 additions & 3 deletions

File tree

ietf/api/management/commands/makeresources.py

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,12 @@
11
# Copyright The IETF Trust 2014-2019, All Rights Reserved
22
# -*- coding: utf-8 -*-
3-
3+
from __future__ import absolute_import, print_function, unicode_literals
44

55
import os
66
import datetime
77
import collections
8+
import io
9+
810
from importlib import import_module
911

1012
import debug # pyflakes:ignore
@@ -16,7 +18,11 @@
1618
from tastypie.resources import ModelResource
1719

1820

19-
resource_head_template = """# Autogenerated by the makeresources management command {{date}}
21+
resource_head_template = """# Copyright The IETF Trust {{date}}, All Rights Reserved
22+
# -*- coding: utf-8 -*-
23+
# Generated by the makeresources management command {{date}}
24+
25+
2026
from tastypie.resources import ModelResource
2127
from tastypie.fields import ToManyField # pyflakes:ignore
2228
from tastypie.constants import ALL, ALL_WITH_RELATIONS # pyflakes:ignore
@@ -79,7 +85,7 @@ def handle_app_config(self, app, **options):
7985

8086
if missing_resources:
8187
print("Updating resources.py for %s" % app.name)
82-
with open(resource_file_path, "a") as rfile:
88+
with io.open(resource_file_path, "a") as rfile:
8389
info = dict(
8490
app=app.name,
8591
app_label=app.label,

0 commit comments

Comments
 (0)