Skip to content

Commit bbf088e

Browse files
committed
Hopefully the final check-ins.
- Legacy-Id: 19909
1 parent ed30521 commit bbf088e

File tree

495 files changed

+858
-1304
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

495 files changed

+858
-1304
lines changed

docker/configs/settings_local.py

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@
4141
TRAC_WIKI_DIR_PATTERN = "test/wiki/%s"
4242
TRAC_SVN_DIR_PATTERN = "test/svn/%s"
4343

44-
MEDIA_BASE_DIR = 'test'
44+
MEDIA_BASE_DIR = 'data/developers'
4545
MEDIA_ROOT = MEDIA_BASE_DIR + '/media/'
4646
MEDIA_URL = '/media/'
4747

@@ -59,4 +59,20 @@
5959
# Set INTERNAL_IPS for use within Docker. See https://knasmueller.net/fix-djangos-debug-toolbar-not-showing-inside-docker
6060
import socket
6161
hostname, _, ips = socket.gethostbyname_ex(socket.gethostname())
62-
INTERNAL_IPS = [".".join(ip.split(".")[:-1] + ["1"]) for ip in ips]
62+
INTERNAL_IPS = [".".join(ip.split(".")[:-1] + ["1"]) for ip in ips]
63+
64+
# DEV_TEMPLATE_CONTEXT_PROCESSORS = [
65+
# 'ietf.context_processors.sql_debug',
66+
# ]
67+
68+
DOCUMENT_PATH_PATTERN = 'data/developers/ietf-ftp/{doc.type_id}/'
69+
INTERNET_DRAFT_PATH = 'data/developers/ietf-ftp/internet-drafts/'
70+
CHARTER_PATH = 'data/developers/ietf-ftp/charter/'
71+
BOFREQ_PATH = 'data/developers/ietf-ftp/bofreq/'
72+
CONFLICT_REVIEW_PATH = 'data/developers/ietf-ftp/conflict-reviews/'
73+
STATUS_CHANGE_PATH = 'data/developers/ietf-ftp/status-changes/'
74+
INTERNET_DRAFT_ARCHIVE_DIR = 'data/developers/ietf-ftp/internet-drafts/'
75+
INTERNET_ALL_DRAFTS_ARCHIVE_DIR = 'data/developers/ietf-ftp/internet-drafts/'
76+
77+
NOMCOM_PUBLIC_KEYS_DIR = 'data/nomcom_keys/public_keys/'
78+
SLIDE_STAGING_PATH = 'test/staging/'

ietf/doc/fields.py

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,15 +17,16 @@
1717
from ietf.doc.utils import uppercase_std_abbreviated_name
1818
from ietf.utils.fields import SearchableField
1919

20-
def select2_id_doc_name(objs):
20+
def select2_id_doc_name(model, objs):
2121
return [{
2222
"id": o.pk,
23+
"url": o.get_absolute_url() if model == Document else o.document.get_absolute_url(),
2324
"text": escape(uppercase_std_abbreviated_name(o.name)),
2425
} for o in objs] if objs else []
2526

2627

27-
def select2_id_doc_name_json(objs):
28-
return json.dumps(select2_id_doc_name(objs))
28+
def select2_id_doc_name_json(model, objs):
29+
return json.dumps(select2_id_doc_name(model, objs))
2930

3031

3132
class SearchableDocumentsField(SearchableField):
@@ -55,7 +56,7 @@ def get_model_instances(self, item_ids):
5556

5657
def make_select2_data(self, model_instances):
5758
"""Get select2 data items"""
58-
return select2_id_doc_name(model_instances)
59+
return select2_id_doc_name(self.model, model_instances)
5960

6061
def ajax_url(self):
6162
"""Get the URL for AJAX searches"""

ietf/doc/templatetags/ietf_filters.py

