Skip to content

Commit 11411d2

Browse files
committed
Merged in an update from trunk@9942.
- Legacy-Id: 9961
2 parents 5fe1d43 + fb3aade commit 11411d2

34 files changed

Lines changed: 1864 additions & 124 deletions

bin/test-crawl

Lines changed: 51 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22

33
import os, sys, re, datetime, argparse, traceback, tempfile, json, subprocess
44
import html5lib
5-
import debug # pyflakes:ignore
65
import random
76

87
# Set up import path to find our own Django
@@ -33,6 +32,8 @@ parser.add_argument('--random', action='store_true',
3332
parser.add_argument('--validate-all', dest='validate_all', action='store_true', default=False,
3433
help='Run html 5 validation on all pages, without skipping similar urls. '
3534
'(The default is to only run validation on one of /foo/1/, /foo/2/, /foo/3/, etc.)')
35+
parser.add_argument('-v', '--verbose', action='store_true', default=False,
36+
help='Be more verbose')
3637

3738
args = parser.parse_args()
3839

@@ -44,6 +45,9 @@ import django.test
4445

4546
django.setup()
4647

48+
# This needs to come after we set up sys path to include the local django
49+
import debug # pyflakes:ignore
50+
4751
# prevent memory from leaking when settings.DEBUG=True
4852
from django.db import connection
4953
class DontSaveQueries(object):
@@ -59,6 +63,11 @@ MAX_URL_LENGTH = 500
5963

6064
# --- Functions ---
6165

66+
def note(s):
67+
if args.verbose:
68+
sys.stderr.write(s)
69+
sys.stderr.write('\n')
70+
6271
def strip_url(url):
6372
if url.startswith("http://testserver"):
6473
url = url[len("http://testserver"):]
@@ -105,26 +114,45 @@ def extract_tastypie_urls(content):
105114

106115
def check_html_valid(url, response, args):
107116
global parser, validated_urls, doc_types, warnings
108-
# These URLs have known issues, skip them until those are fixed
109-
if re.search('(/secr|admin/)|/doc/.*/edit/info/', url):
110-
log("%s blacklisted; skipping HTML validation" % url)
111-
return
112117
key = url
113118
if not args.validate_all:
114119
# derive a key for urls like this by replacing primary keys
115-
key = re.sub("/[0-9.]+/", "/nnnn/", key)
116-
key = re.sub("/.+@.+/", "/x@x.org/", key)
117-
key = re.sub("#.*$", "", key)
118120
key = re.sub("\?.*$", "", key)
121+
key = re.sub("#.*$", "", key)
122+
key = re.sub("/.+@.+/", "/x@x.org/", key)
123+
key = re.sub("/[0-9.]+/", "/nnnn/", key)
124+
key = re.sub("/[0-9.]+/", "/mmmm/", key)
125+
key = re.sub("/ag/[a-z0-9-]+/", "/ag/foo/", key)
126+
key = re.sub("/area/[a-z0-9-]+/", "/area/foo/", key)
127+
key = re.sub("/bcp[0-9]+/", "/bcpnnn/", key)
128+
key = re.sub("/conflict-review-[a-z0-9-]+/", "/conflrev-foo/", key)
129+
key = re.sub("/dir/[a-z0-9-]+/", "/dir/foo/", key)
130+
key = re.sub("/draft-[a-z0-9-]+/", "/draft-foo/", key)
131+
key = re.sub("/group/[a-z0-9-]+/", "/group/foo/", key)
132+
key = re.sub("/ipr/search/.*", "/ipr/search/", key)
133+
key = re.sub("/release/[0-9dev.]+/", "/release/n.n.n/", key)
119134
key = re.sub("/rfc[0-9]+/", "/rfcnnnn/", key)
120-
key = re.sub("/wg/[a-z0-9-]+/", "/wg/foo/", key)
121135
key = re.sub("/rg/[a-z0-9-]+/", "/rg/foo/", key)
122-
key = re.sub("/ipr/[0-9]+/", "/ipr/nnnn/", key)
123-
key = re.sub("/draft-[a-z0-9-]+/", "/draft-foo/", key)
136+
key = re.sub("/secr/srec/nnnn/[0-9a-z-]+/", "/secr/sreq/nn/bar/", key)
137+
key = re.sub("/state/[a-z0-9-]+/", "/state/foo/", key)
138+
key = re.sub("/state/[a-z0-9-]+/[a-z0-9-]+/", "/state/foo/bar/", key)
139+
key = re.sub("/status-change-[a-z0-9-]+/", "/statchg-foo/", key)
140+
key = re.sub("/std[0-9]+/", "/stdnnn/", key)
141+
key = re.sub("/submit/status/nnnn/[0-9a-f]+/", "/submit/status/nnnn/bar/", key)
142+
key = re.sub("/team/[a-z0-9-]+/", "/team/foo/", key)
143+
key = re.sub("/wg/[a-z0-9-]+/", "/wg/foo/", key)
144+
124145
for slug in doc_types:
125146
key = re.sub("/%s-.*/"%slug, "/%s-nnnn/"%slug, key)
126147

127148
if not key in validated_urls:
149+
note('Validate: %-32s: %s' % (url[:32], key))
150+
# These URLs have known issues, skip them until those are fixed
151+
if re.search('(/secr|admin/)|/doc/.*/edit/info/', url):
152+
log("%s blacklisted; skipping HTML validation" % url)
153+
validated_urls[key] = True
154+
return
155+
128156
if hasattr(response, "content"):
129157
content = response.content
130158
else:
@@ -156,6 +184,14 @@ def check_html_valid(url, response, args):
156184
(pos, code))
157185
warnings += 1
158186

