-
Notifications
You must be signed in to change notification settings - Fork 64
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
Add kind column in contact table #309
Conversation
I probably should have made this a draft pull request… |
mypy and testsThe tests are also broken on the develop branch, I am working on it in #307. Some of your errors are already fixed in the github-actions branch but when you use nix you have to build a python env with the python packages you want, just installing them side by side does not work. Check https://nixos.org/manual/nixpkgs/stable/#python With
but with --ignore-missing-imports it is only
your PRFirstly: Thank you :)
And if a config option would actually have been needed it needs to be added to the config specification file.
|
Thanks for your feedback, I'll work it in. |
mypy does not run the tests. It is only a type checker. Use |
Remove kind setter as it is not relevant for displaying the kind attribute.
Thanks for your helpful explanations, @lucc. I went ahead and fixed the tests in regards to the newly added My preference would be to merge this PR once you find it acceptable and work on the ℹ️ I'm uncertain whether the following is an issue only with my setup, yet the |
I am unsure if we should display the kind attribute by default. My reasoning goes like this:
I have two ideas to improve this:
What do you think? |
I think your idea to improve displaying the |
when result list contains contacts different kinds.
@property | ||
def kind(self) -> str: | ||
kind = self._get_string_field("kind") or self._default_kind | ||
return kind if kind != "org" else "organisation" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm uncertain whether org
should be displayed as organisation
…
khard
requires to use organisations
when querying for the organisation. Yet the corresponding value of the KIND
property is defined as org
(see RFC 6350 6.1.4 KIND) and the RFC always spells it as organization
(note the use of z
instead of s
).
What are your thoughts on this @lucc
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That seems to be the difference between British and American English: https://en.wikipedia.org/wiki/Organization
I am not a native speaker and don't know what we have chosen in the rest of khard (I just greped from color
and colour
but there are no matches for either).
I think we we will take whichever and wait for somebody to complain.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sticking with the British spelling as khard
already uses "organisation" rather than "organization" seems to a good solution for the time being then.
when result list contains contacts with non-individual kinds
to configure whether the kind column should always be shown
@lucc, this should be ready for another look. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks good, just the test files seem to be missing.
@property | ||
def kind(self) -> str: | ||
kind = self._get_string_field("kind") or self._default_kind | ||
return kind if kind != "org" else "organisation" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That seems to be the difference between British and American English: https://en.wikipedia.org/wiki/Organization
I am not a native speaker and don't know what we have chosen in the rest of khard (I just greped from color
and colour
but there are no matches for either).
I think we we will take whichever and wait for somebody to complain.
@@ -210,6 +210,27 @@ def test_postaddr_lists_only_contacts_with_post_addresses(self): | |||
' SomeState, HomeCountry'] | |||
self.assertListEqual(expect, text) | |||
|
|||
def test_mixed_kinds(self): | |||
with TmpConfig(["org.vcf", "individual.vcf"]): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Did you commit these files? I don't see them.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I forgot to add them… 🤦♂️
Lets move on to #310 :) |
Thanks for merging, @lucc 😃 |
This is a first, likely incomplete, attempt to add a kind column in [the] contact table as mentioned in the
todo.txt
.I haven't been able to get the tests running with my
nixpkgs
setup on macOS due to errors (see below). Being unfamiliar withmypy
any comment that might be helpful is appreciated.% nix-shell -p nsh python3 python3Packages.unidecode python3Packages.ruamel-yaml python3Packages.vobject python3Packages.atomicwrites python3Packages.configobj python3Packages.setuptools python3Packages.pip pylint mypy --run "mypy khard"