Lines changed: 17 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -226,23 +226,30 @@ def urlize_ietf_docs(string, autoescape=None):
226226
"""
227227
if autoescape and not isinstance(string, SafeData):
228228
string = escape(string)
229-
string = re.sub(r"(?<!>)(RFC\s*?)0{0,3}(\d+)", "<a href=\"/doc/rfc\\2/\">\\1\\2</a>", string, flags=re.IGNORECASE)
230-
string = re.sub(r"(?<!>)(BCP\s*?)0{0,3}(\d+)", "<a href=\"/doc/bcp\\2/\">\\1\\2</a>", string, flags=re.IGNORECASE)
231-
string = re.sub(r"(?<!>)(STD\s*?)0{0,3}(\d+)", "<a href=\"/doc/std\\2/\">\\1\\2</a>", string, flags=re.IGNORECASE)
232-
string = re.sub(r"(?<!>)(FYI\s*?)0{0,3}(\d+)", "<a href=\"/doc/fyi\\2/\">\\1\\2</a>", string, flags=re.IGNORECASE)
233-
string = re.sub(r"(?<!>)(draft-[-0-9a-zA-Z._+]+)", "<a href=\"/doc/\\1/\">\\1</a>", string, flags=re.IGNORECASE)
234-
string = re.sub(r"(?<!>)(conflict-review-[-0-9a-zA-Z._+]+)", "<a href=\"/doc/\\1/\">\\1</a>", string, flags=re.IGNORECASE)
235-
string = re.sub(r"(?<!>)(status-change-[-0-9a-zA-Z._+]+)", "<a href=\"/doc/\\1/\">\\1</a>", string, flags=re.IGNORECASE)
229+
string = re.sub(r"(RFC\s*?)0{0,3}(\d+)", "<a href=\"/doc/rfc\\2/\">\\1\\2</a>", string, flags=re.IGNORECASE)
230+
string = re.sub(r"(BCP\s*?)0{0,3}(\d+)", "<a href=\"/doc/bcp\\2/\">\\1\\2</a>", string, flags=re.IGNORECASE)
231+
string = re.sub(r"(STD\s*?)0{0,3}(\d+)", "<a href=\"/doc/std\\2/\">\\1\\2</a>", string, flags=re.IGNORECASE)
232+
string = re.sub(r"(FYI\s*?)0{0,3}(\d+)", "<a href=\"/doc/fyi\\2/\">\\1\\2</a>", string, flags=re.IGNORECASE)
233+
string = re.sub(r"(draft-[-0-9a-zA-Z._+]+)", "<a href=\"/doc/\\1/\">\\1</a>", string, flags=re.IGNORECASE)
234+
string = re.sub(r"(conflict-review-[-0-9a-zA-Z._+]+)", "<a href=\"/doc/\\1/\">\\1</a>", string, flags=re.IGNORECASE)
235+
string = re.sub(r"(status-change-[-0-9a-zA-Z._+]+)", "<a href=\"/doc/\\1/\">\\1</a>", string, flags=re.IGNORECASE)
236+
string = re.sub(r"(charter-[-0-9a-zA-Z._+]+)", "<a href=\"/doc/\\1/\">\\1</a>", string, flags=re.IGNORECASE)
236237
return mark_safe(string)
237238
urlize_ietf_docs = stringfilter(urlize_ietf_docs)
238239

239240
@register.filter(name='urlize_related_source_list', is_safe=True, needs_autoescape=True)
240241
def urlize_related_source_list(related, autoescape=None):
241242
"""Convert a list of DocumentRelations into list of links using the source document's canonical name"""
242243
links = []
244+
names = set()
245+
titles = set()
243246
for rel in related:
244247
name=rel.source.canonical_name()
245248
title = rel.source.title
249+
if name in names and title in titles:
250+
continue
251+
names.add(name)
252+
titles.add(title)
246253
url = urlreverse('ietf.doc.views_doc.document_main', kwargs=dict(name=name))
247254
if autoescape:
248255
name = escape(name)
@@ -409,7 +416,9 @@ def ad_area(user):
409416
def format_history_text(text, trunc_words=25):
410417
"""Run history text through some cleaning and add ellipsis if it's too long."""
411418
full = mark_safe(text)
412-
full = urlize_ietf_docs(full)
419+
if "</a>" not in full:
420+
full = urlize_ietf_docs(full)
421+
full = bleach.linkify(full, parse_email=True)
413422

414423
return format_snippet(full, trunc_words)
415424

ietf/doc/tests.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2384,7 +2384,7 @@ class _TestForm(Form):
23842384
self.assertCountEqual(decoded_ids, [str(doc.id) for doc in docs])
23852385
for doc in docs:
23862386
self.assertEqual(
2387-
dict(id=doc.pk, selected=True, text=escape(uppercase_std_abbreviated_name(doc.name))),
2387+
dict(id=doc.pk, selected=True, url=doc.get_absolute_url(), text=escape(uppercase_std_abbreviated_name(doc.name))),
23882388
decoded[str(doc.pk)],
23892389
)
23902390

