We are currently solving the following issue within our repository. Here is the issue text:
--- BEGIN ISSUE ---
Invalid session timeout value on CKAN 2.10 (logged out users unexpectedly)
## CKAN version
2.10

## Describe the bug

According to our config declaration for [`beaker.session.timeout`](https://github.com/ckan/ckan/blob/656a39de2e7ed0ce47e15080f0f5d42b66b4929b/ckan/config/config_declaration.yaml#L306):

> Defaults to never expiring.

But the defined default value is 600 :upside_down_face: 
Apart from the inconsistency, this is problematic because now that the logged-in user id is stored in the session by Flask-login, this means that users are logged out every 10 minutes.

The fix is to default it to never expire as described on the docs (which is also the [Beaker default](https://beaker.readthedocs.io/en/latest/configuration.html#session-options)), but the problem is that I can set it to `None` because then Beaker complains that the value is not an int:

```
  File "/home/adria/dev/pyenvs/gates/lib/python3.8/site-packages/beaker/util.py", line 290, in verify_rules
    params[key] = verify_options(params[key], types, message)
  File "/home/adria/dev/pyenvs/gates/lib/python3.8/site-packages/beaker/util.py", line 281, in verify_options
    raise Exception(error)
Exception: Session timeout must be an integer.
```
This is because our config parsing does not support "int or None", and leaves the string "None" as the value. I guess the alternative is to put a really big number but would be good to handle it better.


--- END ISSUE ---

Below are some code segments, each from a relevant file. One or more of these files may contain bugs.
--- BEGIN FILES ---
Path: `ckan/cli/shell.py`
Content:
```
1 # encoding: utf-8
2 import click
3 import logging
4 
5 import ckan.model as model
6 
7 from typing import Any, Mapping
8 
9 from ckan.plugins import toolkit
10 
11 
12 log = logging.getLogger(__name__)
13 
14 
15 _banner = """
16 ****** Welcome to the CKAN shell ******
17 
18 This session has some variables pre-populated:
19   - app (CKAN Application object)
20   - config (CKAN config dictionary)
21   - model (CKAN model module to access the Database)
22   - toolkit (CKAN toolkit module)
23     """
24 
25 
26 def ipython(namespace: Mapping[str, Any], banner: str) -> None:
27     import IPython
28     from traitlets.config.loader import Config
29 
30     c = Config()
31     c.TerminalInteractiveShell.banner2 = banner  # type: ignore
32 
33     IPython.start_ipython([], user_ns=namespace, config=c)
34 
35 
36 def python(namespace: Mapping[str, Any], banner: str) -> None:
37     import code
38     code.interact(banner=banner, local=namespace)
39 
40 
41 @click.command()
42 @click.help_option("-h", "--help")
43 @click.pass_context
44 def shell(ctx: click.Context):
45     """Run an interactive IPython shell with the context of the
46     CKAN instance.
47 
48     It will try to use IPython, if not installed it will callback
49     to the default Python's shell.
50     """
51 
52     namespace = {
53         "app": ctx.obj.app._wsgi_app,
54         "model": model,
55         "config": ctx.obj.config,
56         "toolkit": toolkit,
57     }
58 
59     try:
60         ipython(namespace, _banner)
61     except ImportError:
62         log.debug("`ipython` library is missing. Using default python shell.")
63         python(namespace, _banner)
64
```
--- 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/ckan/cli/shell.py b/ckan/cli/shell.py
--- a/ckan/cli/shell.py
+++ b/ckan/cli/shell.py
@@ -28,7 +28,7 @@
     from traitlets.config.loader import Config
 
     c = Config()
-    c.TerminalInteractiveShell.banner2 = banner  # type: ignore
+    c.TerminalInteractiveShell.banner2 = banner
 
     IPython.start_ipython([], user_ns=namespace, config=c)

{"golden_diff": "diff --git a/ckan/cli/shell.py b/ckan/cli/shell.py\n--- a/ckan/cli/shell.py\n+++ b/ckan/cli/shell.py\n@@ -28,7 +28,7 @@\n     from traitlets.config.loader import Config\n \n     c = Config()\n-    c.TerminalInteractiveShell.banner2 = banner  # type: ignore\n+    c.TerminalInteractiveShell.banner2 = banner\n \n     IPython.start_ipython([], user_ns=namespace, config=c)\n", "issue": "Invalid session timeout value on CKAN 2.10 (logged out users unexpectedly)\n## CKAN version\r\n2.10\r\n\r\n## Describe the bug\r\n\r\nAccording to our config declaration for [`beaker.session.timeout`](https://github.com/ckan/ckan/blob/656a39de2e7ed0ce47e15080f0f5d42b66b4929b/ckan/config/config_declaration.yaml#L306):\r\n\r\n> Defaults to never expiring.\r\n\r\nBut the defined default value is 600 :upside_down_face: \r\nApart from the inconsistency, this is problematic because now that the logged-in user id is stored in the session by Flask-login, this means that users are logged out every 10 minutes.\r\n\r\nThe fix is to default it to never expire as described on the docs (which is also the [Beaker default](https://beaker.readthedocs.io/en/latest/configuration.html#session-options)), but the problem is that I can set it to `None` because then Beaker complains that the value is not an int:\r\n\r\n```\r\n  File \"/home/adria/dev/pyenvs/gates/lib/python3.8/site-packages/beaker/util.py\", line 290, in verify_rules\r\n    params[key] = verify_options(params[key], types, message)\r\n  File \"/home/adria/dev/pyenvs/gates/lib/python3.8/site-packages/beaker/util.py\", line 281, in verify_options\r\n    raise Exception(error)\r\nException: Session timeout must be an integer.\r\n```\r\nThis is because our config parsing does not support \"int or None\", and leaves the string \"None\" as the value. I guess the alternative is to put a really big number but would be good to handle it better.\r\n\n", "before_files": [{"content": "# encoding: utf-8\nimport click\nimport logging\n\nimport ckan.model as model\n\nfrom typing import Any, Mapping\n\nfrom ckan.plugins import toolkit\n\n\nlog = logging.getLogger(__name__)\n\n\n_banner = \"\"\"\n****** Welcome to the CKAN shell ******\n\nThis session has some variables pre-populated:\n  - app (CKAN Application object)\n  - config (CKAN config dictionary)\n  - model (CKAN model module to access the Database)\n  - toolkit (CKAN toolkit module)\n    \"\"\"\n\n\ndef ipython(namespace: Mapping[str, Any], banner: str) -> None:\n    import IPython\n    from traitlets.config.loader import Config\n\n    c = Config()\n    c.TerminalInteractiveShell.banner2 = banner  # type: ignore\n\n    IPython.start_ipython([], user_ns=namespace, config=c)\n\n\ndef python(namespace: Mapping[str, Any], banner: str) -> None:\n    import code\n    code.interact(banner=banner, local=namespace)\n\n\n@click.command()\n@click.help_option(\"-h\", \"--help\")\n@click.pass_context\ndef shell(ctx: click.Context):\n    \"\"\"Run an interactive IPython shell with the context of the\n    CKAN instance.\n\n    It will try to use IPython, if not installed it will callback\n    to the default Python's shell.\n    \"\"\"\n\n    namespace = {\n        \"app\": ctx.obj.app._wsgi_app,\n        \"model\": model,\n        \"config\": ctx.obj.config,\n        \"toolkit\": toolkit,\n    }\n\n    try:\n        ipython(namespace, _banner)\n    except ImportError:\n        log.debug(\"`ipython` library is missing. Using default python shell.\")\n        python(namespace, _banner)\n", "path": "ckan/cli/shell.py"}], "after_files": [{"content": "# encoding: utf-8\nimport click\nimport logging\n\nimport ckan.model as model\n\nfrom typing import Any, Mapping\n\nfrom ckan.plugins import toolkit\n\n\nlog = logging.getLogger(__name__)\n\n\n_banner = \"\"\"\n****** Welcome to the CKAN shell ******\n\nThis session has some variables pre-populated:\n  - app (CKAN Application object)\n  - config (CKAN config dictionary)\n  - model (CKAN model module to access the Database)\n  - toolkit (CKAN toolkit module)\n    \"\"\"\n\n\ndef ipython(namespace: Mapping[str, Any], banner: str) -> None:\n    import IPython\n    from traitlets.config.loader import Config\n\n    c = Config()\n    c.TerminalInteractiveShell.banner2 = banner\n\n    IPython.start_ipython([], user_ns=namespace, config=c)\n\n\ndef python(namespace: Mapping[str, Any], banner: str) -> None:\n    import code\n    code.interact(banner=banner, local=namespace)\n\n\n@click.command()\n@click.help_option(\"-h\", \"--help\")\n@click.pass_context\ndef shell(ctx: click.Context):\n    \"\"\"Run an interactive IPython shell with the context of the\n    CKAN instance.\n\n    It will try to use IPython, if not installed it will callback\n    to the default Python's shell.\n    \"\"\"\n\n    namespace = {\n        \"app\": ctx.obj.app._wsgi_app,\n        \"model\": model,\n        \"config\": ctx.obj.config,\n        \"toolkit\": toolkit,\n    }\n\n    try:\n        ipython(namespace, _banner)\n    except ImportError:\n        log.debug(\"`ipython` library is missing. Using default python shell.\")\n        python(namespace, _banner)\n", "path": "ckan/cli/shell.py"}]}