Skip to content

Commit 1389775

Browse files
committed
Added some missing migrations.
- Legacy-Id: 14696
1 parent 0b46cbb commit 1389775

4 files changed

Lines changed: 370 additions & 25 deletions

File tree

ietf/checks.py

Lines changed: 34 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -359,37 +359,46 @@ def maybe_patch_library(app_configs, **kwargs):
359359
django_path = os.path.dirname(django.__file__)
360360
library_path = os.path.dirname(django_path)
361361
saved_cwd = os.getcwd()
362-
os.chdir(library_path)
363362
# All patches in settings.CHECKS_LIBRARY_PATCHES_TO_APPLY must have a
364363
# relative file path rooted in the django dir, for instance
365364
# 'django/db/models/fields/__init__.py'
366365
for patch_file in settings.CHECKS_LIBRARY_PATCHES_TO_APPLY:
367-
patch_path = os.path.join(saved_cwd, patch_file)
368-
patch_set = patch.fromfile(patch_path)
369-
if not hasattr(patch_set, 'already_patched'):
370-
patch_set.already_patched = False
371-
if patch_set:
372-
applied = patch_set.apply()
373-
if not applied:
366+
try:
367+
patch_path = os.path.join(saved_cwd, patch_file)
368+
patch_set = patch.fromfile(patch_path)
369+
if not hasattr(patch_set, 'already_patched'):
370+
patch_set.already_patched = False
371+
if patch_set:
372+
os.chdir(library_path)
373+
applied = patch_set.apply()
374+
os.chdir(saved_cwd)
375+
if not applied:
376+
errors.append(checks.Warning(
377+
"Could not apply patch from file '%s'"%patch_file,
378+
hint="Make sure that the patch file contains a unified diff and has valid file paths",
379+
id="datatracker.W0002",
380+
))
381+
elif patch_set.already_patched:
382+
#for p in patch_set:
383+
# sys.stderr.write(" Already patched: %s\n" % p.target)
384+
pass
385+
else:
386+
for p in patch_set:
387+
sys.stderr.write(" Patched %s\n" % p.target)
388+
else:
374389
errors.append(checks.Warning(
375-
"Could not apply patch from file '%s'"%patch_file,
376-
hint="Make sure that the patch file contains a unified diff and has valid file paths",
377-
id="datatracker.W0002",
390+
"Could not parse patch file '%s'"%patch_file,
391+
hint="Make sure that the patch file contains a unified diff",
392+
id="datatracker.W0001",
378393
))
379-
elif patch_set.already_patched:
380-
#for p in patch_set:
381-
# sys.stderr.write(" Already patched: %s\n" % p.target)
382-
pass
383-
else:
384-
for p in patch_set:
385-
sys.stderr.write(" Patched %s\n" % p.target)
386-
else:
387-
errors.append(checks.Warning(
388-
"Could not parse patch file '%s'"%patch_file,
389-
hint="Make sure that the patch file contains a unified diff",
390-
id="datatracker.W0001",
391-
))
392-
os.chdir(saved_cwd)
394+
except IOError as e:
395+
errors.append(
396+
checks.Warning("Could not apply patch from %s: %s" % (patch_file, e),
397+
hint="Check file permissions and locations",
398+
id="datatracker.W0003",
399+
)
400+
)
401+
pass
393402
return errors
394403

395404
@checks.register('security')
Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
# -*- coding: utf-8 -*-
2+
# Generated by Django 1.11.10 on 2018-02-20 10:52
3+
from __future__ import unicode_literals
4+
5+
from django.conf import settings
6+
from django.db import migrations, models
7+
import django.db.models.deletion
8+
import ietf.utils.models
9+
10+
11+
class Migration(migrations.Migration):
12+
13+
initial = True
14+
15+
dependencies = [
16+
('doc', '0001_initial'),
17+
('group', '0001_initial'),
18+
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
19+
('community', '0001_initial'),
20+
('person', '0001_initial'),
21+
]
22+
23+
operations = [
24+
migrations.AddField(
25+
model_name='searchrule',
26+
name='group',
27+
field=ietf.utils.models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, to='group.Group'),
28+
),
29+
migrations.AddField(
30+
model_name='searchrule',
31+
name='name_contains_index',
32+
field=models.ManyToManyField(to='doc.Document'),
33+
),
34+
migrations.AddField(
35+
model_name='searchrule',
36+
name='person',
37+
field=ietf.utils.models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, to='person.Person'),
38+
),
39+
migrations.AddField(
40+
model_name='searchrule',
41+
name='state',
42+
field=ietf.utils.models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, to='doc.State'),
43+
),
44+
migrations.AddField(
45+
model_name='emailsubscription',
46+
name='community_list',
47+
field=ietf.utils.models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='community.CommunityList'),
48+
),
49+
migrations.AddField(
50+
model_name='emailsubscription',
51+
name='email',
52+
field=ietf.utils.models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='person.Email'),
53+
),
54+
migrations.AddField(
55+
model_name='communitylist',
56+
name='added_docs',
57+
field=models.ManyToManyField(to='doc.Document'),
58+
),
59+
migrations.AddField(
60+
model_name='communitylist',
61+
name='group',
62+
field=ietf.utils.models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, to='group.Group'),
63+
),
64+
migrations.AddField(
65+
model_name='communitylist',
66+
name='user',
67+
field=ietf.utils.models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL),
68+
),
69+
]
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
# -*- coding: utf-8 -*-
2+
# Generated by Django 1.11.10 on 2018-02-20 10:52
3+
from __future__ import unicode_literals
4+
5+
from django.db import migrations
6+
import django.db.models.deletion
7+
import ietf.utils.models
8+
9+
10+
class Migration(migrations.Migration):
11+
12+
initial = True
13+
14+
dependencies = [
15+
('group', '0001_initial'),
16+
('name', '0001_initial'),
17+
('dbtemplate', '0001_initial'),
18+
]
19+
20+
operations = [
21+
migrations.AddField(
22+
model_name='dbtemplate',
23+
name='group',
24+
field=ietf.utils.models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, to='group.Group'),
25+
),
26+
migrations.AddField(
27+
model_name='dbtemplate',
28+
name='type',
29+
field=ietf.utils.models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='name.DBTemplateTypeName'),
30+
),
31+
]

0 commit comments

Comments
 (0)