ietf/doc/tests_bofreq.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -191,7 +191,8 @@ def test_change_editors(self):
191191
self.client.login(username=username,password=username+'+password')
192192
r = self.client.get(url)
193193
self.assertEqual(r.status_code,200)
194-
unescaped = unescape(unicontent(r).encode('utf-8').decode('unicode-escape'))
194+
# Yes, unescape is needed twice, for names like "O'Connor"
195+
unescaped = unescape(unescape(unicontent(r).encode('utf-8').decode('unicode-escape')))
195196
for editor in previous_editors:
196197
self.assertIn(editor.name,unescaped)
197198
new_editors = set(previous_editors)
@@ -231,7 +232,8 @@ def test_change_responsible(self):
231232
self.client.login(username=username,password=username+'+password')
232233
r = self.client.get(url)
233234
self.assertEqual(r.status_code,200)
234-
unescaped = unescape(unicontent(r).encode('utf-8').decode('unicode-escape'))
235+
# Yes, unescape is needed twice, for names like "O'Connor"
236+
unescaped = unescape(unescape(unicontent(r).encode('utf-8').decode('unicode-escape')))
235237
for responsible in previous_responsible:
236238
self.assertIn(responsible.name, unescaped)
237239
new_responsible = set(previous_responsible)

ietf/doc/tests_js.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -33,9 +33,9 @@ def _fill_in_author_form(form_elt, name, email, affiliation, country):
3333
person_span = form_elt.find_element(By.CLASS_NAME, 'select2-selection')
3434
self.scroll_to_element(person_span)
3535
person_span.click()
36-
input = self.driver.find_element(By.CLASS_NAME, 'select2-search__field')
36+
input = self.driver.find_element(By.CSS_SELECTOR, '.select2-search__field[aria-controls*=author]')
3737
input.send_keys(name)
38-
result_selector = 'ul.select2-results__options > li.select2-results__option--selectable'
38+
result_selector = 'ul.select2-results__options[id*=author] > li.select2-results__option--selectable'
3939
self.wait.until(
4040
expected_conditions.text_to_be_present_in_element(
4141
(By.CSS_SELECTOR, result_selector),
@@ -94,9 +94,9 @@ def _read_author_form(form_elt):
9494
# get the "add author" button so we can add blank author forms
9595
add_author_button = self.driver.find_element(By.ID, 'add-author-button')
9696
for index, auth in enumerate(authors):
97-
self.driver.execute_script("arguments[0].scrollIntoView();", add_author_button) # FIXME-LARS: no idea why this fails:
97+
self.driver.execute_script("arguments[0].scrollIntoView();", add_author_button) # FIXME: no idea why this fails:
9898
# self.scroll_to_element(add_author_button) # Can only click if it's in view!
99-
self.driver.execute_script("arguments[0].click();", add_author_button) # FIXME-LARS: no idea why this fails:
99+
self.driver.execute_script("arguments[0].click();", add_author_button) # FIXME: no idea why this fails:
100100
# add_author_button.click() # Create a new form. Automatically scrolls to it.
101101
author_forms = authors_list.find_elements(By.CLASS_NAME, 'author-panel')
102102
authors_added = index + 1
@@ -119,7 +119,7 @@ def _read_author_form(form_elt):
119119
self.driver.find_element(By.ID, 'id_basis').send_keys('change testing')
120120
# Now click the 'submit' button and check that the update was accepted.
121121
submit_button = self.driver.find_element(By.CSS_SELECTOR, 'button[type="submit"]')
122-
self.driver.execute_script("arguments[0].click();", submit_button) # FIXME-LARS: no idea why this fails:
122+
self.driver.execute_script("arguments[0].click();", submit_button) # FIXME: no idea why this fails:
123123
# self.scroll_to_element(submit_button)
124124
# submit_button.click()
125125
# Wait for redirect to the document_main view

ietf/doc/views_search.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -583,4 +583,4 @@ def ajax_select2_search_docs(request, model_name, doc_type):
583583

584584
objs = qs.distinct().order_by("name")[:20]
585585

586-
return HttpResponse(select2_id_doc_name_json(objs), content_type='application/json')
586+
return HttpResponse(select2_id_doc_name_json(model, objs), content_type='application/json')

ietf/iesg/agenda.py

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,7 @@ def get_agenda_date(date=None):
2626
return datetime.date.today()
2727
else:
2828
try:
29-
# FIXME: .active()
30-
return TelechatDate.objects.all().get(date=datetime.datetime.strptime(date, "%Y-%m-%d").date()).date
29+
return TelechatDate.objects.active().get(date=datetime.datetime.strptime(date, "%Y-%m-%d").date()).date
3130
except (ValueError, TelechatDate.DoesNotExist):
3231
raise Http404
3332

@@ -221,5 +220,4 @@ def agenda_data(date=None):
221220
fill_in_agenda_docs(date, sections)
222221
fill_in_agenda_management_issues(date, sections)
223222

224-
return { 'date': date.isoformat(), 'sections': sections }
225-
223+
return { 'date': date.isoformat(), 'sections': sections }

ietf/meeting/tests_js.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -266,7 +266,7 @@ def test_edit_meeting_schedule(self):
266266

267267
# hide timeslots
268268
modal_open = self.driver.find_element(By.CSS_SELECTOR, "#timeslot-toggle-modal-open")
269-
self.driver.execute_script("arguments[0].click();", modal_open) # FIXME-LARS: not working:
269+
self.driver.execute_script("arguments[0].click();", modal_open) # FIXME: not working:
270270
# modal_open.click()
271271

272272
self.assertTrue(self.driver.find_element(By.CSS_SELECTOR, "#timeslot-group-toggles-modal").is_displayed())
@@ -589,7 +589,7 @@ def test_past_swap_timeslot_col_buttons(self):
589589
# option to swap. If we used the first or last day, a fencepost error in
590590
# disabling options by date might be hidden.
591591
clicked_index = 1
592-
self.driver.execute_script("arguments[0].click();", future_swap_ts_buttons[clicked_index]) # FIXME-LARS: not working:
592+
self.driver.execute_script("arguments[0].click();", future_swap_ts_buttons[clicked_index]) # FIXME: not working:
593593
# future_swap_ts_buttons[clicked_index].click()
594594
try:
595595
modal = wait.until(
@@ -1520,7 +1520,7 @@ def test_session_materials_modal(self):
15201520
),
15211521
'Modal open button not found or not clickable',
15221522
)
1523-
# FIXME-LARS: no idea why we need js instead of the following:
1523+
# FIXME: no idea why we need js instead of the following:
15241524
# self.scroll_to_element(open_modal_button)
15251525
# open_modal_button.click()
15261526
self.driver.execute_script("arguments[0].click();", open_modal_button)
@@ -1761,7 +1761,7 @@ def test_agenda_session_selection(self):
17611761
farfut_button = self.driver.find_element(By.CSS_SELECTOR, 'button[data-filter-item="farfut"]')
17621762
break_checkbox = self.driver.find_element(By.CSS_SELECTOR, 'input[type="checkbox"][name="selected-sessions"][data-filter-item="secretariat-sessb"]')
17631763
registration_checkbox = self.driver.find_element(By.CSS_SELECTOR, 'input[type="checkbox"][name="selected-sessions"][data-filter-item="secretariat-sessa"]')
1764-
self.driver.execute_script("arguments[0].click();", mars_sessa_checkbox) # select mars session; FIXME: no idea why a simple mars_sessa_checkbox.click() doesn't work
1764+
self.driver.execute_script("arguments[0].click();", mars_sessa_checkbox) # select mars session; FIXME: no idea why a simple mars_sessa_checkbox.click() doesn't work
17651765

17661766
try:
17671767
wait.until(

ietf/meeting/tests_views.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4280,8 +4280,8 @@ def test_past(self):
42804280
self.assertContains(r, 'IETF-%02d'%int(ietf.meeting.number))
42814281
q = PyQuery(r.content)
42824282
#id="-%s" % interim.group.acronym
4283-
#self.assertIn('CANCELLED', q('[id*="'+id+'"]').text())
4284-
self.assertIn('CANCELLED', q('tr>td>a>span').text())
4283+
#self.assertIn('Cancelled', q('[id*="'+id+'"]').text())
4284+
self.assertIn('Cancelled', q('tr>td>a>span').text())
42854285

42864286
def do_upcoming_test(self, querystring=None, create_meeting=True):
42874287
if create_meeting:
@@ -4304,7 +4304,7 @@ def test_upcoming(self):
43044304
self.assertContains(r, 'IETF 72')
43054305
# cancelled session
43064306
q = PyQuery(r.content)
4307-
self.assertIn('CANCELLED', q('tr>td.text-end>span').text())
4307+
self.assertIn('Cancelled', q('tr>td.text-end>span').text())
43084308

43094309
# test_upcoming_filters_ignored removed - we _don't_ want to ignore filters now, and the test passed because it wasn't testing the filtering anyhow (which requires testing the js).
43104310

0 commit comments

Comments
 (0)