We are currently solving the following issue within our repository. Here is the issue text:
--- BEGIN ISSUE ---
Add default icon for TableBlock
As per https://github.com/torchbox/wagtail/pull/1705#issuecomment-216053655. Best to do this after #2417 is merged, to avoid conflicts.


--- END ISSUE ---

Below are some code segments, each from a relevant file. One or more of these files may contain bugs.
--- BEGIN FILES ---
Path: `wagtail/contrib/table_block/fields.py`
Content:
```
1 from __future__ import absolute_import, unicode_literals
2 
3 import json
4 
5 from django import forms
6 from django.template.loader import render_to_string
7 from django.utils import translation
8 from django.utils.functional import cached_property
9 
10 from wagtail.utils.widgets import WidgetWithScript
11 from wagtail.wagtailcore.blocks import FieldBlock
12 
13 
14 class TableInput(WidgetWithScript, forms.HiddenInput):
15 
16     def __init__(self, table_options=None, attrs=None):
17         self.table_options = table_options
18         super(TableInput, self).__init__(attrs=attrs)
19 
20     def render(self, name, value, attrs=None):
21         original_field_html = super(TableInput, self).render(name, value, attrs)
22         return render_to_string("table_block/widgets/table.html", {
23             'original_field_html': original_field_html,
24             'attrs': attrs,
25             'value': value,
26         })
27 
28     def render_js_init(self, id_, name, value):
29         return "initTable({0}, {1});".format(json.dumps(id_), json.dumps(self.table_options))
30 
31 
32 
33 class TableBlock(FieldBlock):
34     def __init__(self, required=True, help_text=None, table_options=None, **kwargs):
35         # CharField's 'label' and 'initial' parameters are not exposed, as Block handles that functionality
36         # natively (via 'label' and 'default')
37         # CharField's 'max_length' and 'min_length' parameters are not exposed as table data needs to
38         # have arbitrary length
39         # table_options can contain any valid handsontable options: http://docs.handsontable.com/0.18.0/Options.html
40         self.field_options = {'required': required, 'help_text': help_text}
41 
42         language = translation.get_language()
43         if language is not None and len(language) > 2:
44             language = language[:2]
45 
46         default_table_options = {
47             'minSpareRows': 0,
48             'startRows': 3,
49             'startCols': 3,
50             'colHeaders': False,
51             'rowHeaders': False,
52             'contextMenu': True,
53             'editor': 'text',
54             'stretchH': 'all',
55             'height': 108,
56             'language': language,
57             'renderer': 'text',
58             'autoColumnSize': False,
59         }
60         if table_options is not None:
61             default_table_options.update(table_options)
62         self.table_options = default_table_options
63         super(TableBlock, self).__init__(**kwargs)
64 
65     @cached_property
66     def field(self):
67         return forms.CharField(widget=TableInput(table_options=self.table_options), **self.field_options)
68 
69     def value_from_form(self, value):
70         return json.loads(value)
71 
72     def value_for_form(self, value):
73         return json.dumps(value)
74 
75     def is_html_renderer(self):
76         return self.table_options['renderer'] == 'html'
77 
78     def render(self, value):
79         template = getattr(self.meta, 'template', None)
80         if template and value:
81             table_header = value['data'][0] if value.get('data', None) and len(value['data']) > 0 and value.get('first_row_is_table_header', False) else None
82             first_col_is_header = value.get('first_col_is_header', False)
83             context = {
84                 'self': value,
85                 self.TEMPLATE_VAR: value,
86                 'table_header': table_header,
87                 'first_col_is_header': first_col_is_header,
88                 'html_renderer': self.is_html_renderer(),
89                 'data': value['data'][1:] if table_header else value.get('data', [])
90             }
91             return render_to_string(template, context)
92         else:
93             return self.render_basic(value)
94 
95     @property
96     def media(self):
97         return forms.Media(
98             css={'all': ['table_block/css/vendor/handsontable-0.24.2.full.min.css']},
99             js=['table_block/js/vendor/handsontable-0.24.2.full.min.js', 'table_block/js/table.js']
100         )
101 
102     class Meta:
103         default = None
104         template = 'table_block/blocks/table.html'
105
```
--- 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/wagtail/contrib/table_block/fields.py b/wagtail/contrib/table_block/fields.py
--- a/wagtail/contrib/table_block/fields.py
+++ b/wagtail/contrib/table_block/fields.py
@@ -29,7 +29,6 @@
         return "initTable({0}, {1});".format(json.dumps(id_), json.dumps(self.table_options))
 
 
