This commit is contained in:
Leonel Câmara
2017-07-15 09:52:58 +01:00
parent 7a5f611e76
commit 780510dc32
2 changed files with 7 additions and 3 deletions
+2 -2
View File
@@ -415,10 +415,10 @@ def fix_newlines(path):
|\r|
)''')
for filename in listdir(path, '.*\.(py|html)$', drop=False):
rdata = read_file(filename, 'rb')
rdata = read_file(filename, 'r')
wdata = regex.sub('\n', rdata)
if wdata != rdata:
write_file(filename, wdata, 'wb')
write_file(filename, wdata, 'w')
def copystream(
+5 -1
View File
@@ -1,10 +1,11 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import os
import unittest
import datetime
from gluon.fileutils import parse_version
from gluon.fileutils import parse_version, fix_newlines, listdir
class TestFileUtils(unittest.TestCase):
@@ -22,3 +23,6 @@ class TestFileUtils(unittest.TestCase):
# Semantic Beta
rtn = parse_version('Version 2.14.1-beta+timestamp.2016.03.21.22.35.26')
self.assertEqual(rtn, (2, 14, 1, 'beta', datetime.datetime(2016, 3, 21, 22, 35, 26)))
def test_fix_newlines(self):
fix_newlines(os.path.dirname(os.path.abspath(__file__)))