bugwarrior icon indicating copy to clipboard operation
bugwarrior copied to clipboard

Allow setting default priority to empty

Open Ktl-XV opened this issue 9 years ago • 18 comments

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

Ktl-XV avatar Dec 30 '16 23:12 Ktl-XV

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.

ryneeverett avatar Dec 31 '16 05:12 ryneeverett

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

pjf avatar Feb 20 '17 06:02 pjf

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?

coddingtonbear avatar Feb 21 '17 05:02 coddingtonbear

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!

pjf avatar Feb 21 '17 09:02 pjf

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 avatar Feb 22 '17 02:02 ryneeverett

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 avatar Dec 21 '20 16:12 ryneeverett

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

ryneeverett avatar Dec 29 '20 07:12 ryneeverett

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.

fmauch avatar Apr 29 '21 21:04 fmauch

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.

ryneeverett avatar Apr 30 '21 02:04 ryneeverett

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.

pcoves avatar Jun 29 '21 13:06 pcoves

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']

adriangalilea avatar Apr 16 '24 22:04 adriangalilea

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 = ""

ryneeverett avatar Apr 17 '24 00:04 ryneeverett

  • 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.

adriangalilea avatar Apr 17 '24 06:04 adriangalilea

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

ryneeverett avatar Apr 17 '24 13:04 ryneeverett

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.

Rahlir avatar May 07 '24 09:05 Rahlir

@Rahlir Maybe this should be opened then.

adriangalilea avatar May 07 '24 10:05 adriangalilea

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 avatar May 07 '24 14:05 ryneeverett