Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions bin/daily
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,8 @@ $DTDIR/ietf/manage.py update_external_command_info
rsync -avzq --delete /a/www/ietf-ftp/iana/yang-parameters/ /a/www/ietf-ftp/yang/ianamod/

# Get Yang models from Yangcatalog.
rsync -avzq rsync://rsync.yangcatalog.org:10873/yangdeps /a/www/ietf-ftp/yang/catalogmod/
#rsync -avzq rsync://rsync.yangcatalog.org:10873/yangdeps /a/www/ietf-ftp/yang/catalogmod/
/a/www/ietf-datatracker/scripts/sync_to_yangcatalog

# Populate the yang repositories
$DTDIR/ietf/manage.py populate_yang_model_dirs -v0
Expand All @@ -56,7 +57,7 @@ $DTDIR/ietf/bin/expire-last-calls
# Run an extended version of the rfc editor update, to catch changes
# with backdated timestamps
# Enable when removed from /a/www/ietf-datatracker/scripts/Cron-runner:
$DTDIR/ietf/bin/rfc-editor-index-updates -d 1969-01-01
$DTDIR/ietf/bin/rfc-editor-index-updates -d 1969-01-01

# Fetch meeting attendance data from ietf.org/registration/attendees
$DTDIR/ietf/manage.py fetch_meeting_attendance --latest 2
Expand Down
2 changes: 1 addition & 1 deletion ietf/api/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ def get(self, request):
'sendqueue', 'nominee', 'topicfeedbacklastseen', 'alias', 'email', 'apikeys', 'personevent',
'reviewersettings', 'reviewsecretarysettings', 'unavailableperiod', 'reviewwish',
'nextreviewerinteam', 'reviewrequest', 'meetingregistration', 'submissionevent', 'preapproval',
'user', 'user__communitylist', 'personextresource_set', ]
'user', 'communitylist', 'personextresource_set', ]


return self.json_view(request, filter={'id':person.id}, expand=expand)
Expand Down
20 changes: 0 additions & 20 deletions ietf/checks.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,26 +28,6 @@ def already_ran():
checks_run.append(name)
return False

@checks.register('directories')
def check_cdn_directory_exists(app_configs, **kwargs):
"""This checks that the path from which the CDN will serve static files for
this version of the datatracker actually exists. In development and test
mode STATIC_ROOT will normally be just static/, but in production it will be
set to a different part of the file system which is served via CDN, and the
path will contain the datatracker release version.
"""
if already_ran():
return []
#
errors = []
if settings.SERVER_MODE == 'production' and not os.path.exists(settings.STATIC_ROOT):
errors.append(checks.Error(
"The static files directory has not been set up.",
hint="Please run 'ietf/manage.py collectstatic'.",
obj=None,
id='datatracker.E001',
))
return errors

@checks.register('files')
def check_group_email_aliases_exists(app_configs, **kwargs):
Expand Down
4 changes: 2 additions & 2 deletions ietf/community/admin.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@
from ietf.community.models import CommunityList, SearchRule, EmailSubscription

class CommunityListAdmin(admin.ModelAdmin):
list_display = ['id', 'user', 'group']
raw_id_fields = ['user', 'group', 'added_docs']
list_display = ['id', 'person', 'group']
raw_id_fields = ['person', 'group', 'added_docs']
admin.site.register(CommunityList, CommunityListAdmin)

class SearchRuleAdmin(admin.ModelAdmin):
Expand Down
5 changes: 2 additions & 3 deletions ietf/community/forms.py
Original file line number Diff line number Diff line change
Expand Up @@ -114,14 +114,13 @@ def clean_text(self):


class SubscriptionForm(forms.ModelForm):
def __init__(self, user, clist, *args, **kwargs):
def __init__(self, person, clist, *args, **kwargs):
self.clist = clist
self.user = user

super(SubscriptionForm, self).__init__(*args, **kwargs)

