prompt: You will be provided with a partial code base and an issue statement explaining a problem to resolve.
  <issue>
  Username change fails silently
  When you change your username, you're querying [`username.json.spt`](https://github.com/gittip/www.gittip.com/blob/0464c57465aed49a95a2c546f0d9987ad5b9b3fa/www/%25username/username.json.spt). If the desired username is invalid, we respond back with a user-friendly message (though the UI is ugly). Unfortunately, this behavior is currently broken because it returns HTML instead of the expected JSON.
  
  [IRC](https://botbot.me/freenode/gittip/msg/9518377/), from working on #1849
  
  Thanks to @thomasboyt for [reporting the problem](https://botbot.me/freenode/gittip/msg/9517625/) :heart:
  
  The Aspen ticket for this is: gittip/aspen-python#279
  
  Username change fails silently
  When you change your username, you're querying [`username.json.spt`](https://github.com/gittip/www.gittip.com/blob/0464c57465aed49a95a2c546f0d9987ad5b9b3fa/www/%25username/username.json.spt). If the desired username is invalid, we respond back with a user-friendly message (though the UI is ugly). Unfortunately, this behavior is currently broken because it returns HTML instead of the expected JSON.
  
  [IRC](https://botbot.me/freenode/gittip/msg/9518377/), from working on #1849
  
  Thanks to @thomasboyt for [reporting the problem](https://botbot.me/freenode/gittip/msg/9517625/) :heart:
  
  The Aspen ticket for this is: gittip/aspen-python#279
  
  
  </issue>
  <code>
  [start of gittip/exceptions.py]
  1 """
  2 This module contains exceptions shared across application code.
  3 """
  4 
  5 from __future__ import print_function, unicode_literals
  6 
  7 
  8 
  9 class UnknownPlatform(Exception): pass
  10 
  11 class ProblemChangingUsername(Exception):
  12     def __str__(self):
  13         return self.msg.format(self.args[0])
  14 
  15 class UsernameIsEmpty(ProblemChangingUsername):
  16     msg = "You need to provide a username!"
  17 
  18 class UsernameTooLong(ProblemChangingUsername):
  19     msg = "The username '{}' is too long."
  20 
  21 # Not passing the potentially unicode characters back because of:
  22 # https://github.com/gittip/aspen-python/issues/177
  23 class UsernameContainsInvalidCharacters(ProblemChangingUsername):
  24     msg = "That username contains invalid characters."
  25 
  26 class UsernameIsRestricted(ProblemChangingUsername):
  27     msg = "The username '{}' is restricted."
  28 
  29 class UsernameAlreadyTaken(ProblemChangingUsername):
  30     msg = "The username '{}' is already taken."
  31 
  32 class TooGreedy(Exception): pass
  33 class NoSelfTipping(Exception): pass
  34 class BadAmount(Exception): pass
  35
  [end of gittip/exceptions.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/gittip/exceptions.py b/gittip/exceptions.py
  --- a/gittip/exceptions.py
  +++ b/gittip/exceptions.py
  @@ -18,10 +18,8 @@
   class UsernameTooLong(ProblemChangingUsername):
       msg = "The username '{}' is too long."
   
  -# Not passing the potentially unicode characters back because of:
  -# https://github.com/gittip/aspen-python/issues/177
   class UsernameContainsInvalidCharacters(ProblemChangingUsername):
  -    msg = "That username contains invalid characters."
  +    msg = "The username '{}' contains invalid characters."
   
   class UsernameIsRestricted(ProblemChangingUsername):
       msg = "The username '{}' is restricted."
  
verification_info: {"golden_diff": "diff --git a/gittip/exceptions.py b/gittip/exceptions.py\n--- a/gittip/exceptions.py\n+++ b/gittip/exceptions.py\n@@ -18,10 +18,8 @@\n class UsernameTooLong(ProblemChangingUsername):\n     msg = \"The username '{}' is too long.\"\n \n-# Not passing the potentially unicode characters back because of:\n-# https://github.com/gittip/aspen-python/issues/177\n class UsernameContainsInvalidCharacters(ProblemChangingUsername):\n-    msg = \"That username contains invalid characters.\"\n+    msg = \"The username '{}' contains invalid characters.\"\n \n class UsernameIsRestricted(ProblemChangingUsername):\n     msg = \"The username '{}' is restricted.\"\n", "issue": "Username change fails silently\nWhen you change your username, you're querying [`username.json.spt`](https://github.com/gittip/www.gittip.com/blob/0464c57465aed49a95a2c546f0d9987ad5b9b3fa/www/%25username/username.json.spt). If the desired username is invalid, we respond back with a user-friendly message (though the UI is ugly). Unfortunately, this behavior is currently broken because it returns HTML instead of the expected JSON.\n\n[IRC](https://botbot.me/freenode/gittip/msg/9518377/), from working on #1849\n\nThanks to @thomasboyt for [reporting the problem](https://botbot.me/freenode/gittip/msg/9517625/) :heart:\n\nThe Aspen ticket for this is: gittip/aspen-python#279\n\nUsername change fails silently\nWhen you change your username, you're querying [`username.json.spt`](https://github.com/gittip/www.gittip.com/blob/0464c57465aed49a95a2c546f0d9987ad5b9b3fa/www/%25username/username.json.spt). If the desired username is invalid, we respond back with a user-friendly message (though the UI is ugly). Unfortunately, this behavior is currently broken because it returns HTML instead of the expected JSON.\n\n[IRC](https://botbot.me/freenode/gittip/msg/9518377/), from working on #1849\n\nThanks to @thomasboyt for [reporting the problem](https://botbot.me/freenode/gittip/msg/9517625/) :heart:\n\nThe Aspen ticket for this is: gittip/aspen-python#279\n\n", "before_files": [{"content": "\"\"\"\nThis module contains exceptions shared across application code.\n\"\"\"\n\nfrom __future__ import print_function, unicode_literals\n\n\n\nclass UnknownPlatform(Exception): pass\n\nclass ProblemChangingUsername(Exception):\n    def __str__(self):\n        return self.msg.format(self.args[0])\n\nclass UsernameIsEmpty(ProblemChangingUsername):\n    msg = \"You need to provide a username!\"\n\nclass UsernameTooLong(ProblemChangingUsername):\n    msg = \"The username '{}' is too long.\"\n\n# Not passing the potentially unicode characters back because of:\n# https://github.com/gittip/aspen-python/issues/177\nclass UsernameContainsInvalidCharacters(ProblemChangingUsername):\n    msg = \"That username contains invalid characters.\"\n\nclass UsernameIsRestricted(ProblemChangingUsername):\n    msg = \"The username '{}' is restricted.\"\n\nclass UsernameAlreadyTaken(ProblemChangingUsername):\n    msg = \"The username '{}' is already taken.\"\n\nclass TooGreedy(Exception): pass\nclass NoSelfTipping(Exception): pass\nclass BadAmount(Exception): pass\n", "path": "gittip/exceptions.py"}]}