Skip to content

Cannot save Todo without a list when adding an item to a non-default collection #599

@Hawk777

Description

@Hawk777

I’m running Todoman 4.6.0. I used todo new -i and filled in a few fields, including selecting a list I don’t use very often and that exists but has no items in it. When I saved the item, this happened and the item was not saved:

Traceback (most recent call last):
  File "/usr/lib/python-exec/python3.13/todo", line 8, in <module>
    sys.exit(cli())
             ~~~^^
  File "/usr/lib/python3.13/site-packages/click/core.py", line 1485, in __call__
    return self.main(*args, **kwargs)
           ~~~~~~~~~^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.13/site-packages/click/core.py", line 1406, in main
    rv = self.invoke(ctx)
  File "/usr/lib/python3.13/site-packages/click/core.py", line 1873, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
                           ~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^
  File "/usr/lib/python3.13/site-packages/click/core.py", line 1269, in invoke
    return ctx.invoke(self.callback, **ctx.params)
           ~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.13/site-packages/click/core.py", line 824, in invoke
    return callback(*args, **kwargs)
  File "/usr/lib/python3.13/site-packages/todoman/cli.py", line 250, in command_wrap
    return command(*a, **kw)
  File "/usr/lib/python3.13/site-packages/click/decorators.py", line 93, in new_func
    return ctx.invoke(f, obj, *args, **kwargs)
           ~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.13/site-packages/click/core.py", line 824, in invoke
    return callback(*args, **kwargs)
  File "/usr/lib/python3.13/site-packages/todoman/cli.py", line 50, in wrapper
    return f(*a, **kw)
  File "/usr/lib/python3.13/site-packages/todoman/cli.py", line 466, in new
    ctx.db.save(todo)
    ~~~~~~~~~~~^^^^^^
  File "/usr/lib/python3.13/site-packages/todoman/model.py", line 1124, in save
    raise ValueError("Cannot save Todo without a list.")

From further experiments, it seems as if this happens whenever I try to add an item to a collection other than the default one selected with default_list. Running todo new -i -l ListName works, so it seems to be related to a problem with selecting the list in the interactive view having not selected on the command line.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions