We are currently solving the following issue within our repository. Here is the issue text:
--- BEGIN ISSUE ---
v1 api crashes on some content when serializing to xml
See the very old ticket at https://github.com/django-tastypie/django-tastypie/issues/1107.

submission.first_two_pages can contain formfeeds. These break tastypie's xml serialization. Json serialization succeeds.

The quick fix is to stop exposing first_two_pages through the API.



--- END ISSUE ---

Below are some code segments, each from a relevant file. One or more of these files may contain bugs.
--- BEGIN FILES ---
Path: `ietf/submit/resources.py`
Content:
```
1 # Copyright The IETF Trust 2014-2019, All Rights Reserved
2 # -*- coding: utf-8 -*-
3 # Autogenerated by the mkresources management command 2014-11-13 23:53
4 
5 
6 from ietf.api import ModelResource
7 from tastypie.fields import ToOneField, ToManyField
8 from tastypie.constants import ALL, ALL_WITH_RELATIONS
9 from tastypie.cache import SimpleCache
10 
11 from ietf import api
12 from ietf.submit.models import ( Preapproval, SubmissionCheck, Submission,
13     SubmissionEmailEvent, SubmissionEvent, SubmissionExtResource )
14 from ietf.person.resources import PersonResource
15 
16 
17 class PreapprovalResource(ModelResource):
18     by               = ToOneField(PersonResource, 'by')
19     class Meta:
20         cache = SimpleCache()
21         queryset = Preapproval.objects.all()
22         serializer = api.Serializer()
23         #resource_name = 'preapproval'
24         ordering = ['id', ]
25         filtering = { 
26             "id": ALL,
27             "name": ALL,
28             "time": ALL,
29             "by": ALL_WITH_RELATIONS,
30         }
31 api.submit.register(PreapprovalResource())
32 
33 from ietf.group.resources import GroupResource
34 from ietf.name.resources import DraftSubmissionStateNameResource
35 from ietf.doc.resources import DocumentResource
36 class SubmissionResource(ModelResource):
37     state            = ToOneField(DraftSubmissionStateNameResource, 'state')
38     group            = ToOneField(GroupResource, 'group', null=True)
39     draft            = ToOneField(DocumentResource, 'draft', null=True)
40     checks           = ToManyField('ietf.submit.resources.SubmissionCheckResource', 'checks', null=True)
41     class Meta:
42         cache = SimpleCache()
43         queryset = Submission.objects.all()
44         serializer = api.Serializer()
45         #resource_name = 'submission'
46         ordering = ['id', ]
47         filtering = { 
48             "id": ALL,
49             "remote_ip": ALL,
50             "access_key": ALL,
51             "auth_key": ALL,
52             "name": ALL,
53             "title": ALL,
54             "abstract": ALL,
55             "rev": ALL,
56             "pages": ALL,
57             "authors": ALL,
58             "note": ALL,
59             "replaces": ALL,
60             "first_two_pages": ALL,
61             "file_types": ALL,
62             "file_size": ALL,
63             "document_date": ALL,
64             "submission_date": ALL,
65             "submitter": ALL,
66             "xml_version": ALL,
67             "state": ALL_WITH_RELATIONS,
68             "group": ALL_WITH_RELATIONS,
69             "draft": ALL_WITH_RELATIONS,
70         }
71 api.submit.register(SubmissionResource())
72 
73 from ietf.person.resources import PersonResource
74 class SubmissionEventResource(ModelResource):
75     submission       = ToOneField(SubmissionResource, 'submission')
76     by               = ToOneField(PersonResource, 'by', null=True)
77     class Meta:
78         cache = SimpleCache()
79         queryset = SubmissionEvent.objects.all()
80         serializer = api.Serializer()
81         #resource_name = 'submissionevent'
82         ordering = ['id', ]
83         filtering = { 
84             "id": ALL,
85             "time": ALL,
86             "desc": ALL,
87             "submission": ALL_WITH_RELATIONS,
88             "by": ALL_WITH_RELATIONS,
89         }
90 api.submit.register(SubmissionEventResource())
91 
92 class SubmissionCheckResource(ModelResource):
93     submission       = ToOneField(SubmissionResource, 'submission')
94     class Meta:
95         cache = SimpleCache()
96         queryset = SubmissionCheck.objects.all()
97         serializer = api.Serializer()
98         #resource_name = 'submissioncheck'
99         ordering = ['id', ]
100         filtering = { 
101             "id": ALL,
102             "time": ALL,
103             "checker": ALL,
104             "passed": ALL,
105             "message": ALL,
106             "errors": ALL,
107             "warnings": ALL,
108             "items": ALL,
109             "submission": ALL_WITH_RELATIONS,
110         }
111 api.submit.register(SubmissionCheckResource())
112 
113 
114 
115 from ietf.person.resources import PersonResource
116 from ietf.message.resources import MessageResource
117 class SubmissionEmailEventResource(ModelResource):
118     submission       = ToOneField(SubmissionResource, 'submission')
119     by               = ToOneField(PersonResource, 'by', null=True)
120     submissionevent_ptr = ToOneField(SubmissionEventResource, 'submissionevent_ptr')
121     message          = ToOneField(MessageResource, 'message', null=True)
122     in_reply_to      = ToOneField(MessageResource, 'in_reply_to', null=True)
123     class Meta:
124         queryset = SubmissionEmailEvent.objects.all()
125         serializer = api.Serializer()
126         cache = SimpleCache()
127         #resource_name = 'submissionemailevent'
128         ordering = ['id', ]
129         filtering = { 
130             "id": ALL,
131             "time": ALL,
132             "desc": ALL,
133             "msgtype": ALL,
134             "submission": ALL_WITH_RELATIONS,
135             "by": ALL_WITH_RELATIONS,
136             "submissionevent_ptr": ALL_WITH_RELATIONS,
137             "message": ALL_WITH_RELATIONS,
138             "in_reply_to": ALL_WITH_RELATIONS,
139         }
140 api.submit.register(SubmissionEmailEventResource())
141 
142 
143 
144 from ietf.name.resources import ExtResourceNameResource
145 class SubmissionExtResourceResource(ModelResource):
146     name             = ToOneField(ExtResourceNameResource, 'name')
147     submission       = ToOneField(SubmissionResource, 'submission')
148     class Meta:
149         queryset = SubmissionExtResource.objects.all()
150         serializer = api.Serializer()
151         cache = SimpleCache()
152         resource_name = 'submissionextresource'
153         ordering = ['id', ]
154         filtering = { 
155             "id": ALL,
156             "display_name": ALL,
157             "value": ALL,
158             "name": ALL_WITH_RELATIONS,
159             "submission": ALL_WITH_RELATIONS,
160         }
161 api.submit.register(SubmissionExtResourceResource())
162
```
--- END FILES ---

Please first localize the bug based on the issue statement, and then generate a patch according to the `git diff` format fenced by three backticks.

Here is an example:

```diff
diff --git a/examples/server_async.py b/examples/server_async.py
--- a/examples/server_async.py
+++ b/examples/server_async.py
@@ -313,4 +313,4 @@
 
 
 if __name__ == "__main__":
-    asyncio.run(run_async_server("."), debug=True)
+    asyncio.run(run_async_server(), debug=True)
diff --git a/examples/server_sync.py b/examples/server_sync.py
--- a/examples/server_sync.py
+++ b/examples/server_sync.py
@@ -313,5 +313,5 @@
 
 
 if __name__ == "__main__":
-    server = run_sync_server(".")
+    server = run_sync_server()
     server.shutdown()

```

diff --git a/ietf/submit/resources.py b/ietf/submit/resources.py
--- a/ietf/submit/resources.py
+++ b/ietf/submit/resources.py
@@ -68,6 +68,7 @@
             "group": ALL_WITH_RELATIONS,
             "draft": ALL_WITH_RELATIONS,
         }
+        excludes = ('first_two_pages',)
 api.submit.register(SubmissionResource())
 
 from ietf.person.resources import PersonResource

{"golden_diff": "diff --git a/ietf/submit/resources.py b/ietf/submit/resources.py\n--- a/ietf/submit/resources.py\n+++ b/ietf/submit/resources.py\n@@ -68,6 +68,7 @@\n             \"group\": ALL_WITH_RELATIONS,\n             \"draft\": ALL_WITH_RELATIONS,\n         }\n+        excludes = ('first_two_pages',)\n api.submit.register(SubmissionResource())\n \n from ietf.person.resources import PersonResource\n", "issue": "v1 api crashes on some content when serializing to xml\nSee the very old ticket at https://github.com/django-tastypie/django-tastypie/issues/1107.\r\n\r\nsubmission.first_two_pages can contain formfeeds. These break tastypie's xml serialization. Json serialization succeeds.\r\n\r\nThe quick fix is to stop exposing first_two_pages through the API.\r\n\r\n\n", "before_files": [{"content": "# Copyright The IETF Trust 2014-2019, All Rights Reserved\n# -*- coding: utf-8 -*-\n# Autogenerated by the mkresources management command 2014-11-13 23:53\n\n\nfrom ietf.api import ModelResource\nfrom tastypie.fields import ToOneField, ToManyField\nfrom tastypie.constants import ALL, ALL_WITH_RELATIONS\nfrom tastypie.cache import SimpleCache\n\nfrom ietf import api\nfrom ietf.submit.models import ( Preapproval, SubmissionCheck, Submission,\n    SubmissionEmailEvent, SubmissionEvent, SubmissionExtResource )\nfrom ietf.person.resources import PersonResource\n\n\nclass PreapprovalResource(ModelResource):\n    by               = ToOneField(PersonResource, 'by')\n    class Meta:\n        cache = SimpleCache()\n        queryset = Preapproval.objects.all()\n        serializer = api.Serializer()\n        #resource_name = 'preapproval'\n        ordering = ['id', ]\n        filtering = { \n            \"id\": ALL,\n            \"name\": ALL,\n            \"time\": ALL,\n            \"by\": ALL_WITH_RELATIONS,\n        }\napi.submit.register(PreapprovalResource())\n\nfrom ietf.group.resources import GroupResource\nfrom ietf.name.resources import DraftSubmissionStateNameResource\nfrom ietf.doc.resources import DocumentResource\nclass SubmissionResource(ModelResource):\n    state            = ToOneField(DraftSubmissionStateNameResource, 'state')\n    group            = ToOneField(GroupResource, 'group', null=True)\n    draft            = ToOneField(DocumentResource, 'draft', null=True)\n    checks           = ToManyField('ietf.submit.resources.SubmissionCheckResource', 'checks', null=True)\n    class Meta:\n        cache = SimpleCache()\n        queryset = Submission.objects.all()\n        serializer = api.Serializer()\n        #resource_name = 'submission'\n        ordering = ['id', ]\n        filtering = { \n            \"id\": ALL,\n            \"remote_ip\": ALL,\n            \"access_key\": ALL,\n            \"auth_key\": ALL,\n            \"name\": ALL,\n            \"title\": ALL,\n            \"abstract\": ALL,\n            \"rev\": ALL,\n            \"pages\": ALL,\n            \"authors\": ALL,\n            \"note\": ALL,\n            \"replaces\": ALL,\n            \"first_two_pages\": ALL,\n            \"file_types\": ALL,\n            \"file_size\": ALL,\n            \"document_date\": ALL,\n            \"submission_date\": ALL,\n            \"submitter\": ALL,\n            \"xml_version\": ALL,\n            \"state\": ALL_WITH_RELATIONS,\n            \"group\": ALL_WITH_RELATIONS,\n            \"draft\": ALL_WITH_RELATIONS,\n        }\napi.submit.register(SubmissionResource())\n\nfrom ietf.person.resources import PersonResource\nclass SubmissionEventResource(ModelResource):\n    submission       = ToOneField(SubmissionResource, 'submission')\n    by               = ToOneField(PersonResource, 'by', null=True)\n    class Meta:\n        cache = SimpleCache()\n        queryset = SubmissionEvent.objects.all()\n        serializer = api.Serializer()\n        #resource_name = 'submissionevent'\n        ordering = ['id', ]\n        filtering = { \n            \"id\": ALL,\n            \"time\": ALL,\n            \"desc\": ALL,\n            \"submission\": ALL_WITH_RELATIONS,\n            \"by\": ALL_WITH_RELATIONS,\n        }\napi.submit.register(SubmissionEventResource())\n\nclass SubmissionCheckResource(ModelResource):\n    submission       = ToOneField(SubmissionResource, 'submission')\n    class Meta:\n        cache = SimpleCache()\n        queryset = SubmissionCheck.objects.all()\n        serializer = api.Serializer()\n        #resource_name = 'submissioncheck'\n        ordering = ['id', ]\n        filtering = { \n            \"id\": ALL,\n            \"time\": ALL,\n            \"checker\": ALL,\n            \"passed\": ALL,\n            \"message\": ALL,\n            \"errors\": ALL,\n            \"warnings\": ALL,\n            \"items\": ALL,\n            \"submission\": ALL_WITH_RELATIONS,\n        }\napi.submit.register(SubmissionCheckResource())\n\n\n\nfrom ietf.person.resources import PersonResource\nfrom ietf.message.resources import MessageResource\nclass SubmissionEmailEventResource(ModelResource):\n    submission       = ToOneField(SubmissionResource, 'submission')\n    by               = ToOneField(PersonResource, 'by', null=True)\n    submissionevent_ptr = ToOneField(SubmissionEventResource, 'submissionevent_ptr')\n    message          = ToOneField(MessageResource, 'message', null=True)\n    in_reply_to      = ToOneField(MessageResource, 'in_reply_to', null=True)\n    class Meta:\n        queryset = SubmissionEmailEvent.objects.all()\n        serializer = api.Serializer()\n        cache = SimpleCache()\n        #resource_name = 'submissionemailevent'\n        ordering = ['id', ]\n        filtering = { \n            \"id\": ALL,\n            \"time\": ALL,\n            \"desc\": ALL,\n            \"msgtype\": ALL,\n            \"submission\": ALL_WITH_RELATIONS,\n            \"by\": ALL_WITH_RELATIONS,\n            \"submissionevent_ptr\": ALL_WITH_RELATIONS,\n            \"message\": ALL_WITH_RELATIONS,\n            \"in_reply_to\": ALL_WITH_RELATIONS,\n        }\napi.submit.register(SubmissionEmailEventResource())\n\n\n\nfrom ietf.name.resources import ExtResourceNameResource\nclass SubmissionExtResourceResource(ModelResource):\n    name             = ToOneField(ExtResourceNameResource, 'name')\n    submission       = ToOneField(SubmissionResource, 'submission')\n    class Meta:\n        queryset = SubmissionExtResource.objects.all()\n        serializer = api.Serializer()\n        cache = SimpleCache()\n        resource_name = 'submissionextresource'\n        ordering = ['id', ]\n        filtering = { \n            \"id\": ALL,\n            \"display_name\": ALL,\n            \"value\": ALL,\n            \"name\": ALL_WITH_RELATIONS,\n            \"submission\": ALL_WITH_RELATIONS,\n        }\napi.submit.register(SubmissionExtResourceResource())\n", "path": "ietf/submit/resources.py"}], "after_files": [{"content": "# Copyright The IETF Trust 2014-2019, All Rights Reserved\n# -*- coding: utf-8 -*-\n# Autogenerated by the mkresources management command 2014-11-13 23:53\n\n\nfrom ietf.api import ModelResource\nfrom tastypie.fields import ToOneField, ToManyField\nfrom tastypie.constants import ALL, ALL_WITH_RELATIONS\nfrom tastypie.cache import SimpleCache\n\nfrom ietf import api\nfrom ietf.submit.models import ( Preapproval, SubmissionCheck, Submission,\n    SubmissionEmailEvent, SubmissionEvent, SubmissionExtResource )\nfrom ietf.person.resources import PersonResource\n\n\nclass PreapprovalResource(ModelResource):\n    by               = ToOneField(PersonResource, 'by')\n    class Meta:\n        cache = SimpleCache()\n        queryset = Preapproval.objects.all()\n        serializer = api.Serializer()\n        #resource_name = 'preapproval'\n        ordering = ['id', ]\n        filtering = { \n            \"id\": ALL,\n            \"name\": ALL,\n            \"time\": ALL,\n            \"by\": ALL_WITH_RELATIONS,\n        }\napi.submit.register(PreapprovalResource())\n\nfrom ietf.group.resources import GroupResource\nfrom ietf.name.resources import DraftSubmissionStateNameResource\nfrom ietf.doc.resources import DocumentResource\nclass SubmissionResource(ModelResource):\n    state            = ToOneField(DraftSubmissionStateNameResource, 'state')\n    group            = ToOneField(GroupResource, 'group', null=True)\n    draft            = ToOneField(DocumentResource, 'draft', null=True)\n    checks           = ToManyField('ietf.submit.resources.SubmissionCheckResource', 'checks', null=True)\n    class Meta:\n        cache = SimpleCache()\n        queryset = Submission.objects.all()\n        serializer = api.Serializer()\n        #resource_name = 'submission'\n        ordering = ['id', ]\n        filtering = { \n            \"id\": ALL,\n            \"remote_ip\": ALL,\n            \"access_key\": ALL,\n            \"auth_key\": ALL,\n            \"name\": ALL,\n            \"title\": ALL,\n            \"abstract\": ALL,\n            \"rev\": ALL,\n            \"pages\": ALL,\n            \"authors\": ALL,\n            \"note\": ALL,\n            \"replaces\": ALL,\n            \"first_two_pages\": ALL,\n            \"file_types\": ALL,\n            \"file_size\": ALL,\n            \"document_date\": ALL,\n            \"submission_date\": ALL,\n            \"submitter\": ALL,\n            \"xml_version\": ALL,\n            \"state\": ALL_WITH_RELATIONS,\n            \"group\": ALL_WITH_RELATIONS,\n            \"draft\": ALL_WITH_RELATIONS,\n        }\n        excludes = ('first_two_pages',)\napi.submit.register(SubmissionResource())\n\nfrom ietf.person.resources import PersonResource\nclass SubmissionEventResource(ModelResource):\n    submission       = ToOneField(SubmissionResource, 'submission')\n    by               = ToOneField(PersonResource, 'by', null=True)\n    class Meta:\n        cache = SimpleCache()\n        queryset = SubmissionEvent.objects.all()\n        serializer = api.Serializer()\n        #resource_name = 'submissionevent'\n        ordering = ['id', ]\n        filtering = { \n            \"id\": ALL,\n            \"time\": ALL,\n            \"desc\": ALL,\n            \"submission\": ALL_WITH_RELATIONS,\n            \"by\": ALL_WITH_RELATIONS,\n        }\napi.submit.register(SubmissionEventResource())\n\nclass SubmissionCheckResource(ModelResource):\n    submission       = ToOneField(SubmissionResource, 'submission')\n    class Meta:\n        cache = SimpleCache()\n        queryset = SubmissionCheck.objects.all()\n        serializer = api.Serializer()\n        #resource_name = 'submissioncheck'\n        ordering = ['id', ]\n        filtering = { \n            \"id\": ALL,\n            \"time\": ALL,\n            \"checker\": ALL,\n            \"passed\": ALL,\n            \"message\": ALL,\n            \"errors\": ALL,\n            \"warnings\": ALL,\n            \"items\": ALL,\n            \"submission\": ALL_WITH_RELATIONS,\n        }\napi.submit.register(SubmissionCheckResource())\n\n\n\nfrom ietf.person.resources import PersonResource\nfrom ietf.message.resources import MessageResource\nclass SubmissionEmailEventResource(ModelResource):\n    submission       = ToOneField(SubmissionResource, 'submission')\n    by               = ToOneField(PersonResource, 'by', null=True)\n    submissionevent_ptr = ToOneField(SubmissionEventResource, 'submissionevent_ptr')\n    message          = ToOneField(MessageResource, 'message', null=True)\n    in_reply_to      = ToOneField(MessageResource, 'in_reply_to', null=True)\n    class Meta:\n        queryset = SubmissionEmailEvent.objects.all()\n        serializer = api.Serializer()\n        cache = SimpleCache()\n        #resource_name = 'submissionemailevent'\n        ordering = ['id', ]\n        filtering = { \n            \"id\": ALL,\n            \"time\": ALL,\n            \"desc\": ALL,\n            \"msgtype\": ALL,\n            \"submission\": ALL_WITH_RELATIONS,\n            \"by\": ALL_WITH_RELATIONS,\n            \"submissionevent_ptr\": ALL_WITH_RELATIONS,\n            \"message\": ALL_WITH_RELATIONS,\n            \"in_reply_to\": ALL_WITH_RELATIONS,\n        }\napi.submit.register(SubmissionEmailEventResource())\n\n\n\nfrom ietf.name.resources import ExtResourceNameResource\nclass SubmissionExtResourceResource(ModelResource):\n    name             = ToOneField(ExtResourceNameResource, 'name')\n    submission       = ToOneField(SubmissionResource, 'submission')\n    class Meta:\n        queryset = SubmissionExtResource.objects.all()\n        serializer = api.Serializer()\n        cache = SimpleCache()\n        resource_name = 'submissionextresource'\n        ordering = ['id', ]\n        filtering = { \n            \"id\": ALL,\n            \"display_name\": ALL,\n            \"value\": ALL,\n            \"name\": ALL_WITH_RELATIONS,\n            \"submission\": ALL_WITH_RELATIONS,\n        }\napi.submit.register(SubmissionExtResourceResource())\n", "path": "ietf/submit/resources.py"}]}