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

Proposal: Remove logic duplication with templates #295

Merged
merged 1 commit into from Jul 24, 2020

Conversation

abravalheri
Copy link
Collaborator

@abravalheri abravalheri commented Jul 21, 2020

This is a follow up on top of #294 (although it can be reworked to not depend on it). So from reviewing purposes, it might be worthy to check just the latest commit, since the previous ones are included in #294.

There is some repeated logic when defining an structure with templates. The original API accepts either strings or None objects as file contents, but most of the time we pass either functions or
string.Template objects, which leads to code duplication for the majority of the templates.

This change intends to remove all the duplicated logic by allowing string.Template and callable objects to be passed directly as file contents, alongside str and None (backwards compatible).

There is some repeated logic when defining an structure with templates.
The original API accepts either strings or None objects as file
contents, but most of the time we pass either functions or
str.Templates, which leads to code duplication for the majority of the
templates.

This change intends to remove all the duplicated logic by allowing
str.Templates and callable to be passed directly as file contents,
alongside str and None (backwards compatible).
@abravalheri abravalheri merged commit 7de809d into pyscaffold:v4.0.x Jul 24, 2020
@abravalheri abravalheri deleted the dry-templates branch July 24, 2020 11:37
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.

None yet

1 participant