Skip to content
This repository has been archived by the owner on May 1, 2024. It is now read-only.

Commit

Permalink
Updated Course ID Regex
Browse files Browse the repository at this point in the history
This regex is nearly identical to the one used by LMS. The only difference is the internal capture groups have been replaced with character sets to avoid issues with the Swagger UI attempting to parse the internal capture groups and pass them along as arguments.
  • Loading branch information
Clinton Blackburn committed Oct 6, 2014
1 parent 2943787 commit af18880
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions analytics_data_api/v0/urls/courses.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
import re

from django.conf.urls import patterns, url

from analytics_data_api.v0.views import courses as views


COURSE_ID_PATTERN = r'(?P<course_id>[^/+]+[/+][^/+]+[/+][^/]+)'
COURSE_URLS = [
('activity', views.CourseActivityWeeklyView, 'activity'),
('recent_activity', views.CourseActivityMostRecentWeekView, 'recent_activity'),
Expand All @@ -18,4 +16,5 @@
urlpatterns = []

for path, view, name in COURSE_URLS:
urlpatterns += patterns('', url(r'^(?P<course_id>.+)/' + re.escape(path) + r'/$', view.as_view(), name=name))
regex = r'^{0}/{1}/$'.format(COURSE_ID_PATTERN, path)
urlpatterns += patterns('', url(regex, view.as_view(), name=name))

0 comments on commit af18880

Please sign in to comment.