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

use default database path for location.Database() #4

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

eighthave
Copy link
Contributor

This is a naive sketch of the idea, since I've never written a Python module in C before. Basically, I propose that there is a constructor location.Database() which uses a built-in default path, e.g. /var/lib/location/database.db e.g. the value of @databasedir@.

This is a naive sketch of the idea, since I've never written a Python module in C before.  Basically, I propose that there is a constructor `location.Database()` which uses a built-in default path, e.g. _/var/lib/location/database.db_ e.g. the value of `@databasedir@`.
@mtremer
Copy link
Member

mtremer commented Sep 13, 2022

Hello 8,

what is the motivation for this change?

@eighthave
Copy link
Contributor Author

eighthave commented Sep 13, 2022 via email

@mtremer
Copy link
Member

mtremer commented Sep 13, 2022

I understand your point, but I am hesitant to implement this since the behaviour of the Python bindings would be different from C and Perl. If we would do this, we should have the library behave as similarly as possible for all.

@eighthave
Copy link
Contributor Author

eighthave commented Sep 13, 2022 via email

@mtremer
Copy link
Member

mtremer commented Sep 13, 2022

How about we export the default location as a constant which can then be passed to the Database() class?

@eighthave
Copy link
Contributor Author

eighthave commented Sep 13, 2022 via email

@mtremer
Copy link
Member

mtremer commented Sep 13, 2022

I agree. Just calling Database() is much neater. I just consider it being more of a low-level function which should not be called.

I would prefer something like "location.open()" or "location.open(path)".

@eighthave
Copy link
Contributor Author

eighthave commented Sep 13, 2022 via email

@mtremer
Copy link
Member

mtremer commented Sep 13, 2022

How does this look to you?

https://git.ipfire.org/?p=location/libloc.git;a=commitdiff;h=a0e8d454c80bf39d935b95c5fd53611db7cbb0e9
https://git.ipfire.org/?p=location/libloc.git;a=commitdiff;h=affa49242b5c3eb766872b480b1235f4d08fb02e

BTW, we don't intend to use GitHub PRs. We have documented this somewhere, but it is easily overlooked. So, I will delete this repository on here soon.

@eighthave
Copy link
Contributor Author

That looks great! Sorry about starting this on GitHub, no problem about removing it.

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 this pull request may close these issues.

2 participants