We are currently solving the following issue within our repository. Here is the issue text:
--- BEGIN 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}
-->


--- END ISSUE ---

Below are some code segments, each from a relevant file. One or more of these files may contain bugs.
--- BEGIN FILES ---
Path: `ckanext/reclinepreview/plugin.py`
Content:
```
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 FILES ---

Please first localize the bug based on the issue statement, and then generate a patch according to the `git diff` format fenced by three backticks.

Here is an example:

```diff
diff --git a/examples/server_async.py b/examples/server_async.py
--- a/examples/server_async.py
+++ b/examples/server_async.py
@@ -313,4 +313,4 @@
 
 
 if __name__ == "__main__":
-    asyncio.run(run_async_server("."), debug=True)
+    asyncio.run(run_async_server(), debug=True)
diff --git a/examples/server_sync.py b/examples/server_sync.py
--- a/examples/server_sync.py
+++ b/examples/server_sync.py
@@ -313,5 +313,5 @@
 
 
 if __name__ == "__main__":
-    server = run_sync_server(".")
+    server = run_sync_server()
     server.shutdown()

```

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']

{"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"}], "after_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        # 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\n    def preview_template(self, context, data_dict):\n        return 'recline.html'\n", "path": "ckanext/reclinepreview/plugin.py"}]}