-
Notifications
You must be signed in to change notification settings - Fork 3
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
Making it run again #54
base: develop
Are you sure you want to change the base?
Conversation
The leadin `./` don't work with VSCode. Also alphabetically sorted. Signed-off-by: Paul Spooren <[email protected]>
Create contract before creating the invoices. Also print the mail address in the overview. Signed-off-by: Paul Spooren <[email protected]>
Use Pathlib to simplify template code. Also send all outgoing invoices to BCC as `rechnung` does not store mail in a *Sent* folder. Signed-off-by: Paul Spooren <[email protected]>
Using Umlaute in templates or yaml files caused trouble, now handle everything as UTF-8. Signed-off-by: Paul Spooren <[email protected]>
Use the `locale` module to print the correct currency instead of some self created format. Signed-off-by: Paul Spooren <[email protected]>
Decreses time wasted during debugging. Signed-off-by: Paul Spooren <[email protected]>
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 have looked over it and all in all it seems like a nice cleanup. 🙂
There are a a few minor comments inline.
assets/ | ||
bin/ | ||
contracts/ | ||
docs/_build/ | ||
invoices/ | ||
lib* | ||
pyvenv.cfg | ||
settings.yaml |
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.
Checking the current .gitignore
with the ./
lead-in using git check-ignore --verbose
, it seems indeed like these rules are broken and do never match.
However, it does not really seem like a good idea to me to add things like contracts/
or invoices/
to .gitignore
without making them relative to the repository root:
Imagine you are changing the contract.py
module in rechnung
into its own contracts
package.
With your change, this whole package would be ignored by git, because any directory that goes by the name of contracts
will be ignored anywhere in the repository.
The better solution might be to change all occurrences of ./
in the .gitignore
with /
:
- It's an allowed pattern
- It seems to match the originally intended meaning
- It doesn't ignore directories with common names broadly and unspecifically
contract = yaml.safe_load( | ||
(settings.contracts_dir / filename).read_text("utf-8") | ||
) |
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.
Reading everything into a buffer to then passing it to yaml.safe_load
seems rather inelegant, as yaml.safe_load
also accepts a stream.
Instead of using the read_text
method of pathlib and duplicating everything in memory, the encoding problems could probably also be solved like this:
contract = yaml.safe_load( | |
(settings.contracts_dir / filename).read_text("utf-8") | |
) | |
with open(Path(settings.contracts_dir / filename), "r", "utf-8") as contract_file: | |
contract = yaml.safe_load(contract_file) |
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.
After all I think the encoding was partly a problem on my side. I think some Python files where for whatever reason in a different encoding causing a lot of trouble. Should I fix this particular issue or should I revert it?
rechnung/contract.py
Outdated
@@ -23,6 +23,9 @@ def get_contracts(settings, year=None, month=None, cid_only=None, inactive=False | |||
(settings.contracts_dir / filename).read_text("utf-8") | |||
) | |||
|
|||
if not contract.get("active", False): |
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.
As this seems like a newly introduced feature, wouldn't it be better to default to a contract being active, so that not all existing active contracts need to be explicitly marked as active, but instead only the new inactive contracts need to be marked as inactive?
if not contract.get("active", False): | |
if not contract.get("active", True): |
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.
Good point!
If no clear state of `active` is given, guess that they are active as this is a new setting and may be missing in existing setups. Signed-off-by: Paul Spooren <[email protected]>
Signed-off-by: Paul Spooren <[email protected]>
Not touched for a long time, trying to run it introduced a whole bunch of problem. Here are some solved.