prompt: You will be provided with a partial code base and an issue statement explaining a problem to resolve.
  <issue>
  Limitations on SENTRY_KEY not documented
  I assumed that SENTRY_KEY was just any random string that should be unique to a deployment and kept secret (ie, serving a similar purpose to django's SECRET_KEY) so I generated a random string to use there. 
  
  It turns out that it's used in a URL for the feeds:
  
  ```
  url(r'^feeds/%s/messages.xml$' % KEY, MessageFeed(), name='sentry-feed-messages'),
  ```
  
  (in sentry.urls)
  
  Mine happened to have an '[' in it which caused a very confusing error about an unterminated regex. 
  
  It should be documented that SENTRY_KEY will make it into a URL (and further that django will try to then parse it as a regexp when trying to do reverse lookups) and thus can't have most punctuation. 
  
  
  </issue>
  <code>
  [start of sentry/urls.py]
  1 import os
  2 
  3 from django.conf.urls.defaults import *
  4 
  5 from sentry.conf import KEY
  6 from sentry import views
  7 from sentry.feeds import MessageFeed, SummaryFeed
  8 
  9 SENTRY_ROOT = os.path.dirname(__file__) 
  10 
  11 urlpatterns = patterns('',
  12     url(r'^_media/(?P<path>.*)$', 'django.views.static.serve',
  13         {'document_root': os.path.join(SENTRY_ROOT, 'media')}, name='sentry-media'),
  14 
  15     # Feeds
  16 
  17     url(r'^feeds/%s/messages.xml$' % KEY, MessageFeed(), name='sentry-feed-messages'),
  18     url(r'^feeds/%s/summaries.xml$' % KEY, SummaryFeed(), name='sentry-feed-summaries'),
  19 
  20     # JS and API
  21 
  22     url(r'^jsapi/$', views.ajax_handler, name='sentry-ajax'),
  23     url(r'^store/$', views.store, name='sentry-store'),
  24     
  25     # Normal views
  26 
  27     url(r'^login$', views.login, name='sentry-login'),
  28     url(r'^logout$', views.logout, name='sentry-logout'),
  29     url(r'^group/(\d+)$', views.group, name='sentry-group'),
  30     url(r'^group/(\d+)/messages$', views.group_message_list, name='sentry-group-messages'),
  31     url(r'^group/(\d+)/messages/(\d+)$', views.group_message_details, name='sentry-group-message'),
  32     url(r'^group/(\d+)/actions/([\w_-]+)', views.group_plugin_action, name='sentry-group-plugin-action'),
  33 
  34     url(r'^$', views.index, name='sentry'),
  35 )
  36
  [end of sentry/urls.py]
  </code>
  
  I need you to solve this issue by generating a single patch file that I can apply directly to this repository using git apply. Please respond with a single patch file in the following format.
  <patch>
  diff --git a/file.py b/file.py
  --- a/file.py
  +++ b/file.py
  @@ -1,27 +1,35 @@
   def euclidean(a, b):
  -    while b:
  -        a, b = b, a % b
  -    return a
  +    if b == 0:
  +        return a
  +    return euclidean(b, a % b)
   
   
   def bresenham(x0, y0, x1, y1):
       points = []
       dx = abs(x1 - x0)
       dy = abs(y1 - y0)
  -    sx = 1 if x0 < x1 else -1
  -    sy = 1 if y0 < y1 else -1
  -    err = dx - dy
  +    x, y = x0, y0
  +    sx = -1 if x0 > x1 else 1
  +    sy = -1 if y0 > y1 else 1
   
  -    while True:
  -        points.append((x0, y0))
  -        if x0 == x1 and y0 == y1:
  -            break
  -        e2 = 2 * err
  -        if e2 > -dy:
  -            err -= dy
  -            x0 += sx
  -        if e2 < dx:
  -            err += dx
  -            y0 += sy
  +    if dx > dy:
  +        err = dx / 2.0
  +        while x != x1:
  +            points.append((x, y))
  +            err -= dy
  +            if err < 0:
  +                y += sy
  +                err += dx
  +            x += sx
  +    else:
  +        err = dy / 2.0
  +        while y != y1:
  +            points.append((x, y))
  +            err -= dx
  +            if err < 0:
  +                x += sx
  +                err += dy
  +            y += sy
  +
  +    points.append((x, y))
       return points
  
  </patch>
golden_diff: diff --git a/sentry/urls.py b/sentry/urls.py
  --- a/sentry/urls.py
  +++ b/sentry/urls.py
  @@ -1,4 +1,5 @@
   import os
  +import re
   
   from django.conf.urls.defaults import *
   
  @@ -14,8 +15,8 @@
   
       # Feeds
   
  -    url(r'^feeds/%s/messages.xml$' % KEY, MessageFeed(), name='sentry-feed-messages'),
  -    url(r'^feeds/%s/summaries.xml$' % KEY, SummaryFeed(), name='sentry-feed-summaries'),
  +    url(r'^feeds/%s/messages.xml$' % re.escape(KEY), MessageFeed(), name='sentry-feed-messages'),
  +    url(r'^feeds/%s/summaries.xml$' % re.escape(KEY), SummaryFeed(), name='sentry-feed-summaries'),
   
       # JS and API
  
verification_info: {"golden_diff": "diff --git a/sentry/urls.py b/sentry/urls.py\n--- a/sentry/urls.py\n+++ b/sentry/urls.py\n@@ -1,4 +1,5 @@\n import os\n+import re\n \n from django.conf.urls.defaults import *\n \n@@ -14,8 +15,8 @@\n \n     # Feeds\n \n-    url(r'^feeds/%s/messages.xml$' % KEY, MessageFeed(), name='sentry-feed-messages'),\n-    url(r'^feeds/%s/summaries.xml$' % KEY, SummaryFeed(), name='sentry-feed-summaries'),\n+    url(r'^feeds/%s/messages.xml$' % re.escape(KEY), MessageFeed(), name='sentry-feed-messages'),\n+    url(r'^feeds/%s/summaries.xml$' % re.escape(KEY), SummaryFeed(), name='sentry-feed-summaries'),\n \n     # JS and API\n", "issue": "Limitations on SENTRY_KEY not documented\nI assumed that SENTRY_KEY was just any random string that should be unique to a deployment and kept secret (ie, serving a similar purpose to django's SECRET_KEY) so I generated a random string to use there. \n\nIt turns out that it's used in a URL for the feeds:\n\n```\nurl(r'^feeds/%s/messages.xml$' % KEY, MessageFeed(), name='sentry-feed-messages'),\n```\n\n(in sentry.urls)\n\nMine happened to have an '[' in it which caused a very confusing error about an unterminated regex. \n\nIt should be documented that SENTRY_KEY will make it into a URL (and further that django will try to then parse it as a regexp when trying to do reverse lookups) and thus can't have most punctuation. \n\n", "before_files": [{"content": "import os\n\nfrom django.conf.urls.defaults import *\n\nfrom sentry.conf import KEY\nfrom sentry import views\nfrom sentry.feeds import MessageFeed, SummaryFeed\n\nSENTRY_ROOT = os.path.dirname(__file__) \n\nurlpatterns = patterns('',\n    url(r'^_media/(?P<path>.*)$', 'django.views.static.serve',\n        {'document_root': os.path.join(SENTRY_ROOT, 'media')}, name='sentry-media'),\n\n    # Feeds\n\n    url(r'^feeds/%s/messages.xml$' % KEY, MessageFeed(), name='sentry-feed-messages'),\n    url(r'^feeds/%s/summaries.xml$' % KEY, SummaryFeed(), name='sentry-feed-summaries'),\n\n    # JS and API\n\n    url(r'^jsapi/$', views.ajax_handler, name='sentry-ajax'),\n    url(r'^store/$', views.store, name='sentry-store'),\n    \n    # Normal views\n\n    url(r'^login$', views.login, name='sentry-login'),\n    url(r'^logout$', views.logout, name='sentry-logout'),\n    url(r'^group/(\\d+)$', views.group, name='sentry-group'),\n    url(r'^group/(\\d+)/messages$', views.group_message_list, name='sentry-group-messages'),\n    url(r'^group/(\\d+)/messages/(\\d+)$', views.group_message_details, name='sentry-group-message'),\n    url(r'^group/(\\d+)/actions/([\\w_-]+)', views.group_plugin_action, name='sentry-group-plugin-action'),\n\n    url(r'^$', views.index, name='sentry'),\n)\n", "path": "sentry/urls.py"}]}