Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

--setting allow_download 0 causes a 500 error #61

Closed
simonw opened this issue Aug 24, 2022 · 3 comments
Closed

--setting allow_download 0 causes a 500 error #61

simonw opened this issue Aug 24, 2022 · 3 comments
Labels
bug Something isn't working

Comments

@simonw
Copy link
Owner

simonw commented Aug 24, 2022

[ERROR] NameError: name 'false' is not defined
Traceback (most recent call last):
File "/var/lang/lib/python3.9/importlib/__init__.py", line 127, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
      File "<frozen importlib._bootstrap>", line 1030, in _gcd_import
      File "<frozen importlib._bootstrap>", line 1007, in _find_and_load
      File "<frozen importlib._bootstrap>", line 986, in _find_and_load_unlocked
      File "<frozen importlib._bootstrap>", line 680, in _load_unlocked
      File "<frozen importlib._bootstrap_external>", line 850, in exec_module
      File "<frozen importlib._bootstrap>", line 228, in _call_with_frames_removed
      File "/var/task/vc__handler__python.py", line 12, in <module>
    __vc_spec.loader.exec_module(__vc_module)
      File "<frozen importlib._bootstrap_external>", line 850, in exec_module
      File "<frozen importlib._bootstrap>", line 228, in _call_with_frames_removed
      File "./index.py", line 27, in <module>
    settings={"allow_download": false}
Unknown application error occurred

Originally posted by @simonw in simonw/sfms-history#25 (comment)

@simonw simonw added the bug Something isn't working label Aug 24, 2022
@simonw
Copy link
Owner Author

simonw commented Aug 24, 2022

Here's the problem:

open("index.py", "w").write(
INDEX_PY.format(
database_files=json.dumps([os.path.split(f)[-1] for f in files]),
extras=", {}".format(", ".join(extras)) if extras else "",
statics=json.dumps(statics),
settings=json.dumps(dict(settings) or {}),
crossdb=",\n crossdb=True" if crossdb else "",
)
)

Using json.dumps() to produce Python source code means boolean false becomes false and not False.

@simonw
Copy link
Owner Author

simonw commented Aug 24, 2022

I'm going to do the cheapest fix: false = False and true = True.

@simonw
Copy link
Owner Author

simonw commented Aug 24, 2022

@simonw simonw closed this as completed in a56d153 Aug 24, 2022
simonw added a commit that referenced this issue Aug 24, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant