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

Fix double stdout fixes #393 #394

Merged
merged 39 commits into from
Aug 15, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
39 commits
Select commit Hold shift + click to select a range
bd4b7a5
Merge pull request #135 from moremoban/dev
chfw Nov 18, 2018
37a8ec9
Merge pull request #136 from moremoban/dev
chfw Nov 18, 2018
1b0e365
Merge pull request #138 from moremoban/dev
chfw Nov 27, 2018
a32f8ed
Merge pull request #140 from moremoban/dev
chfw Dec 10, 2018
eadf553
Merge pull request #145 from moremoban/dev
chfw Dec 30, 2018
f794c20
Merge pull request #149 from moremoban/dev
chfw Jan 6, 2019
234efa4
Merge pull request #162 from moremoban/dev
chfw Jan 12, 2019
5deada1
Merge pull request #177 from moremoban/dev
chfw Jan 18, 2019
3aebe49
Merge pull request #218 from moremoban/dev
chfw Feb 3, 2019
878c418
Merge pull request #228 from moremoban/dev
chfw Feb 20, 2019
4159e0f
Merge pull request #243 from moremoban/dev
chfw Feb 28, 2019
c2085cd
Merge pull request #252 from moremoban/dev
chfw Mar 8, 2019
dfe2066
Merge pull request #264 from moremoban/dev
chfw Mar 15, 2019
818172f
Merge pull request #270 from moremoban/dev
chfw May 26, 2019
050d94c
Merge pull request #273 from moremoban/dev
chfw Jul 7, 2019
e64e83d
Merge pull request #294 from moremoban/dev
chfw Jul 14, 2019
f5d36ec
Merge pull request #327 from moremoban/dev
chfw Sep 10, 2019
4427533
Merge pull request #330 from moremoban/dev
chfw Sep 10, 2019
566384a
Merge pull request #334 from moremoban/dev
chfw Sep 14, 2019
2a4a333
Merge pull request #337 from moremoban/dev
chfw Sep 25, 2019
ac9633e
Merge pull request #339 from moremoban/dev
chfw Oct 5, 2019
2683e96
Merge pull request #344 from moremoban/dev
chfw Oct 12, 2019
72b16af
Merge pull request #345 from moremoban/dev
chfw Oct 12, 2019
e456f2a
Merge pull request #348 from moremoban/dev
chfw Nov 10, 2019
65bfc7e
Merge pull request #353 from moremoban/dev
chfw Dec 1, 2019
a823a37
Merge pull request #358 from moremoban/dev
chfw Dec 7, 2019
24ecad3
Merge pull request #362 from moremoban/dev
chfw Jan 18, 2020
934cf0a
Merge pull request #371 from moremoban/dev
chfw Apr 25, 2020
d1c6baf
Merge pull request #372 from moremoban/dev
chfw Apr 25, 2020
c2c1c2d
Merge pull request #375 from moremoban/dev
chfw May 1, 2020
e8bd2e0
Merge pull request #377 from moremoban/dev
chfw May 2, 2020
53ea91a
Merge pull request #380 from moremoban/dev
chfw May 13, 2020
9e18752
Merge pull request #382 from moremoban/dev
chfw May 21, 2020
48febc9
Merge pull request #384 from moremoban/dev
chfw May 22, 2020
6327c62
Merge pull request #386 from moremoban/dev
chfw May 24, 2020
df46756
Merge pull request #388 from moremoban/dev
chfw Jun 9, 2020
141d3be
Merge pull request #392 from moremoban/dev
chfw Aug 6, 2020
430e40b
:ambulance: fixes double printing on stdout from template file
salotz Aug 12, 2020
33ddd07
updates changelog and contributors for PR
salotz Aug 12, 2020
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 9 additions & 1 deletion CHANGELOG.rst
Original file line number Diff line number Diff line change
@@ -1,13 +1,21 @@
Change log
================================================================================

0.7.10 - unreleased
--------------------------------------------------------------------------------

**Updated**

#. `#393 <https://github.com/moremoban/moban/issues/393>`_: Rendered
content output to stdout twice

0.7.9 - 06.08.2020
--------------------------------------------------------------------------------

**Updated**

#. `#390 <https://github.com/moremoban/moban/issues/390>`_: single render action
will print to stdout by defafult
will print to stdout by default

0.7.8 - 09.06.2020
--------------------------------------------------------------------------------
Expand Down
1 change: 1 addition & 0 deletions CONTRIBUTORS.rst
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,5 @@ In alphabetical order:
* `John Vandenberg <https://github.com/jayvdb>`_
* `Joshua Chung <https://github.com/seeeturtle>`_
* `PRAJWAL M <https://github.com/PrajwalM2212>`_
* `salotz <https://github.com/salotz>`_
* `SerekKiri <https://github.com/SerekKiri>`_
21 changes: 20 additions & 1 deletion moban/core/moban_factory.py
Original file line number Diff line number Diff line change
Expand Up @@ -156,21 +156,40 @@ def render_string_to_file(
self.buffered_writer.close()

def apply_template(self, template_abs_path, template, data, output_file):

# render the content
rendered_content = self.engine.apply_template(
template, data, output_file
)

# convert to utf8 if not already
if not isinstance(rendered_content, bytes):
rendered_content = rendered_content.encode("utf-8")

# attempt to output to the file and printing to stdout instead
# if not found
try:

# check if any of the files have changed
flag = HASH_STORE.is_file_changed(
output_file, rendered_content, template_abs_path
)

# if they have re-render things
if flag:

# write the content to the output file
self.buffered_writer.write_file_out(
output_file, rendered_content
)
if not file_system.is_zip_alike_url(output_file):

# attempt to copy the file permissions of the template
# file to the output file

# if it isn't an archive proceed or stdout
if (not file_system.is_zip_alike_url(output_file) and
output_file != '-'):

try:
file_system.file_permissions_copy(
template_abs_path, output_file
Expand Down