simonw / datasette-publish-fly

Datasette plugin for publishing data using Fly
Apache License 2.0
20 stars 7 forks source link

`--setting force_https_urls 1` fails due to missing imports #26

Closed cldellow closed 1 year ago

cldellow commented 1 year ago
Traceback (most recent call last):
  File "/home/cldellow/src/dux-publish/venv/lib/python3.8/site-packages/datasette_publish_fly/__init__.py", line 62, in convert
    return name, value_as_boolean(value)
NameError: name 'value_as_boolean' is not defined

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/cldellow/src/dux-publish/venv/bin/datasette", line 8, in <module>
    sys.exit(cli())
  File "/home/cldellow/src/dux-publish/venv/lib/python3.8/site-packages/click/core.py", line 1130, in __call__
    return self.main(*args, **kwargs)
  File "/home/cldellow/src/dux-publish/venv/lib/python3.8/site-packages/click/core.py", line 1055, in main
    rv = self.invoke(ctx)
  File "/home/cldellow/src/dux-publish/venv/lib/python3.8/site-packages/click/core.py", line 1657, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/home/cldellow/src/dux-publish/venv/lib/python3.8/site-packages/click/core.py", line 1655, in invoke
    sub_ctx = cmd.make_context(cmd_name, args, parent=ctx)
  File "/home/cldellow/src/dux-publish/venv/lib/python3.8/site-packages/click/core.py", line 920, in make_context
    self.parse_args(ctx, args)
  File "/home/cldellow/src/dux-publish/venv/lib/python3.8/site-packages/click/core.py", line 1378, in parse_args
    value, args = param.handle_parse_result(ctx, opts, args)
  File "/home/cldellow/src/dux-publish/venv/lib/python3.8/site-packages/click/core.py", line 2360, in handle_parse_result
    value = self.process_value(ctx, value)
  File "/home/cldellow/src/dux-publish/venv/lib/python3.8/site-packages/click/core.py", line 2316, in process_value
    value = self.type_cast_value(ctx, value)
  File "/home/cldellow/src/dux-publish/venv/lib/python3.8/site-packages/click/core.py", line 2302, in type_cast_value
    return tuple(convert(x) for x in check_iter(value))
  File "/home/cldellow/src/dux-publish/venv/lib/python3.8/site-packages/click/core.py", line 2302, in <genexpr>
    return tuple(convert(x) for x in check_iter(value))
  File "/home/cldellow/src/dux-publish/venv/lib/python3.8/site-packages/click/types.py", line 82, in __call__
    return self.convert(value, param, ctx)
  File "/home/cldellow/src/dux-publish/venv/lib/python3.8/site-packages/datasette_publish_fly/__init__.py", line 63, in convert
    except ValueAsBooleanError:
NameError: name 'ValueAsBooleanError' is not defined

Adding the two missing imports seems to resolve it, https://github.com/simonw/datasette-publish-fly/pull/27 has a fix

jayljohnson commented 1 year ago

Thanks for the fix.

This also happens with other bool formats such as off/on, for example:

    datasette publish fly data/outputs/sqlite/mydb.db \
        --app="mydb" \
        --setting sql_time_limit_ms 25000 \
        --setting allow_download off

Is there a work-around to use this feature branch until it's merged? I'm new to datasette and plugins. Does this doc section have the correct steps? https://docs.datasette.io/en/0.23.1/plugins.html#writing-plugins

cldellow commented 1 year ago

I think you can install my branch by doing:

datasette install git+https://github.com/cldellow/datasette-publish-fly@33d3b73cd275e059e2b10d6775dc82aba72a4d92
cldellow commented 1 year ago

The docs you linked to are a bit out of date, they're for version 0.23.1, which was released in 2018

https://docs.datasette.io/en/stable/plugins.html is the analagous page for the current release