187+
def skip_url(url):
188+
for pattern in (
189+
"^/community/[0-9]+/remove_document/",
190+
"^/community/personal/",
191+
):
192+
if re.search(pattern, url):
193+
return True
194+
return False
159195

160196
def log(s):
161197
print(s)
@@ -243,6 +279,9 @@ if __name__ == "__main__":
243279

244280
visited.add(url)
245281

282+
if skip_url(url):
283+
continue
284+
246285
try:
247286
timestamp = datetime.datetime.now()
248287
r = client.get(url, secure=True, follow=True)
@@ -298,7 +337,7 @@ if __name__ == "__main__":
298337
log("=============")
299338

300339
else:
301-
tags.append(u"FAIL for %s\n (from %s)" % (url, referrer))
340+
tags.append(u"FAIL (from %s)" % (referrer, ))
302341
errors += 1
303342

304343
if elapsed.total_seconds() > slow_threshold:

changelog

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,40 @@
1+
ietfdb (6.3.0) ietf; urgency=medium
2+
3+
**Active area, directorate, team, and area group pages**
4+
5+
This release provides new group overview pages for active areas, area
6+
groups, teams, and directorates. It also improves the error reporting when
7+
drafts are submitted with invalid XML, providing line numbers and specifics
8+
for the issues found. Additionally, there are a few bug fixes.
9+
10+
* Merged in [9924] from rjsparks@nostrum.com:
11+
Added views of active areas, area groups, teams, and directorates. Added
12+
navigation to those views to the base menus. Unified the URL patterns
13+
shared between group/urls and group/urls_info, exposing the same view at,
14+
e.g., /group/stir and /wg/stir/. Improved testing, primarily of
15+
group/info.py
16+
17+
* Merged in [9901] from rcross@amsl.com:
18+
Fixed matching audio file names with rooms.
19+
20+
* Provided a document's rfc number (if any) as part of the document fields
21+
exposed in the json api.
22+
23+
* Changed the code for meta-data extraction from xml files to not break
24+
if a sought-after element is missing.
25+
26+
* Updated the meta-data error message to say 'errors ... below' instead of
27+
'errors ... above', to match the relative placement of text and error
28+
indications.
29+
30+
* Improved the error reporting for invalid xml file submissions.
31+
32+
* Improved the handling of failed xml2rfc conversions when no txt document
33+
is submitted.
34+
35+
-- Henrik Levkowetz <henrik@levkowetz.com> 01 Aug 2015 14:52:37 +0000
36+
37+
138
ietfdb (6.2.0) ietf; urgency=medium
239

340
**XML-Only Draft Submission**

ietf/__init__.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,13 @@
22
import checks # pyflakes:ignore
33

44
# Don't add patch number here:
5-
__version__ = "6.2.1.dev0"
5+
__version__ = "6.3.1.dev0"
66

77
# set this to ".p1", ".p2", etc. after patching
88
__patch__ = ""
99

1010
__date__ = "$Date$"
1111

12-
__rev__ = "$Rev$ (dev) Latest release: Rev. 9880 "
12+
__rev__ = "$Rev$ (dev) Latest release: Rev. 9940 "
1313

1414
__id__ = "$Id$"

ietf/doc/mails.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -179,7 +179,7 @@ def generate_approval_mail_approved(request, doc):
179179
doc.group.name_with_wg = doc.group.name + " Working Group"
180180
if doc.group.list_email:
181181
cc.append("%s mailing list <%s>" % (doc.group.acronym, doc.group.list_email))
182-
cc.append("%s chair <%s-chairs@tools.ietf.org>" % (doc.group.acronym, doc.group.acronym))
182+
cc.append("%s chair <%s-chairs@ietf.org>" % (doc.group.acronym, doc.group.acronym))
183183
else:
184184
doc.group.name_with_wg = doc.group.name
185185

