prompt: You will be provided with a partial code base and an issue statement explaining a problem to resolve.
  <issue>
  Recline does not preview datastore anymore
  The new plugin does not evaluate `datastore_active`.
  
  <!---
  @huboard:{"order":247.0}
  -->
  
  Recline does not preview datastore anymore
  The new plugin does not evaluate `datastore_active`.
  
  <!---
  @huboard:{"order":247.0}
  -->
  
  
  </issue>
  <code>
  [start of ckanext/reclinepreview/plugin.py]
  1 from logging import getLogger
  2 
  3 import ckan.plugins as p
  4 import ckan.plugins.toolkit as toolkit
  5 
  6 log = getLogger(__name__)
  7 
  8 
  9 class ReclinePreview(p.SingletonPlugin):
  10     """This extension previews resources using recline
  11 
  12     This extension implements two interfaces
  13 
  14       - ``IConfigurer`` allows to modify the configuration
  15       - ``IResourcePreview`` allows to add previews
  16     """
  17     p.implements(p.IConfigurer, inherit=True)
  18     p.implements(p.IResourcePreview, inherit=True)
  19 
  20     def update_config(self, config):
  21         ''' Set up the resource library, public directory and
  22         template directory for the preview
  23         '''
  24         toolkit.add_public_directory(config, 'theme/public')
  25         toolkit.add_template_directory(config, 'theme/templates')
  26         toolkit.add_resource('theme/public', 'ckanext-reclinepreview')
  27 
  28     def can_preview(self, data_dict):
  29         format_lower = data_dict['resource']['format'].lower()
  30         return format_lower in ['csv', 'xls', 'tsv']
  31 
  32     def preview_template(self, context, data_dict):
  33         return 'recline.html'
  34
  [end of ckanext/reclinepreview/plugin.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/reclinepreview/plugin.py b/ckanext/reclinepreview/plugin.py
  --- a/ckanext/reclinepreview/plugin.py
  +++ b/ckanext/reclinepreview/plugin.py
  @@ -26,6 +26,9 @@
           toolkit.add_resource('theme/public', 'ckanext-reclinepreview')
   
       def can_preview(self, data_dict):
  +        # if the resource is in the datastore then we can preview it with recline
  +        if data_dict['resource'].get('datastore_active'):
  +            return True
           format_lower = data_dict['resource']['format'].lower()
           return format_lower in ['csv', 'xls', 'tsv']
  
verification_info: {"golden_diff": "diff --git a/ckanext/reclinepreview/plugin.py b/ckanext/reclinepreview/plugin.py\n--- a/ckanext/reclinepreview/plugin.py\n+++ b/ckanext/reclinepreview/plugin.py\n@@ -26,6 +26,9 @@\n         toolkit.add_resource('theme/public', 'ckanext-reclinepreview')\n \n     def can_preview(self, data_dict):\n+        # if the resource is in the datastore then we can preview it with recline\n+        if data_dict['resource'].get('datastore_active'):\n+            return True\n         format_lower = data_dict['resource']['format'].lower()\n         return format_lower in ['csv', 'xls', 'tsv']\n", "issue": "Recline does not preview datastore anymore\nThe new plugin does not evaluate `datastore_active`.\n\n<!---\n@huboard:{\"order\":247.0}\n-->\n\nRecline does not preview datastore anymore\nThe new plugin does not evaluate `datastore_active`.\n\n<!---\n@huboard:{\"order\":247.0}\n-->\n\n", "before_files": [{"content": "from logging import getLogger\n\nimport ckan.plugins as p\nimport ckan.plugins.toolkit as toolkit\n\nlog = getLogger(__name__)\n\n\nclass ReclinePreview(p.SingletonPlugin):\n    \"\"\"This extension previews resources using recline\n\n    This extension implements two interfaces\n\n      - ``IConfigurer`` allows to modify the configuration\n      - ``IResourcePreview`` allows to add previews\n    \"\"\"\n    p.implements(p.IConfigurer, inherit=True)\n    p.implements(p.IResourcePreview, inherit=True)\n\n    def update_config(self, config):\n        ''' Set up the resource library, public directory and\n        template directory for the preview\n        '''\n        toolkit.add_public_directory(config, 'theme/public')\n        toolkit.add_template_directory(config, 'theme/templates')\n        toolkit.add_resource('theme/public', 'ckanext-reclinepreview')\n\n    def can_preview(self, data_dict):\n        format_lower = data_dict['resource']['format'].lower()\n        return format_lower in ['csv', 'xls', 'tsv']\n\n    def preview_template(self, context, data_dict):\n        return 'recline.html'\n", "path": "ckanext/reclinepreview/plugin.py"}]}