Skip to content

Commit a730516

Browse files
committed
Allow more levy in constructing feed URLs, fixes test
- Legacy-Id: 3373
1 parent 8f6403b commit a730516

1 file changed

Lines changed: 13 additions & 2 deletions

File tree

ietf/liaisons/feeds.py

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,9 @@
1010
import re
1111

1212
if settings.USE_DB_REDESIGN_PROXY_CLASSES:
13+
from redesign.group.models import Group
1314
from ietf.liaisons.proxy import LiaisonDetailProxy as LiaisonDetail
15+
from ietf.liaisons.models import LiaisonStatement
1416

1517
# A slightly funny feed class, the 'object' is really
1618
# just a dict with some parameters that items() uses
@@ -29,14 +31,23 @@ def get_object(self, bits):
2931
if len(bits) != 2:
3032
raise FeedDoesNotExist
3133
if settings.USE_DB_REDESIGN_PROXY_CLASSES:
32-
from redesign.group.models import Group
3334
try:
3435
group = Group.objects.get(acronym=bits[1])
3536
obj['filter'] = { 'from_group': group }
3637
obj['title'] = u'Liaison Statements from %s' % group.name
3738
return obj
3839
except Group.DoesNotExist:
39-
raise FeedDoesNotExist
40+
# turn all-nonword characters into one-character
41+
# wildcards to make it easier to construct the URL
42+
search_string = re.sub(r"[^a-zA-Z1-9]", ".", bits[1])
43+
statements = LiaisonStatement.objects.filter(from_name__iregex=search_string)
44+
if statements:
45+
name = statements[0].from_name
46+
obj['filter'] = { 'from_name': name }
47+
obj['title'] = u'Liaison Statements from %s' % name
48+
return obj
49+
else:
50+
raise FeedDoesNotExist
4051
try:
4152
acronym = Acronym.objects.get(acronym=bits[1])
4253
obj['filter'] = {'from_id': acronym.acronym_id}

0 commit comments

Comments
 (0)