ietf/doc/resources.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# Autogenerated by the mkresources management command 2014-12-14 19:50
22
from tastypie.resources import ModelResource
3-
from tastypie.fields import ToOneField, ToManyField
3+
from tastypie.fields import ToOneField, ToManyField, CharField
44
from tastypie.constants import ALL, ALL_WITH_RELATIONS
55

66
from ietf import api
@@ -86,6 +86,7 @@ class DocumentResource(ModelResource):
8686
states = ToManyField(StateResource, 'states', null=True)
8787
tags = ToManyField(DocTagNameResource, 'tags', null=True)
8888
authors = ToManyField(EmailResource, 'authors', null=True)
89+
rfc = CharField(attribute='rfc_number', null=True)
8990
class Meta:
9091
queryset = Document.objects.all()
9192
#resource_name = 'document'
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
from django import template
2+
from django.template.loader import render_to_string
3+
4+
from ietf.name.models import GroupTypeName
5+
6+
register = template.Library()
7+
8+
@register.simple_tag
9+
def active_groups_menu():
10+
parents = GroupTypeName.objects.filter(slug__in=['ag','area','team','dir'])
11+
for p in parents:
12+
p.menu_url = '/%s/'%p.slug
13+
return render_to_string('base/menu_active_groups.html', { 'parents': parents })
14+

ietf/doc/utils.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -467,7 +467,7 @@ def collect_email_addresses(emails, doc):
467467
if role.email.address not in emails:
468468
emails[role.email.address] = '"%s"' % (role.person.name)
469469
if doc.group.type.slug == 'wg':
470-
address = '%s-ads@tools.ietf.org' % doc.group.acronym
470+
address = '%s-ads@ietf.org' % doc.group.acronym
471471
if address not in emails:
472472
emails[address] = '"%s-ads"' % (doc.group.acronym)
473473
elif doc.group.type.slug == 'rg':

ietf/doc/views_draft.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,8 @@
1313
from django.template.defaultfilters import pluralize
1414
from django.contrib import messages
1515

16+
import debug # pyflakes:ignore
17+
1618
from ietf.doc.models import ( Document, DocAlias, RelatedDocument, State,
1719
StateType, DocEvent, ConsensusDocEvent, TelechatDocEvent, WriteupDocEvent, IESG_SUBSTATE_TAGS,
1820
save_document_in_history )
@@ -582,7 +584,7 @@ def to_iesg(request,name):
582584
doc.save()
583585

584586
extra = {}
585-
extra['Cc'] = "%s-chairs@tools.ietf.org, iesg-secretary@ietf.org, %s" % (doc.group.acronym,doc.notify)
587+
extra['Cc'] = "%s-chairs@ietf.org, iesg-secretary@ietf.org, %s" % (doc.group.acronym,doc.notify)
586588
send_mail(request=request,
587589
to = doc.ad.email_address(),
588590
frm = login.formatted_email(),

ietf/group/edit.py

Lines changed: 18 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -167,14 +167,29 @@ def get_or_create_initial_charter(group, group_type):
167167
return charter
168168

169169
@login_required
170-
def submit_initial_charter(request, group_type, acronym=None):
171-
if not can_manage_group_type(request.user, group_type):
172-
return HttpResponseForbidden("You don't have permission to access this view")
170+
def submit_initial_charter(request, group_type=None, acronym=None):
171+
172+
# This needs refactoring.
173+
# The signature assumed you could have groups with the same name, but with different types, which we do not allow.
174+
# Consequently, this can be called with an existing group acronym and a type
175+
# that doesn't match the existing group type. The code below essentially ignores the group_type argument.
176+
#
177+
# If possible, the use of get_or_create_initial_charter should be moved
178+
# directly into charter_submit, and this function should go away.
179+
180+
if acronym==None:
181+
raise Http404
173182

174183
group = get_object_or_404(Group, acronym=acronym)
175184
if not group.features.has_chartering_process:
176185
raise Http404
177186

187+
# This is where we start ignoring the passed in group_type
188+
group_type = group.type_id
189+
190+
if not can_manage_group_type(request.user, group_type):
191+
return HttpResponseForbidden("You don't have permission to access this view")
192+
178193
if not group.charter:
179194
group.charter = get_or_create_initial_charter(group, group_type)
180195
group.save()

ietf/group/features.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ def __init__(self, group):
2020
self.default_tab = "group_docs"
2121
elif group.type_id in ("team",):
2222
self.has_materials = True
23+
self.default_tab = "group_about"
2324

2425
if self.has_chartering_process:
2526
self.about_page = "group_charter"

0 commit comments

Comments
 (0)