self.fields["notify_on"].widget = forms.RadioSelect(choices=self.fields["notify_on"].choices)
self.fields["email"].queryset = self.fields["email"].queryset.filter(person__user=user, active=True).order_by("-primary")
self.fields["email"].queryset = self.fields["email"].queryset.filter(person=person, active=True).order_by("-primary")
self.fields["email"].widget = forms.RadioSelect(choices=[t for t in self.fields["email"].choices if t[0]])

if self.fields["email"].queryset:
Expand Down
26 changes: 26 additions & 0 deletions ietf/community/migrations/0004_delete_useless_community_lists.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
# Generated by Django 4.2.9 on 2024-01-05 21:28

from django.db import migrations


def forward(apps, schema_editor):
CommunityList = apps.get_model("community", "CommunityList")
# As of 2024-01-05, there are 570 personal CommunityLists with a user
# who has no associated Person. None of these has an EmailSubscription,
# so the lists are doing nothing and can be safely deleted.
personal_lists_no_person = CommunityList.objects.exclude(
user__isnull=True
).filter(
user__person__isnull=True
)
# Confirm the assumption that none of the lists to be deleted has an EmailSubscription
assert not personal_lists_no_person.filter(emailsubscription__isnull=False).exists()
personal_lists_no_person.delete()


class Migration(migrations.Migration):
dependencies = [
("community", "0003_track_rfcs"),
]

operations = [migrations.RunPython(forward)]
54 changes: 54 additions & 0 deletions ietf/community/migrations/0005_user_to_person.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
# Generated by Django 4.2.2 on 2023-06-12 19:35

from django.conf import settings
from django.db import migrations
import django.db.models.deletion
import ietf.utils.models


def forward(apps, schema_editor):
CommunityList = apps.get_model('community', 'CommunityList')
for clist in CommunityList.objects.all():
try:
clist.person = clist.user.person
except:
clist.person = None
clist.save()

def reverse(apps, schema_editor):
CommunityList = apps.get_model('community', 'CommunityList')
for clist in CommunityList.objects.all():
try:
clist.user = clist.person.user
except:
clist.user = None
clist.save()

class Migration(migrations.Migration):
dependencies = [
("community", "0004_delete_useless_community_lists"),
("person", "0001_initial"),
]

operations = [
migrations.AddField(
model_name="communitylist",
name="person",
field=ietf.utils.models.ForeignKey(
blank=True,
null=True,
on_delete=django.db.models.deletion.CASCADE,
to="person.Person",
),
),
migrations.RunPython(forward, reverse),
migrations.RemoveField(
model_name="communitylist",
name="user",
field=ietf.utils.models.ForeignKey(
blank=True,
null=True,
on_delete=django.db.models.deletion.CASCADE,
to=settings.AUTH_USER_MODEL),
),
]
11 changes: 5 additions & 6 deletions ietf/community/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
# -*- coding: utf-8 -*-


from django.contrib.auth.models import User
from django.db import models
from django.db.models import signals
from django.urls import reverse as urlreverse
Expand All @@ -13,13 +12,13 @@
from ietf.utils.models import ForeignKey

class CommunityList(models.Model):
user = ForeignKey(User, blank=True, null=True)
person = ForeignKey(Person, blank=True, null=True)
group = ForeignKey(Group, blank=True, null=True)
added_docs = models.ManyToManyField(Document)

def long_name(self):
if self.user:
return 'Personal I-D list of %s' % self.user.username
if self.person:
return 'Personal I-D list of %s' % self.person.plain_name()
elif self.group:
return 'I-D list for %s' % self.group.name
else:
Expand All @@ -30,8 +29,8 @@ def __str__(self):

def get_absolute_url(self):
import ietf.community.views
if self.user:
return urlreverse(ietf.community.views.view_list, kwargs={ 'username': self.user.username })
if self.person:
return urlreverse(ietf.community.views.view_list, kwargs={ 'email_or_name': self.person.email() })
elif self.group:
return urlreverse("ietf.group.views.group_documents", kwargs={ 'acronym': self.group.acronym })
return ""
Expand Down
Loading