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

Allow setting default priority to empty #426

Open
Ktl-XV opened this issue Dec 30, 2016 · 17 comments
Open

Allow setting default priority to empty #426

Ktl-XV opened this issue Dec 30, 2016 · 17 comments

Comments

@Ktl-XV
Copy link

Ktl-XV commented Dec 30, 2016

Hi, I want to set my default priority to none/empty, but this is currently not possible because ConfigParser always reads a string and taskw only accepts 'L', 'M', 'H' or the None literal.

I checked out the project and got it fixed, but before I can do a pull request, I am asking how do you prefer it to be fixed. This are the alternatives I can think of, from best to worse:

  1. After reading the config file check if the default_priority is 'None' as a string and change it to a literal. (Cons: doesn't feel like a clean solution)
  2. Make None the default_priority instead of 'M'. (Cons: It will change the current expected behavior of bugwarrior)
  3. Set the allow_no_value flag in ConfigParser. (Cons: it could make it difficult to spot and debug errors in the bugwarriorrc file)

P.S. Thanks for bugwarrior it is really useful

@ryneeverett
Copy link
Collaborator

I agree 1 doesn't seem clean. I don't feel strongly about 2 but I suspect the impact of changing a default like that is not worth it. I don't think 3 is a problem -- to me it's normal ini-file weirdness.

@pjf
Copy link
Contributor

pjf commented Feb 20, 2017

Totally voting for 3 here. Being able to write default_priority = feels like a very intuitive solution.

@coddingtonbear
Copy link
Collaborator

coddingtonbear commented Feb 21, 2017

Just to add a little detail to this discussion: what the allow_no_value option provides is the ability for you to specify config values without the = following afterward. That is, something like key_without_value below:

[somesection]
normal_key_with = value
key_without_value

I'm not at all opposed to turning on allow_no_value, but the parser will already parse default_priority = (returned value would be an empty string) with or without our turning on allow_no_value. Wouldn't it just be simpler to interpret default_priority = as requesting that tasks be imported without priority?

@pjf
Copy link
Contributor

pjf commented Feb 21, 2017

Oh gosh, default_priority = is exactly what I thought we were talking about, and mirrors how TaskWarrior sets the empty priority.

I'm now wondering if this worked all along and I just haven't been using it, in which case I'm going to feel very silly indeed!

@ryneeverett
Copy link
Collaborator

I had the same impression as @pjf. Apparently we don't need to make any change to the config parsing but perhaps just need to handle the None value.

@ryneeverett
Copy link
Collaborator

While the misconception was cleared up it would be good to document proper syntax in Common Service Configuration Options and perhaps add test(s) that the empty value works.

@ryneeverett
Copy link
Collaborator

Apparently the empty value does not currently work. See #795.

@fmauch
Copy link
Contributor

fmauch commented Apr 29, 2021

Hi, I haven't been actively using bugwarrior for a while now, but I am setting it up into my daily workflow again. I have been lying around local changes for quite a while now, one is for actually handling this, I think.

It's been 2.5 years when I made that change, I can't really follow my reasoning back then, but for me it does the job, so that could be a starting point. I use it in conjunction with gitlab, having the following line in my bugwarriorrc:

gitlab.default_priority =

I've also done some other changes that fit my workflow better, but cherry-picking this ontop of develop doesn't explode for me and doesn't add priorities to any of my tasks. So, this might be a starting point. I'd open a pull-request if desired.

Edit: I tried to get behind my reasoning back then and without those modifications, it works as well.

@ryneeverett ryneeverett changed the title Set default priority to empty Allow setting default priority to empty Apr 30, 2021
@ryneeverett
Copy link
Collaborator

ryneeverett commented Apr 30, 2021

To clarify, I think this issue is about allowing people to change the default_priority setting to empty rather than changing that setting's default value.

@pcoves
Copy link

pcoves commented Jun 29, 2021

Hey there.

I tried pretty much every thing before googling and finding this page.

  • gitlab.default_priority
  • gitlab.default_priority =
  • gitlab.default_priority = None
  • gitlab.default_priority = ''
  • gitlab.default_priority = 'None"
  • Etc

As said by @ryneeverett I simply want the default_priority to be None.
The default being M is not the issue but not being able to change it to None is.

ryneeverett added a commit to ryneeverett/bugwarrior that referenced this issue Mar 29, 2022
Contrary to my apparent previous assumptions, configparser returns an
empty string rather than None when encountering an empty assignment,
making this a fairly trivial solution.
ryneeverett added a commit to ryneeverett/bugwarrior that referenced this issue Mar 30, 2022
Contrary to my apparent previous assumptions, configparser returns an
empty string rather than None when encountering an empty assignment,
making this a fairly trivial solution.
@adriangalilea
Copy link

This needs better documentation.

I tried everything I could think of and it does not allow me to set it empty no matter what I do

ValueError: 'None' is not a valid choice; choices: ['H', '', 'L']

@ryneeverett
Copy link
Collaborator

Yeah, we should probably have a code block of examples in the Common Service Configuration Options section.

My recollection:

  • If you're using ini format it should be gitlab.default_priority=
  • If you're using toml it should be default_priority = ""

@adriangalilea
Copy link

  • If you're using ini format it should be gitlab.default_priority=
  • If you're using toml it should be default_priority = ""

I'm pretty sure I tried both, and none worked, had to use L meanwhile.

@ryneeverett
Copy link
Collaborator

@adriangalilea The fix for this bug has not yet been released and I suspect you're using the latest 1.8.0 stable release.

@Rahlir
Copy link

Rahlir commented May 7, 2024

Actually, no, empty string doesn't work in develop branch either. I am using toml config with default_priority = "" in jira and I get an error ValueError: 'None' is not a valid choice; choices: ['H', 'M', '', 'L']. Not sure why that is.

@adriangalilea
Copy link

@Rahlir Maybe this should be opened then.

@ryneeverett
Copy link
Collaborator

Actually, no, empty string doesn't work in develop branch either. I am using toml config with default_priority = "" in jira and I get an error ValueError: 'None' is not a valid choice; choices: ['H', 'M', '', 'L']. Not sure why that is.

Yikes. Thanks for the report!

@ryneeverett ryneeverett reopened this May 7, 2024
@ryneeverett ryneeverett added this to the release-next milestone May 7, 2024
NexAdn pushed a commit to NexAdn/bugwarrior that referenced this issue Sep 19, 2024
Contrary to my apparent previous assumptions, configparser returns an
empty string rather than None when encountering an empty assignment,
making this a fairly trivial solution.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

8 participants