8000 Vit fails when using new context definition (Taswkarrior 2.6.0) · Issue #305 · vit-project/vit · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Vit fails when using new context definition (Taswkarrior 2.6.0) #305

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.

8000

Already on GitHub? Sign in to your account

Closed
lambtho12 opened this issue Oct 8, 2021 · 7 comments
Closed

Vit fails when using new context definition (Taswkarrior 2.6.0) #305

lambtho12 opened this issue Oct 8, 2021 · 7 comments

Comments

@lambtho12
Copy link

Describe the bug

Taskwarrior 2.6.0 redefined the way context should be specified in the .taskrc. When using the new definition, vit will not start and throws the following error:

Traceback (most recent call last):
  File "/usr/bin/vit", line 33, in <module>
    sys.exit(load_entry_point('vit==2.1.0', 'console_scripts', 'vit')())
  File "/usr/lib/python3.9/site-packages/vit/command_line.py", line 5, in main
    Application(options, filters)
  File "/usr/lib/python3.9/site-packages/vit/application.py", line 74, in __init__
    self.refresh(False)
  File "/usr/lib/python3.9/site-packages/vit/application.py", line 894, in refresh
    self.bootstrap(load_early_config)
  File "/usr/lib/python3.9/site-packages/vit/application.py", line 107, in bootstrap
    self.load_contexts()
  File "/usr/lib/python3.9/site-packages/vit/application.py", line 101, in load_contexts
    self.contexts = self.task_config.get_contexts()
  File "/usr/lib/python3.9/site-packages/vit/config_parser.py", line 327, in get_contexts
    filters = shlex.split(re.sub(FILTER_PARENS_REGEX, r' \1 ', filters))
  File "/usr/lib/python3.9/re.py", line 210, in sub
    return _compile(pattern, flags).sub(repl, string, count)
TypeError: expected string or bytes-like object

To Reproduce

Create a minimal .taskrc with the new context defninition

context.work.read=project:Work
context.work.write=project:Work

Expected behavior

Vit should open normally

@thehunmonkgroup
Copy link
Member

Not sure how long this will take to fix. I'm guessing 2.6.0 is backwards compatible with the older context config, so for now, just use the older config style.

@tbabej
Copy link
Collaborator
tbabej commented Oct 9, 2021

@thehunmonkgroup Taskwarrior is indeed backwards compatible on this, so defining context.work=project:Work will work and apply it as both "write" and "read" context:

[warrior@tw-2.6.0 vit]$ task context list

Name Type  Definition   Active
work read  project:Work no    
     write project:Work no

[warrior@tw-2.6.0 vit]$ cat ~/.taskrc | grep context.work
context.work=project:Work

However, it goes without saying that without the new form people won't have the ability to differentiate between "read" and "write" 🙂

I can have a look if this is something that can be quickly fixed, if you prefer.

tbabej added a commit to tbabej/vit-1 that referenced this issue Oct 9, 2021
The context definition consists of two configuration variables in 2.6.0
and later, namely:

context.<name>.read=<filter>
context.<name>.write=<mods>

This makes config parser compatible with moth the new and the old
context definition styles. In the new style, the "read" context is used
for vit's purposes.

Closes vit-project#305.
tbabej added a commit to tbabej/vit-1 that referenced this issue Oct 9, 2021
The context definition consists of two configuration variables in 2.6.0
and later, namely:

context.<name>.read=<filter>
context.<name>.write=<mods>

This makes config parser compatible with moth the new and the old
context definition styles. In the new style, the "read" context is used
for vit's purposes.

Closes vit-project#305.
@thehunmonkgroup
Copy link
Member

@lambtho12 can you try latest master and see if the issue is fixed, and that contexts are behaving properly in vit? I think I got it, but didn't do heavy testing.

@thehunmonkgroup
Copy link
Member

OK, I had some bad code in there in my first commit, I think I have it now, let me know.

@tbabej
Copy link
Collaborator
tbabej commented Oct 9, 2021

🎉 Works for me (as in vit does not crash, and correctly filters the tasks according to the current context) both for old-style and new-style context definitions.

@lambtho12
Copy link
Author

Sorry for the delay. I confirm that it works for me as well.
Thank you for the quick fix.

@donnex
Copy link
donnex commented Oct 12, 2021

I'm using master as well with taskwarrior 2.6.0 and I've had 6505 no issues so far 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants
0