602 handle lists indicated with comma specially#658
Conversation
Signed-off-by: fgeorgatos <[email protected]>
Signed-off-by: Fotis Georgatos <[email protected]>
Signed-off-by: Fotis Georgatos <[email protected]>
Signed-off-by: Fotis Georgatos <[email protected]>
…rces=,pi-3.14.tar.gz Signed-off-by: Fotis Georgatos <[email protected]>
Signed-off-by: Fotis Georgatos <[email protected]>
Signed-off-by: Fotis Georgatos <[email protected]>
There was a problem hiding this comment.
Can you clarify what's going on with a comment?
Why is it important to get rid of empty strings in val? What about None?
There was a problem hiding this comment.
The brief feedback for this diff is:
"if val dict contains empty strings '', filter them out from it, otherwise behave as before".
ie. I ride on the fact that current code cannot handle --amend=source=,tarball.tar.gz well and make a feature out of it.
If I'm not mistaken, this is what was proposed by you in an earlier message, no?
There was a problem hiding this comment.
Indeed, this looks nicer, let's fix it:
>>> val=['hello', '']
>>> fval = [x for x in val if x]
>>> fval
['hello']
There was a problem hiding this comment.
Your version is more general, i.e. it also filters out None, which shouldn't be there in the first place. So, it would hide bugs that introduced problems earlier... (sorry to be confusing)
There was a problem hiding this comment.
OK, our off-line discussion with Ken revealed that the following would be more intuitive:
- starts with comma => prepends # ,hello.tgz
- end with comma => append # hello.tgz,
- else => overwrite # hello.tgz,world.tgz
IMHO, we hit a case alike: http://golang.org/doc/go1compat.html -> "Specification"
and we should be going to fix the comma behavior, agreed?
There was a problem hiding this comment.
Fixed as asked, not yet tried in practice to make a comment on real-life results.
Signed-off-by: Fotis Georgatos <[email protected]>
There was a problem hiding this comment.
What's the logic about not including res.group(1) here? Shouldn't it be more something like:
fval = [x for x in val if x != '']
newval = "%s + %s" % (fval, res.group(1))There was a problem hiding this comment.
Ah, OK, now I see what's going on, it's about prepend vs overwrite... But the logic is reversed.
What we want is:
- starts with
,=> append to list - ends with
,=> prepend to list - else: overwrite
This breaks backward compatibility, but that's OK imho, since this is a rarely-depended on feature afaik.
Signed-off-by: Fotis Georgatos <[email protected]>
There was a problem hiding this comment.
Please fix indentation of comment.
Signed-off-by: Fotis Georgatos <[email protected]>
Signed-off-by: Fotis Georgatos <[email protected]>
… for prepend/append/overwrite feature for amending list easyconfig values
…ma_specially 602 handle lists indicated with comma specially
|
OK merged; nice extras from Ken on _log.debug; I also hadn't seen the indentation issue really until now (facepalm) |
|
Unit tests pass, so good to merge in! |
…th_comma_specially 602 handle lists indicated with comma specially
OK, this PR should allow the idea proposed by boegel in #602.