Skip to content

Commit

Permalink
🔨 Use simple open in copy engine
Browse files Browse the repository at this point in the history
Closes #265
  • Loading branch information
ayan-b committed Apr 22, 2019
1 parent 9452524 commit e4442d0
Show file tree
Hide file tree
Showing 7 changed files with 612 additions and 7 deletions.
4 changes: 2 additions & 2 deletions .moban.cd/changelog.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@ name: moban
organisation: moremoban
releases:
- changes:
- action: N/A
- action: Updated
details:
- "Fill your description"
- "`#265`: Use simple `read binary` to read instead of encoding"
date: unreleased
version: 0.4.4
- changes:
Expand Down
5 changes: 3 additions & 2 deletions CHANGELOG.rst
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,11 @@ Change log
0.4.4 - unreleased
--------------------------------------------------------------------------------

N/A
Updated
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

#. Fill your description
#. `#265 <https://github.com/moremoban/moban/issues/265>`_: Use simple `read
binary` to read instead of encoding

0.4.3 - 16.03.2019
--------------------------------------------------------------------------------
Expand Down
3 changes: 1 addition & 2 deletions moban/copy/__init__.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
from lml.plugin import PluginInfo

import codecs

from moban import utils
from moban import constants
Expand Down Expand Up @@ -30,7 +29,7 @@ def get_template(self, template_file):
real_file_name = utils.find_file_in_template_dirs(
template_file, self.template_dirs
)
with codecs.open(real_file_name, encoding="utf-8") as file_handle:
with open(real_file_name, "rb") as file_handle:
return file_handle.read()

def get_template_from_string(self, string):
Expand Down
2 changes: 2 additions & 0 deletions moban/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,8 @@ def file_permissions(afile):


def strip_off_trailing_new_lines(content):
if isinstance(content, bytes):
content = content.decode("utf-8")
return re.sub(r"(\n\s+)+$", r"\n", content)


Expand Down
Loading

0 comments on commit e4442d0

Please sign in to comment.