prompt: You will be provided with a partial code base and an issue statement explaining a problem to resolve.
  <issue>
  Ebola Page: title case, please
  For example, change `Appeal coverage` to `Appeal Coverage`
  
  ![image](https://cloud.githubusercontent.com/assets/1654485/4974867/41867a20-68d1-11e4-92c9-e8956b974d8d.png)
  
  
  </issue>
  <code>
  [start of ckanext-hdx_crisis/ckanext/hdx_crisis/controllers/crisis_controller.py]
  1 '''
  2 Created on Nov 3, 2014
  3 
  4 @author: alexandru-m-g
  5 '''
  6 
  7 import datetime as dt
  8 
  9 import pylons.config as config
  10 import logging
  11 
  12 import ckan.lib.base as base
  13 import ckan.logic as logic
  14 import ckan.model as model
  15 import ckan.common as common
  16 import ckan.lib.helpers as h
  17 
  18 render = base.render
  19 get_action = logic.get_action
  20 c = common.c
  21 request = common.request
  22 
  23 log = logging.getLogger(__name__)
  24 
  25 
  26 class CrisisController(base.BaseController):
  27 
  28     def show(self):
  29 
  30         context = {'model': model, 'session': model.Session,
  31                    'user': c.user or c.author, 'for_view': True,
  32                    'auth_user_obj': c.userobj}
  33 
  34         datastore_resource_id = self._get_datastore_resource_id(
  35             context, config.get('hdx.crisis.ebola_dataset', None), config.get('hdx.crisis.ebola_resource_title', None))
  36         if datastore_resource_id:
  37             c.top_line_items = self._get_top_line_items(
  38                 context, datastore_resource_id)
  39 
  40         limit = 25
  41         c.q = u'ebola'
  42 
  43         page = int(request.params.get('page', 1))
  44         data_dict = {'sort': u'metadata_modified desc',
  45                      'fq': '+dataset_type:dataset',
  46                      'rows': limit,
  47                      'q': c.q,
  48                      'start': (page - 1) * limit
  49                      }
  50         query = get_action("package_search")(context, data_dict)
  51 
  52         def pager_url(q=None, page=None):
  53             return h.url_for('show_crisis', page=page)
  54 
  55         c.page = h.Page(
  56             collection=query['results'],
  57             page=page,
  58             url=pager_url,
  59             item_count=query['count'],
  60             items_per_page=limit
  61         )
  62         c.items = query['results']
  63         c.item_count = query['count']
  64 
  65         c.other_links = {}
  66         c.other_links['show_more'] = h.url_for(
  67             "search", **{'q': u'ebola', 'sort': u'metadata_modified desc',
  68                          'ext_indicator': '0'})
  69 
  70         return render('crisis/crisis.html')
  71 
  72     def _get_top_line_items(self, context, datastore_resource_id):
  73         modified_context = dict(context)
  74         modified_context['ignore_auth'] = True
  75         result = get_action('datastore_search')(
  76             modified_context, {'resource_id': datastore_resource_id})
  77         if 'records' in result:
  78             for r in result['records']:
  79                 d = dt.datetime.strptime(
  80                     r[u'latest_date'], '%Y-%m-%dT%H:%M:%S')
  81                 r[u'latest_date'] = dt.datetime.strftime(d, '%b %d, %Y')
  82                 int_value = int(r[u'value'])
  83                 if int_value == r[u'value']:
  84                     r[u'value'] = '{:,}'.format(int_value)
  85                 else:
  86                     r[u'value'] = '{:,}'.format(r[u'value'])
  87             return result['records']
  88         return []
  89 
  90     def _get_datastore_resource_id(self, context, dataset_id, resource_name):
  91         try:
  92             modified_context = dict(context)
  93             modified_context['ignore_auth'] = True
  94             dataset = get_action('package_show')(
  95                 modified_context, {'id': dataset_id})
  96 
  97             if 'resources' in dataset:
  98                 for r in dataset['resources']:
  99                     if 'datastore_active' in r and r['datastore_active'] \
  100                             and r['name'] == resource_name:
  101                         return r['id']
  102             return None
  103         except:
  104             log.warning('No dataset with id ' + dataset_id)
  105             return None
  106
  [end of ckanext-hdx_crisis/ckanext/hdx_crisis/controllers/crisis_controller.py]
  [start of ckanext-hdx_theme/ckanext/hdx_theme/version.py]
  1 hdx_version = 'v0.4.7'
  2
  [end of ckanext-hdx_theme/ckanext/hdx_theme/version.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/ckanext-hdx_crisis/ckanext/hdx_crisis/controllers/crisis_controller.py b/ckanext-hdx_crisis/ckanext/hdx_crisis/controllers/crisis_controller.py
  --- a/ckanext-hdx_crisis/ckanext/hdx_crisis/controllers/crisis_controller.py
  +++ b/ckanext-hdx_crisis/ckanext/hdx_crisis/controllers/crisis_controller.py
  @@ -19,6 +19,7 @@
   get_action = logic.get_action
   c = common.c
   request = common.request
  +_ = common._
   
   log = logging.getLogger(__name__)
   
  @@ -69,21 +70,34 @@
   
           return render('crisis/crisis.html')
   
  +    def _format_results(self, result):
  +        for r in result['records']:
  +            d = dt.datetime.strptime(r[u'latest_date'], '%Y-%m-%dT%H:%M:%S')
  +            r[u'latest_date'] = dt.datetime.strftime(d, '%b %d, %Y')
  +
  +            modified_value = r[u'value']
  +            if r[u'units'] == 'ratio':
  +                modified_value *= 100.0
  +            elif r[u'units'] == 'million':
  +                modified_value /= 1000000.0
  +
  +            int_value = int(modified_value)
  +            if int_value == modified_value:
  +                r[u'formatted_value'] = '{:,}'.format(int_value)
  +            else:
  +                if r[u'units'] == 'ratio':
  +                    r[u'formatted_value'] = '{:,.1f}%'.format(modified_value)
  +                elif r[u'units'] == 'million':
  +                    r[u'formatted_value'] = '{:,.1f} '.format(modified_value)
  +                    r[u'formatted_value'] += ' ' + _('million')
  +
       def _get_top_line_items(self, context, datastore_resource_id):
           modified_context = dict(context)
           modified_context['ignore_auth'] = True
           result = get_action('datastore_search')(
               modified_context, {'resource_id': datastore_resource_id})
           if 'records' in result:
  -            for r in result['records']:
  -                d = dt.datetime.strptime(
  -                    r[u'latest_date'], '%Y-%m-%dT%H:%M:%S')
  -                r[u'latest_date'] = dt.datetime.strftime(d, '%b %d, %Y')
  -                int_value = int(r[u'value'])
  -                if int_value == r[u'value']:
  -                    r[u'value'] = '{:,}'.format(int_value)
  -                else:
  -                    r[u'value'] = '{:,}'.format(r[u'value'])
  +            self._format_results(result)
               return result['records']
           return []
   
  diff --git a/ckanext-hdx_theme/ckanext/hdx_theme/version.py b/ckanext-hdx_theme/ckanext/hdx_theme/version.py
  --- a/ckanext-hdx_theme/ckanext/hdx_theme/version.py
  +++ b/ckanext-hdx_theme/ckanext/hdx_theme/version.py
  @@ -1 +1 @@
  -hdx_version = 'v0.4.7'
  +hdx_version = 'v0.4.8'
  
verification_info: {"golden_diff": "diff --git a/ckanext-hdx_crisis/ckanext/hdx_crisis/controllers/crisis_controller.py b/ckanext-hdx_crisis/ckanext/hdx_crisis/controllers/crisis_controller.py\n--- a/ckanext-hdx_crisis/ckanext/hdx_crisis/controllers/crisis_controller.py\n+++ b/ckanext-hdx_crisis/ckanext/hdx_crisis/controllers/crisis_controller.py\n@@ -19,6 +19,7 @@\n get_action = logic.get_action\n c = common.c\n request = common.request\n+_ = common._\n \n log = logging.getLogger(__name__)\n \n@@ -69,21 +70,34 @@\n \n         return render('crisis/crisis.html')\n \n+    def _format_results(self, result):\n+        for r in result['records']:\n+            d = dt.datetime.strptime(r[u'latest_date'], '%Y-%m-%dT%H:%M:%S')\n+            r[u'latest_date'] = dt.datetime.strftime(d, '%b %d, %Y')\n+\n+            modified_value = r[u'value']\n+            if r[u'units'] == 'ratio':\n+                modified_value *= 100.0\n+            elif r[u'units'] == 'million':\n+                modified_value /= 1000000.0\n+\n+            int_value = int(modified_value)\n+            if int_value == modified_value:\n+                r[u'formatted_value'] = '{:,}'.format(int_value)\n+            else:\n+                if r[u'units'] == 'ratio':\n+                    r[u'formatted_value'] = '{:,.1f}%'.format(modified_value)\n+                elif r[u'units'] == 'million':\n+                    r[u'formatted_value'] = '{:,.1f} '.format(modified_value)\n+                    r[u'formatted_value'] += ' ' + _('million')\n+\n     def _get_top_line_items(self, context, datastore_resource_id):\n         modified_context = dict(context)\n         modified_context['ignore_auth'] = True\n         result = get_action('datastore_search')(\n             modified_context, {'resource_id': datastore_resource_id})\n         if 'records' in result:\n-            for r in result['records']:\n-                d = dt.datetime.strptime(\n-                    r[u'latest_date'], '%Y-%m-%dT%H:%M:%S')\n-                r[u'latest_date'] = dt.datetime.strftime(d, '%b %d, %Y')\n-                int_value = int(r[u'value'])\n-                if int_value == r[u'value']:\n-                    r[u'value'] = '{:,}'.format(int_value)\n-                else:\n-                    r[u'value'] = '{:,}'.format(r[u'value'])\n+            self._format_results(result)\n             return result['records']\n         return []\n \ndiff --git a/ckanext-hdx_theme/ckanext/hdx_theme/version.py b/ckanext-hdx_theme/ckanext/hdx_theme/version.py\n--- a/ckanext-hdx_theme/ckanext/hdx_theme/version.py\n+++ b/ckanext-hdx_theme/ckanext/hdx_theme/version.py\n@@ -1 +1 @@\n-hdx_version = 'v0.4.7'\n+hdx_version = 'v0.4.8'\n", "issue": "Ebola Page: title case, please\nFor example, change `Appeal coverage` to `Appeal Coverage`\n\n![image](https://cloud.githubusercontent.com/assets/1654485/4974867/41867a20-68d1-11e4-92c9-e8956b974d8d.png)\n\n", "before_files": [{"content": "'''\nCreated on Nov 3, 2014\n\n@author: alexandru-m-g\n'''\n\nimport datetime as dt\n\nimport pylons.config as config\nimport logging\n\nimport ckan.lib.base as base\nimport ckan.logic as logic\nimport ckan.model as model\nimport ckan.common as common\nimport ckan.lib.helpers as h\n\nrender = base.render\nget_action = logic.get_action\nc = common.c\nrequest = common.request\n\nlog = logging.getLogger(__name__)\n\n\nclass CrisisController(base.BaseController):\n\n    def show(self):\n\n        context = {'model': model, 'session': model.Session,\n                   'user': c.user or c.author, 'for_view': True,\n                   'auth_user_obj': c.userobj}\n\n        datastore_resource_id = self._get_datastore_resource_id(\n            context, config.get('hdx.crisis.ebola_dataset', None), config.get('hdx.crisis.ebola_resource_title', None))\n        if datastore_resource_id:\n            c.top_line_items = self._get_top_line_items(\n                context, datastore_resource_id)\n\n        limit = 25\n        c.q = u'ebola'\n\n        page = int(request.params.get('page', 1))\n        data_dict = {'sort': u'metadata_modified desc',\n                     'fq': '+dataset_type:dataset',\n                     'rows': limit,\n                     'q': c.q,\n                     'start': (page - 1) * limit\n                     }\n        query = get_action(\"package_search\")(context, data_dict)\n\n        def pager_url(q=None, page=None):\n            return h.url_for('show_crisis', page=page)\n\n        c.page = h.Page(\n            collection=query['results'],\n            page=page,\n            url=pager_url,\n            item_count=query['count'],\n            items_per_page=limit\n        )\n        c.items = query['results']\n        c.item_count = query['count']\n\n        c.other_links = {}\n        c.other_links['show_more'] = h.url_for(\n            \"search\", **{'q': u'ebola', 'sort': u'metadata_modified desc',\n                         'ext_indicator': '0'})\n\n        return render('crisis/crisis.html')\n\n    def _get_top_line_items(self, context, datastore_resource_id):\n        modified_context = dict(context)\n        modified_context['ignore_auth'] = True\n        result = get_action('datastore_search')(\n            modified_context, {'resource_id': datastore_resource_id})\n        if 'records' in result:\n            for r in result['records']:\n                d = dt.datetime.strptime(\n                    r[u'latest_date'], '%Y-%m-%dT%H:%M:%S')\n                r[u'latest_date'] = dt.datetime.strftime(d, '%b %d, %Y')\n                int_value = int(r[u'value'])\n                if int_value == r[u'value']:\n                    r[u'value'] = '{:,}'.format(int_value)\n                else:\n                    r[u'value'] = '{:,}'.format(r[u'value'])\n            return result['records']\n        return []\n\n    def _get_datastore_resource_id(self, context, dataset_id, resource_name):\n        try:\n            modified_context = dict(context)\n            modified_context['ignore_auth'] = True\n            dataset = get_action('package_show')(\n                modified_context, {'id': dataset_id})\n\n            if 'resources' in dataset:\n                for r in dataset['resources']:\n                    if 'datastore_active' in r and r['datastore_active'] \\\n                            and r['name'] == resource_name:\n                        return r['id']\n            return None\n        except:\n            log.warning('No dataset with id ' + dataset_id)\n            return None\n", "path": "ckanext-hdx_crisis/ckanext/hdx_crisis/controllers/crisis_controller.py"}, {"content": "hdx_version = 'v0.4.7'\n", "path": "ckanext-hdx_theme/ckanext/hdx_theme/version.py"}]}