prompt: You will be provided with a partial code base and an issue statement explaining a problem to resolve.
  <issue>
  Home page should have a link to password reset, check print quota, view print queue
  
  
  </issue>
  <code>
  [start of ocfweb/context_processors.py]
  1 import re
  2 from datetime import date
  3 from datetime import datetime
  4 
  5 from ocflib.lab.hours import DayHours
  6 
  7 from ocfweb.component.lab_status import get_lab_status
  8 
  9 
  10 def ocf_template_processor(request):
  11     now = datetime.now()
  12     today = date.today()
  13     hours = DayHours.from_date(today)
  14 
  15     base_css_classes = []
  16     if request.resolver_match.url_name:
  17         page_class = 'page-' + request.resolver_match.url_name
  18         base_css_classes.append(page_class)
  19 
  20         for arg in request.resolver_match.args:
  21             page_class += '-' + re.sub('[^a-zA-Z_\-]', '-', arg)
  22             base_css_classes.append(page_class)
  23 
  24     return {
  25         'lab_is_open': hours.is_open(now),
  26         'current_lab_hours': hours,
  27         'lab_status': get_lab_status(),
  28         'base_css_classes': ' '.join(base_css_classes),
  29     }
  30
  [end of ocfweb/context_processors.py]
  [start of setup.py]
  1 from setuptools import find_packages
  2 from setuptools import setup
  3 
  4 try:
  5     with open('.version') as f:
  6         VERSION = f.readline().strip()
  7 except IOError:
  8     VERSION = 'unknown'
  9 
  10 setup(
  11     name='ocfweb',
  12     version=VERSION,
  13     packages=find_packages(exclude=['debian', 'virtualenv_run']),
  14     include_package_data=True,
  15     url='https://www.ocf.berkeley.edu/',
  16     author='Open Computing Facility',
  17     author_email='help@ocf.berkeley.edu',
  18     install_requires=[
  19         'cachetools',
  20         'django>=1.8,<1.8.999',
  21         'gunicorn',
  22         'libsass',
  23         'lxml',
  24         'mistune',
  25         'ocflib',
  26         'pygments',
  27         'python-dateutil',
  28     ],
  29     sass_manifests={
  30         'ocfweb': ('static/scss',),
  31     },
  32 )
  33
  [end of setup.py]
  [start of ocfweb/main/home.py]
  1 from datetime import date
  2 from datetime import timedelta
  3 
  4 from django.shortcuts import render_to_response
  5 from django.template import RequestContext
  6 from django.utils import timezone
  7 from ocflib.lab.hours import get_hours
  8 from ocflib.lab.staff_hours import get_staff_hours_soonest_first
  9 
  10 from ocfweb.component.blog import get_blog_posts
  11 from ocfweb.component.lab_status import get_lab_status
  12 
  13 
  14 def home(request):
  15     hours = [
  16         get_hours(date.today() + timedelta(days=i)) for i in range(5)
  17     ]
  18 
  19     blog_posts = [
  20         post for post
  21         in get_blog_posts()
  22         if timezone.now() - post.published < timedelta(days=365)
  23     ][:2]
  24 
  25     return render_to_response(
  26         'home.html',
  27         {
  28             'fulltitle': 'Open Computing Facility at UC Berkeley',
  29             'description': (
  30                 'The Open Computing Facility is an all-volunteer student '
  31                 'organization dedicated to free and open-source computing for all UC '
  32                 'Berkeley students.'''
  33             ),
  34             'staff_hours': get_staff_hours_soonest_first()[:2],
  35             'hours': hours,
  36             'today': hours[0],
  37             'blog_posts': blog_posts,
  38             'lab_status': get_lab_status(),
  39         },
  40         context_instance=RequestContext(request),
  41     )
  42
  [end of ocfweb/main/home.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/ocfweb/context_processors.py b/ocfweb/context_processors.py
  --- a/ocfweb/context_processors.py
  +++ b/ocfweb/context_processors.py
  @@ -1,12 +1,20 @@
   import re
   from datetime import date
   from datetime import datetime
  +from ipaddress import ip_address
  +from ipaddress import ip_network
   
  +from ipware.ip import get_real_ip
   from ocflib.lab.hours import DayHours
   
   from ocfweb.component.lab_status import get_lab_status
   
   
  +def is_ocf_ip(ip):
  +    # TODO: move this to ocflib when it drops Python 3.2 support
  +    return ip_address(ip) in ip_network('169.229.10.0/24')
  +
  +
   def ocf_template_processor(request):
       now = datetime.now()
       today = date.today()
  @@ -21,9 +29,12 @@
               page_class += '-' + re.sub('[^a-zA-Z_\-]', '-', arg)
               base_css_classes.append(page_class)
   
  +    real_ip = get_real_ip(request)
  +
       return {
           'lab_is_open': hours.is_open(now),
           'current_lab_hours': hours,
           'lab_status': get_lab_status(),
           'base_css_classes': ' '.join(base_css_classes),
  +        'is_ocf_ip': is_ocf_ip(real_ip) if real_ip else True,
       }
  diff --git a/ocfweb/main/home.py b/ocfweb/main/home.py
  --- a/ocfweb/main/home.py
  +++ b/ocfweb/main/home.py
  @@ -13,7 +13,7 @@
   
   def home(request):
       hours = [
  -        get_hours(date.today() + timedelta(days=i)) for i in range(5)
  +        get_hours(date.today() + timedelta(days=i)) for i in range(3)
       ]
   
       blog_posts = [
  diff --git a/setup.py b/setup.py
  --- a/setup.py
  +++ b/setup.py
  @@ -18,6 +18,7 @@
       install_requires=[
           'cachetools',
           'django>=1.8,<1.8.999',
  +        'django-ipware',
           'gunicorn',
           'libsass',
           'lxml',
  
verification_info: {"golden_diff": "diff --git a/ocfweb/context_processors.py b/ocfweb/context_processors.py\n--- a/ocfweb/context_processors.py\n+++ b/ocfweb/context_processors.py\n@@ -1,12 +1,20 @@\n import re\n from datetime import date\n from datetime import datetime\n+from ipaddress import ip_address\n+from ipaddress import ip_network\n \n+from ipware.ip import get_real_ip\n from ocflib.lab.hours import DayHours\n \n from ocfweb.component.lab_status import get_lab_status\n \n \n+def is_ocf_ip(ip):\n+    # TODO: move this to ocflib when it drops Python 3.2 support\n+    return ip_address(ip) in ip_network('169.229.10.0/24')\n+\n+\n def ocf_template_processor(request):\n     now = datetime.now()\n     today = date.today()\n@@ -21,9 +29,12 @@\n             page_class += '-' + re.sub('[^a-zA-Z_\\-]', '-', arg)\n             base_css_classes.append(page_class)\n \n+    real_ip = get_real_ip(request)\n+\n     return {\n         'lab_is_open': hours.is_open(now),\n         'current_lab_hours': hours,\n         'lab_status': get_lab_status(),\n         'base_css_classes': ' '.join(base_css_classes),\n+        'is_ocf_ip': is_ocf_ip(real_ip) if real_ip else True,\n     }\ndiff --git a/ocfweb/main/home.py b/ocfweb/main/home.py\n--- a/ocfweb/main/home.py\n+++ b/ocfweb/main/home.py\n@@ -13,7 +13,7 @@\n \n def home(request):\n     hours = [\n-        get_hours(date.today() + timedelta(days=i)) for i in range(5)\n+        get_hours(date.today() + timedelta(days=i)) for i in range(3)\n     ]\n \n     blog_posts = [\ndiff --git a/setup.py b/setup.py\n--- a/setup.py\n+++ b/setup.py\n@@ -18,6 +18,7 @@\n     install_requires=[\n         'cachetools',\n         'django>=1.8,<1.8.999',\n+        'django-ipware',\n         'gunicorn',\n         'libsass',\n         'lxml',\n", "issue": "Home page should have a link to password reset, check print quota, view print queue\n\n", "before_files": [{"content": "import re\nfrom datetime import date\nfrom datetime import datetime\n\nfrom ocflib.lab.hours import DayHours\n\nfrom ocfweb.component.lab_status import get_lab_status\n\n\ndef ocf_template_processor(request):\n    now = datetime.now()\n    today = date.today()\n    hours = DayHours.from_date(today)\n\n    base_css_classes = []\n    if request.resolver_match.url_name:\n        page_class = 'page-' + request.resolver_match.url_name\n        base_css_classes.append(page_class)\n\n        for arg in request.resolver_match.args:\n            page_class += '-' + re.sub('[^a-zA-Z_\\-]', '-', arg)\n            base_css_classes.append(page_class)\n\n    return {\n        'lab_is_open': hours.is_open(now),\n        'current_lab_hours': hours,\n        'lab_status': get_lab_status(),\n        'base_css_classes': ' '.join(base_css_classes),\n    }\n", "path": "ocfweb/context_processors.py"}, {"content": "from setuptools import find_packages\nfrom setuptools import setup\n\ntry:\n    with open('.version') as f:\n        VERSION = f.readline().strip()\nexcept IOError:\n    VERSION = 'unknown'\n\nsetup(\n    name='ocfweb',\n    version=VERSION,\n    packages=find_packages(exclude=['debian', 'virtualenv_run']),\n    include_package_data=True,\n    url='https://www.ocf.berkeley.edu/',\n    author='Open Computing Facility',\n    author_email='help@ocf.berkeley.edu',\n    install_requires=[\n        'cachetools',\n        'django>=1.8,<1.8.999',\n        'gunicorn',\n        'libsass',\n        'lxml',\n        'mistune',\n        'ocflib',\n        'pygments',\n        'python-dateutil',\n    ],\n    sass_manifests={\n        'ocfweb': ('static/scss',),\n    },\n)\n", "path": "setup.py"}, {"content": "from datetime import date\nfrom datetime import timedelta\n\nfrom django.shortcuts import render_to_response\nfrom django.template import RequestContext\nfrom django.utils import timezone\nfrom ocflib.lab.hours import get_hours\nfrom ocflib.lab.staff_hours import get_staff_hours_soonest_first\n\nfrom ocfweb.component.blog import get_blog_posts\nfrom ocfweb.component.lab_status import get_lab_status\n\n\ndef home(request):\n    hours = [\n        get_hours(date.today() + timedelta(days=i)) for i in range(5)\n    ]\n\n    blog_posts = [\n        post for post\n        in get_blog_posts()\n        if timezone.now() - post.published < timedelta(days=365)\n    ][:2]\n\n    return render_to_response(\n        'home.html',\n        {\n            'fulltitle': 'Open Computing Facility at UC Berkeley',\n            'description': (\n                'The Open Computing Facility is an all-volunteer student '\n                'organization dedicated to free and open-source computing for all UC '\n                'Berkeley students.'''\n            ),\n            'staff_hours': get_staff_hours_soonest_first()[:2],\n            'hours': hours,\n            'today': hours[0],\n            'blog_posts': blog_posts,\n            'lab_status': get_lab_status(),\n        },\n        context_instance=RequestContext(request),\n    )\n", "path": "ocfweb/main/home.py"}]}