Skip to content
Closed

merger #10305

Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
72 commits
Select commit Hold shift + click to select a range
ea512e1
ci: merge main to release
jennifer-richards Oct 29, 2025
c47fe34
fix: include punctuation when tablesorting (#9855)
rjsparks Nov 3, 2025
87c3a9d
feat(agenda): Show calendar links to all the events (#9843)
kesara Nov 3, 2025
8da45cb
feat: optionally hide room-only schedule diffs (#9861)
jennifer-richards Nov 3, 2025
9546e15
fix: no autoescape for bluesheet template (#9858)
jennifer-richards Nov 3, 2025
7b4035d
fix: Change add period button to save new period. (#9847)
kivinen Nov 3, 2025
1ba6397
fix: ask google not to index noscript content (#9844)
holloway Nov 3, 2025
8d876c0
feat: remove restrictions on sending incoming liaisons (#9859)
rjsparks Nov 3, 2025
a383694
feat(meetings): Use "Decline and Delete" for slide disapprovals (#9842)
Spectre17 Nov 3, 2025
3c12880
feat: Add tab for IESG view of working groups (#9841)
russhousley Nov 5, 2025
d796aa0
chore: remove OBE test (#9885)
rjsparks Nov 5, 2025
2ac6106
feat: show available sdo groups to liaison coordinators and managers …
rjsparks Nov 6, 2025
ce91feb
fix: onclick disable submit button (#9878)
Nov 7, 2025
bd6a160
fix: add most recent ballot hint to History tab. (#9851)
russhousley Nov 7, 2025
1249ace
feat: add OpenTelemetry integration (#9886)
NGPixel Nov 7, 2025
de08e5f
fix: Milestones date sorting out of order (#9868)
evyncke Nov 7, 2025
c8cf9e1
refactor: use ical for important-dates (#9849)
rudimatz Nov 7, 2025
2ea08c6
Sort ADs by full name (#9839)
evyncke Nov 7, 2025
bc4752d
fix: AD order in IESG ballots (and other places) does not handle UTF-…
evyncke Nov 7, 2025
c430925
fix: add resolver records when importing minutes (#9907)
rjsparks Nov 9, 2025
d252e85
chore(deps): bump actions/setup-node from 4 to 6 (#9758)
dependabot[bot] Nov 11, 2025
3f6addc
fix: link to sdo group page from other sdo list (#9920)
rjsparks Nov 12, 2025
8cabf4d
fix(dev): Disable python terminal integration as it corrupts the term…
rjsparks Nov 12, 2025
7b3e30b
ci: merge release to main (#9927)
rjsparks Nov 13, 2025
92f23c0
fix: adjust test for other sdo list page (#9929)
rjsparks Nov 13, 2025
ff75680
ci: merge main to release (#9930)
rjsparks Nov 13, 2025
9244e61
ci(staging): Increase wait-for-completion timeout to 60 minutes
NGPixel Nov 14, 2025
7006770
refactor: use ical for upcoming meetings (#9845)
rudimatz Nov 18, 2025
33c0a89
test: fix selenium selector syntax (#9963)
rjsparks Nov 18, 2025
0dd84be
fix: recognize Editorial Stream in queue2.xml (#9965)
jennifer-richards Nov 18, 2025
a007f50
fix(dev): remove deprecated ext (#9966)
rudimatz Nov 18, 2025
c79b35d
fix: make chatlog readable in dark mode (#9995)
Nov 25, 2025
3afa3d0
ci: enable restoreToLastFullSnapshot for staging db deploy
NGPixel Nov 26, 2025
03e8477
chore: drop apt-key + old pg utilities (#10029)
jennifer-richards Dec 1, 2025
47c15df
fix: render polls correctly in darkmode (#10027)
Dec 1, 2025
9d10995
ci: update base image target version to 20251201T1548
jennifer-richards Dec 1, 2025
ef4e095
fix: adjust patch for Django 4.2.27 (#10045)
jennifer-richards Dec 2, 2025
9a4ad72
fix: adjust datepicker css in darkmode (#10095)
Dec 15, 2025
e775af3
feat: editable wglc messages (#9607) (#9616)
rjsparks Dec 16, 2025
fb50ac0
chore: optional opentelemetry (#10112)
jennifer-richards Dec 16, 2025
58430db
refactor: no delete from inline admins (#10113)
jennifer-richards Dec 16, 2025
4f0102d
fix: remove redundant options (#10117)
jennifer-richards Dec 16, 2025
2950641
ci: merge release to main (#10122)
rjsparks Dec 17, 2025
c0115c9
ci: merge main to release (#10123)
rjsparks Dec 17, 2025
4f1d800
Merge pull request #10135 from OR13/patch-1
OR13 Dec 19, 2025
7f56667
feat: move base containers to trixie (#9535) (#10127)
rjsparks Dec 19, 2025
e510c8e
ci: update base image target version to 20251219T1815
rjsparks Dec 19, 2025
6ee56b5
fix: adjust rendering of agenda sesh pop-up on mobile (#10134)
Dec 19, 2025
3565d84
fix: revert "feat: move base containers to trixie (#9535) (#10127)" (…
rjsparks Dec 19, 2025
c85ebbf
ci: update base image target version to 20251219T2152
rjsparks Dec 19, 2025
3b07c70
feat: provide link to detailed submission status page for submission …
Jan 9, 2026
967fffa
fix: f-strings for replicator log msgs (#10234)
jennifer-richards Jan 9, 2026
79cb013
chore: squelch pyparsing deprecation warnings (#10239)
jennifer-richards Jan 9, 2026
d06001f
feat: RPC modernization APIs (#9631)
jennifer-richards Jan 14, 2026
c845aa7
ci: update base image target version to 20260114T1756
rjsparks Jan 14, 2026
463a554
ci: merge release to main (#10261)
rjsparks Jan 15, 2026
31b3b82
ci: merge main to release (#10262)
rjsparks Jan 15, 2026
c1e8eb6
ci: Increase wait-for-completion timeouts in build.yml
NGPixel Jan 15, 2026
ac2fced
fix: remove notice from bofreq template (#10265)
jennifer-richards Jan 15, 2026
4fa7757
ci: merge release to main (#10266)
rjsparks Jan 15, 2026
b152dac
ci: merge main to release (#10267)
rjsparks Jan 15, 2026
0b6e887
test: more robust URL coverage; improve badly formed test (#10270)
jennifer-richards Jan 16, 2026
0e9e18e
chore: suppress expected warnings (#10272)
jennifer-richards Jan 16, 2026
337a231
feat: rsync rfc content, store in blob, rebuild references (#10255)
rjsparks Jan 16, 2026
37888b3
feat: store blobs+set mtime in RFC publish API (#10260)
jennifer-richards Jan 16, 2026
4aeb36e
chore: order is_auth'd middleware correctly (#10225)
jennifer-richards Jan 16, 2026
3ff0154
feat: include tickets in RegistrationResource (#10223)
jennifer-richards Jan 16, 2026
d53ceff
chore(dev): adjust dev settings for RFC file upload (#10287)
jennifer-richards Jan 21, 2026
50653e9
fix: add Blob.__str__() (#10284)
jennifer-richards Jan 21, 2026
4ff4805
fix: restrict rfc bulkload to those with a Document object (#10289)
rjsparks Jan 21, 2026
a28594e
feat: add option to email users about duplicate accounts. Fixes #8174…
rpcross Jan 21, 2026
ed209d2
ci: merge release to main (#10302)
rjsparks Jan 21, 2026
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
1 change: 0 additions & 1 deletion .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@
"oderwat.indent-rainbow",
"redhat.vscode-yaml",
"spmeesseman.vscode-taskexplorer",
"visualstudioexptteam.vscodeintellicode",
"ms-python.pylint",
"charliermarsh.ruff"
],
Expand Down
8 changes: 4 additions & 4 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,7 @@ jobs:
fetch-tags: false

- name: Setup Node.js environment
uses: actions/setup-node@v4
uses: actions/setup-node@v6
with:
node-version: 18.x

Expand Down Expand Up @@ -426,7 +426,7 @@ jobs:
token: ${{ secrets.GH_INFRA_K8S_TOKEN }}
inputs: '{ "app":"datatracker", "appVersion":"${{ env.PKG_VERSION }}", "remoteRef":"${{ github.sha }}", "namespace":"${{ env.DEPLOY_NAMESPACE }}", "disableDailyDbRefresh":${{ inputs.devNoDbRefresh }} }'
wait-for-completion: true
wait-for-completion-timeout: 30m
wait-for-completion-timeout: 60m
wait-for-completion-interval: 30s
display-workflow-run-url: false

Expand All @@ -451,9 +451,9 @@ jobs:
repo: ietf-tools/infra-k8s
ref: main
token: ${{ secrets.GH_INFRA_K8S_TOKEN }}
inputs: '{ "environment":"${{ secrets.GHA_K8S_CLUSTER }}", "app":"datatracker", "manifest":"postgres", "forceRecreate":true, "waitClusterReady":true }'
inputs: '{ "environment":"${{ secrets.GHA_K8S_CLUSTER }}", "app":"datatracker", "manifest":"postgres", "forceRecreate":true, "restoreToLastFullSnapshot":true, "waitClusterReady":true }'
wait-for-completion: true
wait-for-completion-timeout: 30m
wait-for-completion-timeout: 120m
wait-for-completion-interval: 20s
display-workflow-run-url: false

Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ jobs:
steps:
- uses: actions/checkout@v4

- uses: actions/setup-node@v4
- uses: actions/setup-node@v6
with:
node-version: '18'

Expand Down
3 changes: 2 additions & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -56,5 +56,6 @@
"python.linting.pylintArgs": ["--load-plugins", "pylint_django"],
"python.testing.pytestEnabled": false,
"python.testing.unittestEnabled": false,
"python.linting.enabled": true
"python.linting.enabled": true,
"python.terminal.shellIntegration.enabled": false
}
25 changes: 25 additions & 0 deletions client/agenda/AgendaDetailsModal.vue
Original file line number Diff line number Diff line change
Expand Up @@ -274,6 +274,7 @@ async function fetchSessionMaterials () {
<style lang="scss">
@import "bootstrap/scss/functions";
@import "bootstrap/scss/variables";
@import "../shared/breakpoints";

.agenda-eventdetails {
width: 90vw;
Expand Down Expand Up @@ -403,5 +404,29 @@ async function fetchSessionMaterials () {
font-size: 16px;
}
}

.n-card-header {
@media screen and (max-width: $bs5-break-sm) {
display: block;
padding: 1em;
}
}

.n-card__content {
@media screen and (max-width: $bs5-break-sm) {
padding: 1em;

.detail-title {
display: block;
}

.nav-link,
.nav-link.active {
display: grid;
width: 1em;
border-width: 1em;
}
}
}
}
</style>
20 changes: 10 additions & 10 deletions client/agenda/AgendaScheduleList.vue
Original file line number Diff line number Diff line change
Expand Up @@ -398,16 +398,6 @@ const meetingEvents = computed(() => {
color: 'teal'
})
}
// -> Calendar item
if (item.links.calendar) {
links.push({
id: `lnk-${item.id}-calendar`,
label: 'Calendar (.ics) entry for this session',
icon: 'calendar-check',
href: item.links.calendar,
color: 'pink'
})
}
} else {
// -> Post event
if (meetingNumberInt >= 60) {
Expand Down Expand Up @@ -484,6 +474,16 @@ const meetingEvents = computed(() => {
}
}
}
// Add Calendar item for all events that has a calendar link
if (item.adjustedEnd > current && item.links.calendar) {
links.push({
id: `lnk-${item.id}-calendar`,
label: 'Calendar (.ics) entry for this session',
icon: 'calendar-check',
href: item.links.calendar,
color: 'pink'
})
}

// Event icon
let icon = null
Expand Down
14 changes: 14 additions & 0 deletions client/components/ChatLog.vue
Original file line number Diff line number Diff line change
Expand Up @@ -159,4 +159,18 @@ onMounted(() => {
}
}
}

[data-bs-theme="dark"] .chatlog {
.n-timeline-item-content__title {
color: #d63384 !important;
}

.n-timeline-item-content__content {
color: #fff !important;
}

.n-timeline-item-content__meta {
color: #0569ffd9 !important;
}
}
</style>
18 changes: 18 additions & 0 deletions client/components/Polls.vue
Original file line number Diff line number Diff line change
Expand Up @@ -90,3 +90,21 @@ onMounted(() => {
})
</script>

<style lang="scss">
@import '../shared/colors.scss';

[data-bs-theme="dark"] .polls {
tr,
th,
td {
background-color: $gray-900 !important;
color: $gray-300 !important;
border-color: $gray-500 !important;
border-width: 0.05 !important;
}

td:hover {
background-color: $cyan-600 !important;
}
}
</style>
2 changes: 1 addition & 1 deletion dev/build/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM ghcr.io/ietf-tools/datatracker-app-base:20250903T2216
FROM ghcr.io/ietf-tools/datatracker-app-base:20260114T1756
LABEL maintainer="IETF Tools Team <tools-discuss@ietf.org>"

ENV DEBIAN_FRONTEND=noninteractive
Expand Down
2 changes: 1 addition & 1 deletion dev/build/TARGET_BASE
Original file line number Diff line number Diff line change
@@ -1 +1 @@
20250903T2216
20260114T1756
45 changes: 44 additions & 1 deletion dev/build/gunicorn.conf.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,16 @@
# Copyright The IETF Trust 2024, All Rights Reserved
# Copyright The IETF Trust 2024-2025, All Rights Reserved

import os
import ietf
from opentelemetry import trace
from opentelemetry.exporter.otlp.proto.http.trace_exporter import OTLPSpanExporter
from opentelemetry.sdk.resources import Resource
from opentelemetry.sdk.trace import TracerProvider
from opentelemetry.sdk.trace.export import BatchSpanProcessor
from opentelemetry.instrumentation.django import DjangoInstrumentor
from opentelemetry.instrumentation.psycopg2 import Psycopg2Instrumentor
from opentelemetry.instrumentation.pymemcache import PymemcacheInstrumentor
from opentelemetry.instrumentation.requests import RequestsInstrumentor

# Configure security scheme headers for forwarded requests. Cloudflare sets X-Forwarded-Proto
# for us. Don't trust any of the other similar headers. Only trust the header if it's coming
Expand Down Expand Up @@ -119,3 +131,34 @@ def post_request(worker, req, environ, resp):
in_flight = in_flight_by_pid.get(worker.pid, [])
if request_description in in_flight:
in_flight.remove(request_description)

def post_fork(server, worker):
server.log.info("Worker spawned (pid: %s)", worker.pid)

# Setting DATATRACKER_OPENTELEMETRY_ENABLE=all in the environment will enable all
# opentelemetry instrumentations. Individual instrumentations can be selected by
# using a space-separated list. See the code below for available instrumentations.
telemetry_env = os.environ.get("DATATRACKER_OPENTELEMETRY_ENABLE", "").strip()
if telemetry_env != "":
enabled_telemetry = [tok.strip().lower() for tok in telemetry_env.split()]
resource = Resource.create(attributes={
"service.name": "datatracker",
"service.version": ietf.__version__,
"service.instance.id": worker.pid,
"service.namespace": "datatracker",
"deployment.environment.name": os.environ.get("DATATRACKER_SERVICE_ENV", "dev")
})
trace.set_tracer_provider(TracerProvider(resource=resource))
otlp_exporter = OTLPSpanExporter(endpoint="https://heimdall-otlp.ietf.org/v1/traces")

trace.get_tracer_provider().add_span_processor(BatchSpanProcessor(otlp_exporter))

# Instrumentations
if "all" in enabled_telemetry or "django" in enabled_telemetry:
DjangoInstrumentor().instrument()
if "all" in enabled_telemetry or "psycopg2" in enabled_telemetry:
Psycopg2Instrumentor().instrument()
if "all" in enabled_telemetry or "pymemcache" in enabled_telemetry:
PymemcacheInstrumentor().instrument()
if "all" in enabled_telemetry or "requests" in enabled_telemetry:
RequestsInstrumentor().instrument()
8 changes: 6 additions & 2 deletions dev/build/migration-start.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,11 @@
echo "Running Datatracker migrations..."
./ietf/manage.py migrate --settings=settings_local

echo "Running Blobdb migrations ..."
./ietf/manage.py migrate --settings=settings_local --database=blobdb
# Check whether the blobdb database exists - inspectdb will return a false
# status if not.
if ./ietf/manage.py inspectdb --database blobdb > /dev/null 2>&1; then
echo "Running Blobdb migrations ..."
./ietf/manage.py migrate --settings=settings_local --database=blobdb
fi

echo "Done!"
6 changes: 3 additions & 3 deletions dev/deploy-to-container/settings_local.py
Original file line number Diff line number Diff line change
Expand Up @@ -71,11 +71,11 @@

DE_GFM_BINARY = '/usr/local/bin/de-gfm'

# No real secrets here, these are public testing values _only_
APP_API_TOKENS = {
"ietf.api.views.ingest_email_test": ["ingestion-test-token"]
"ietf.api.red_api" : ["devtoken", "redtoken"], # Not a real secret
"ietf.api.views.ingest_email_test": ["ingestion-test-token"], # Not a real secret
"ietf.api.views_rpc" : ["devtoken"], # Not a real secret
}


# OIDC configuration
SITE_URL = 'https://__HOSTNAME__'
5 changes: 0 additions & 5 deletions docker/app.Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,7 @@ ARG USER_GID=$USER_UID
COPY docker/scripts/app-setup-debian.sh /tmp/library-scripts/docker-setup-debian.sh
RUN sed -i 's/\r$//' /tmp/library-scripts/docker-setup-debian.sh && chmod +x /tmp/library-scripts/docker-setup-debian.sh

# Add Postgresql Apt Repository to get 14
RUN echo "deb http://apt.postgresql.org/pub/repos/apt $(. /etc/os-release && echo "$VERSION_CODENAME")-pgdg main" | tee /etc/apt/sources.list.d/pgdg.list
RUN wget --quiet -O - https://www.postgresql.org/media/keys/ACCC4CF8.asc | apt-key add -

RUN apt-get update && export DEBIAN_FRONTEND=noninteractive \
&& apt-get install -y --no-install-recommends postgresql-client-14 pgloader \
# Remove imagemagick due to https://security-tracker.debian.org/tracker/CVE-2019-10131
&& apt-get purge -y imagemagick imagemagick-6-common \
# Install common packages, non-root user
Expand Down
27 changes: 14 additions & 13 deletions docker/base.Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -11,21 +11,22 @@ RUN apt-get update \

# Add Node.js Source
RUN apt-get install -y --no-install-recommends ca-certificates curl gnupg \
&& mkdir -p /etc/apt/keyrings\
&& curl -fsSL https://deb.nodesource.com/gpgkey/nodesource-repo.gpg.key | gpg --dearmor -o /etc/apt/keyrings/nodesource.gpg
RUN echo "deb [signed-by=/etc/apt/keyrings/nodesource.gpg] https://deb.nodesource.com/node_$NODE_MAJOR.x nodistro main" | tee /etc/apt/sources.list.d/nodesource.list
RUN echo "Package: nodejs" >> /etc/apt/preferences.d/preferences && \
echo "Pin: origin deb.nodesource.com" >> /etc/apt/preferences.d/preferences && \
echo "Pin-Priority: 1001" >> /etc/apt/preferences.d/preferences
&& mkdir -p /etc/apt/keyrings \
&& curl -fsSL https://deb.nodesource.com/gpgkey/nodesource-repo.gpg.key | gpg --dearmor -o /etc/apt/keyrings/nodesource.gpg \
&& echo "deb [signed-by=/etc/apt/keyrings/nodesource.gpg] https://deb.nodesource.com/node_$NODE_MAJOR.x nodistro main" | tee /etc/apt/sources.list.d/nodesource.list
RUN echo "Package: nodejs" >> /etc/apt/preferences.d/preferences \
&& echo "Pin: origin deb.nodesource.com" >> /etc/apt/preferences.d/preferences \
&& echo "Pin-Priority: 1001" >> /etc/apt/preferences.d/preferences

# Add Docker Source
RUN curl -fsSL https://download.docker.com/linux/debian/gpg | gpg --dearmor -o /usr/share/keyrings/docker-archive-keyring.gpg
RUN echo "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/docker-archive-keyring.gpg] https://download.docker.com/linux/debian \
$(. /etc/os-release && echo "$VERSION_CODENAME") stable" | tee /etc/apt/sources.list.d/docker.list > /dev/null

# Add PostgreSQL Source
RUN echo "deb http://apt.postgresql.org/pub/repos/apt $(. /etc/os-release && echo "$VERSION_CODENAME")-pgdg main" | tee /etc/apt/sources.list.d/pgdg.list
RUN wget --quiet -O - https://www.postgresql.org/media/keys/ACCC4CF8.asc | apt-key add -
RUN mkdir -p /etc/apt/keyrings \
&& curl -fsSL https://download.docker.com/linux/debian/gpg | gpg --dearmor -o /etc/apt/keyrings/docker-archive-keyring.gpg \
&& echo "deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker-archive-keyring.gpg] https://download.docker.com/linux/debian $(. /etc/os-release && echo "$VERSION_CODENAME") stable" | tee /etc/apt/sources.list.d/docker.list

# Add PostgreSQL Source
RUN mkdir -p /etc/apt/keyrings \
&& curl -fsSL https://www.postgresql.org/media/keys/ACCC4CF8.asc | gpg --dearmor -o /etc/apt/keyrings/apt.postgresql.org.gpg \
&& echo "deb [signed-by=/etc/apt/keyrings/apt.postgresql.org.gpg] https://apt.postgresql.org/pub/repos/apt $(. /etc/os-release && echo "$VERSION_CODENAME")-pgdg main" | tee /etc/apt/sources.list.d/pgdg.list

# Install the packages we need
RUN apt-get update --fix-missing && apt-get install -qy --no-install-recommends \
Expand Down
5 changes: 0 additions & 5 deletions docker/celery.Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,7 @@ ARG USER_GID=$USER_UID
COPY docker/scripts/app-setup-debian.sh /tmp/library-scripts/docker-setup-debian.sh
RUN sed -i 's/\r$//' /tmp/library-scripts/docker-setup-debian.sh && chmod +x /tmp/library-scripts/docker-setup-debian.sh

# Add Postgresql Apt Repository to get 14
RUN echo "deb http://apt.postgresql.org/pub/repos/apt $(. /etc/os-release && echo "$VERSION_CODENAME")-pgdg main" | tee /etc/apt/sources.list.d/pgdg.list
RUN wget --quiet -O - https://www.postgresql.org/media/keys/ACCC4CF8.asc | apt-key add -

RUN apt-get update && export DEBIAN_FRONTEND=noninteractive \
&& apt-get install -y --no-install-recommends postgresql-client-14 pgloader \
# Remove imagemagick due to https://security-tracker.debian.org/tracker/CVE-2019-10131
&& apt-get purge -y imagemagick imagemagick-6-common \
# Install common packages, non-root user
Expand Down
1 change: 1 addition & 0 deletions docker/configs/nginx-proxy.conf
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ server {

proxy_read_timeout 1d;
proxy_send_timeout 1d;
client_max_body_size 0; # disable checking

root /var/www/html;
index index.html index.htm index.nginx-debian.html;
Expand Down
5 changes: 5 additions & 0 deletions docker/configs/settings_local.py
Original file line number Diff line number Diff line change
Expand Up @@ -100,3 +100,8 @@
bucket_name=f"{storagename}",
),
}

APP_API_TOKENS = {
"ietf.api.red_api" : ["devtoken", "redtoken"], # Not a real secret
"ietf.api.views_rpc" : ["devtoken"], # Not a real secret
}
25 changes: 20 additions & 5 deletions ietf/api/routers.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,29 @@
from django.core.exceptions import ImproperlyConfigured
from rest_framework import routers

class PrefixedSimpleRouter(routers.SimpleRouter):
"""SimpleRouter that adds a dot-separated prefix to its basename"""

class PrefixedBasenameMixin:
"""Mixin to add a prefix to the basename of a rest_framework BaseRouter"""
def __init__(self, name_prefix="", *args, **kwargs):
self.name_prefix = name_prefix
if len(self.name_prefix) == 0 or self.name_prefix[-1] == ".":
raise ImproperlyConfigured("Cannot use a name_prefix that is empty or ends with '.'")
super().__init__(*args, **kwargs)

def get_default_basename(self, viewset):
basename = super().get_default_basename(viewset)
return f"{self.name_prefix}.{basename}"
def register(self, prefix, viewset, basename=None):
# Get the superclass "register" method from the class this is mixed-in with.
# This avoids typing issues with calling super().register() directly in a
# mixin class.
super_register = getattr(super(), "register")
if not super_register or not callable(super_register):
raise TypeError("Must mixin with superclass that has register() method")
super_register(prefix, viewset, basename=f"{self.name_prefix}.{basename}")


class PrefixedSimpleRouter(PrefixedBasenameMixin, routers.SimpleRouter):
"""SimpleRouter that adds a dot-separated prefix to its basename"""


class PrefixedDefaultRouter(PrefixedBasenameMixin, routers.DefaultRouter):
"""DefaultRouter that adds a dot-separated prefix to its basename"""

Loading