-
 class TableBlock(FieldBlock):
     def __init__(self, required=True, help_text=None, table_options=None, **kwargs):
         # CharField's 'label' and 'initial' parameters are not exposed, as Block handles that functionality
@@ -102,3 +101,4 @@
     class Meta:
         default = None
         template = 'table_block/blocks/table.html'
+        icon = "table"

{"golden_diff": "diff --git a/wagtail/contrib/table_block/fields.py b/wagtail/contrib/table_block/fields.py\n--- a/wagtail/contrib/table_block/fields.py\n+++ b/wagtail/contrib/table_block/fields.py\n@@ -29,7 +29,6 @@\n         return \"initTable({0}, {1});\".format(json.dumps(id_), json.dumps(self.table_options))\n \n \n-\n class TableBlock(FieldBlock):\n     def __init__(self, required=True, help_text=None, table_options=None, **kwargs):\n         # CharField's 'label' and 'initial' parameters are not exposed, as Block handles that functionality\n@@ -102,3 +101,4 @@\n     class Meta:\n         default = None\n         template = 'table_block/blocks/table.html'\n+        icon = \"table\"\n", "issue": "Add default icon for TableBlock\nAs per https://github.com/torchbox/wagtail/pull/1705#issuecomment-216053655. Best to do this after #2417 is merged, to avoid conflicts.\n\n", "before_files": [{"content": "from __future__ import absolute_import, unicode_literals\n\nimport json\n\nfrom django import forms\nfrom django.template.loader import render_to_string\nfrom django.utils import translation\nfrom django.utils.functional import cached_property\n\nfrom wagtail.utils.widgets import WidgetWithScript\nfrom wagtail.wagtailcore.blocks import FieldBlock\n\n\nclass TableInput(WidgetWithScript, forms.HiddenInput):\n\n    def __init__(self, table_options=None, attrs=None):\n        self.table_options = table_options\n        super(TableInput, self).__init__(attrs=attrs)\n\n    def render(self, name, value, attrs=None):\n        original_field_html = super(TableInput, self).render(name, value, attrs)\n        return render_to_string(\"table_block/widgets/table.html\", {\n            'original_field_html': original_field_html,\n            'attrs': attrs,\n            'value': value,\n        })\n\n    def render_js_init(self, id_, name, value):\n        return \"initTable({0}, {1});\".format(json.dumps(id_), json.dumps(self.table_options))\n\n\n\nclass TableBlock(FieldBlock):\n    def __init__(self, required=True, help_text=None, table_options=None, **kwargs):\n        # CharField's 'label' and 'initial' parameters are not exposed, as Block handles that functionality\n        # natively (via 'label' and 'default')\n        # CharField's 'max_length' and 'min_length' parameters are not exposed as table data needs to\n        # have arbitrary length\n        # table_options can contain any valid handsontable options: http://docs.handsontable.com/0.18.0/Options.html\n        self.field_options = {'required': required, 'help_text': help_text}\n\n        language = translation.get_language()\n        if language is not None and len(language) > 2:\n            language = language[:2]\n\n        default_table_options = {\n            'minSpareRows': 0,\n            'startRows': 3,\n            'startCols': 3,\n            'colHeaders': False,\n            'rowHeaders': False,\n            'contextMenu': True,\n            'editor': 'text',\n            'stretchH': 'all',\n            'height': 108,\n            'language': language,\n            'renderer': 'text',\n            'autoColumnSize': False,\n        }\n        if table_options is not None:\n            default_table_options.update(table_options)\n        self.table_options = default_table_options\n        super(TableBlock, self).__init__(**kwargs)\n\n    @cached_property\n    def field(self):\n        return forms.CharField(widget=TableInput(table_options=self.table_options), **self.field_options)\n\n    def value_from_form(self, value):\n        return json.loads(value)\n\n    def value_for_form(self, value):\n        return json.dumps(value)\n\n    def is_html_renderer(self):\n        return self.table_options['renderer'] == 'html'\n\n    def render(self, value):\n        template = getattr(self.meta, 'template', None)\n        if template and value:\n            table_header = value['data'][0] if value.get('data', None) and len(value['data']) > 0 and value.get('first_row_is_table_header', False) else None\n            first_col_is_header = value.get('first_col_is_header', False)\n            context = {\n                'self': value,\n                self.TEMPLATE_VAR: value,\n                'table_header': table_header,\n                'first_col_is_header': first_col_is_header,\n                'html_renderer': self.is_html_renderer(),\n                'data': value['data'][1:] if table_header else value.get('data', [])\n            }\n            return render_to_string(template, context)\n        else:\n            return self.render_basic(value)\n\n    @property\n    def media(self):\n        return forms.Media(\n            css={'all': ['table_block/css/vendor/handsontable-0.24.2.full.min.css']},\n            js=['table_block/js/vendor/handsontable-0.24.2.full.min.js', 'table_block/js/table.js']\n        )\n\n    class Meta:\n        default = None\n        template = 'table_block/blocks/table.html'\n", "path": "wagtail/contrib/table_block/fields.py"}], "after_files": [{"content": "from __future__ import absolute_import, unicode_literals\n\nimport json\n\nfrom django import forms\nfrom django.template.loader import render_to_string\nfrom django.utils import translation\nfrom django.utils.functional import cached_property\n\nfrom wagtail.utils.widgets import WidgetWithScript\nfrom wagtail.wagtailcore.blocks import FieldBlock\n\n\nclass TableInput(WidgetWithScript, forms.HiddenInput):\n\n    def __init__(self, table_options=None, attrs=None):\n        self.table_options = table_options\n        super(TableInput, self).__init__(attrs=attrs)\n\n    def render(self, name, value, attrs=None):\n        original_field_html = super(TableInput, self).render(name, value, attrs)\n        return render_to_string(\"table_block/widgets/table.html\", {\n            'original_field_html': original_field_html,\n            'attrs': attrs,\n            'value': value,\n        })\n\n    def render_js_init(self, id_, name, value):\n        return \"initTable({0}, {1});\".format(json.dumps(id_), json.dumps(self.table_options))\n\n\nclass TableBlock(FieldBlock):\n    def __init__(self, required=True, help_text=None, table_options=None, **kwargs):\n        # CharField's 'label' and 'initial' parameters are not exposed, as Block handles that functionality\n        # natively (via 'label' and 'default')\n        # CharField's 'max_length' and 'min_length' parameters are not exposed as table data needs to\n        # have arbitrary length\n        # table_options can contain any valid handsontable options: http://docs.handsontable.com/0.18.0/Options.html\n        self.field_options = {'required': required, 'help_text': help_text}\n\n        language = translation.get_language()\n        if language is not None and len(language) > 2:\n            language = language[:2]\n\n        default_table_options = {\n            'minSpareRows': 0,\n            'startRows': 3,\n            'startCols': 3,\n            'colHeaders': False,\n            'rowHeaders': False,\n            'contextMenu': True,\n            'editor': 'text',\n            'stretchH': 'all',\n            'height': 108,\n            'language': language,\n            'renderer': 'text',\n            'autoColumnSize': False,\n        }\n        if table_options is not None:\n            default_table_options.update(table_options)\n        self.table_options = default_table_options\n        super(TableBlock, self).__init__(**kwargs)\n\n    @cached_property\n    def field(self):\n        return forms.CharField(widget=TableInput(table_options=self.table_options), **self.field_options)\n\n    def value_from_form(self, value):\n        return json.loads(value)\n\n    def value_for_form(self, value):\n        return json.dumps(value)\n\n    def is_html_renderer(self):\n        return self.table_options['renderer'] == 'html'\n\n    def render(self, value):\n        template = getattr(self.meta, 'template', None)\n        if template and value:\n            table_header = value['data'][0] if value.get('data', None) and len(value['data']) > 0 and value.get('first_row_is_table_header', False) else None\n            first_col_is_header = value.get('first_col_is_header', False)\n            context = {\n                'self': value,\n                self.TEMPLATE_VAR: value,\n                'table_header': table_header,\n                'first_col_is_header': first_col_is_header,\n                'html_renderer': self.is_html_renderer(),\n                'data': value['data'][1:] if table_header else value.get('data', [])\n            }\n            return render_to_string(template, context)\n        else:\n            return self.render_basic(value)\n\n    @property\n    def media(self):\n        return forms.Media(\n            css={'all': ['table_block/css/vendor/handsontable-0.24.2.full.min.css']},\n            js=['table_block/js/vendor/handsontable-0.24.2.full.min.js', 'table_block/js/table.js']\n        )\n\n    class Meta:\n        default = None\n        template = 'table_block/blocks/table.html'\n        icon = \"table\"\n", "path": "wagtail/contrib/table_block/fields.py"}]}