Merge lp:~stevanr/linaro-license-protection/fix-textile-version-problems into lp:~linaro-automation/linaro-license-protection/trunk

Proposed by Stevan Radaković
Status: Merged
Approved by: Stevan Radaković
Approved revision: 139
Merged at revision: 139
Proposed branch: lp:~stevanr/linaro-license-protection/fix-textile-version-problems
Merge into: lp:~linaro-automation/linaro-license-protection/trunk
Diff against target: 68 lines (+4/-15)
3 files modified
license_protected_downloads/render_text_files.py (+3/-3)
license_protected_downloads/tests/test_render_text_files.py (+0/-11)
license_protected_downloads/views.py (+1/-1)
To merge this branch: bzr merge lp:~stevanr/linaro-license-protection/fix-textile-version-problems
Reviewer Review Type Date Requested Status
Georgy Redkozubov Approve
Review via email: mp+130858@code.launchpad.net

Description of the change

Support textile 2.1.4.

To post a comment you must log in.
Revision history for this message
Georgy Redkozubov (gesha) wrote :

Good.

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'license_protected_downloads/render_text_files.py'
--- license_protected_downloads/render_text_files.py 2012-10-19 15:17:48 +0000
+++ license_protected_downloads/render_text_files.py 2012-10-22 17:04:19 +0000
@@ -1,6 +1,6 @@
1import os1import os
2import re2import re
3from textile.textilefactory import TextileFactory3import textile
4from collections import OrderedDict4from collections import OrderedDict
5from django.conf import settings5from django.conf import settings
66
@@ -36,6 +36,7 @@
36 'Firmware Update',36 'Firmware Update',
37 'RTSM']37 'RTSM']
3838
39
39class MultipleFilesException(Exception):40class MultipleFilesException(Exception):
40 pass41 pass
4142
@@ -88,8 +89,7 @@
88 def render_file(cls, filepath):89 def render_file(cls, filepath):
89 try:90 try:
90 file_obj = open(filepath, 'r')91 file_obj = open(filepath, 'r')
91 textile_factory = TextileFactory()92 return textile.textile(file_obj.read())
92 return textile_factory.process(file_obj.read())
93 except:93 except:
94 # Do nothing, parsing failed.94 # Do nothing, parsing failed.
95 pass95 pass
9696
=== modified file 'license_protected_downloads/tests/test_render_text_files.py'
--- license_protected_downloads/tests/test_render_text_files.py 2012-10-19 11:06:33 +0000
+++ license_protected_downloads/tests/test_render_text_files.py 2012-10-22 17:04:19 +0000
@@ -119,14 +119,3 @@
119 sorted(RenderTextFiles.find_relevant_files(android_path)))119 sorted(RenderTextFiles.find_relevant_files(android_path)))
120 self.assertEqual(sorted(full_ubuntu_files),120 self.assertEqual(sorted(full_ubuntu_files),
121 sorted(RenderTextFiles.find_relevant_files(ubuntu_path)))121 sorted(RenderTextFiles.find_relevant_files(ubuntu_path)))
122
123 def test_sort_paths_list_by_files_list(self):
124 path = self.make_temp_dir(empty=False, file_list=UBUNTU_FILES)
125 full_ubuntu_files = []
126 for file in UBUNTU_FILES:
127 full_ubuntu_files.append(os.path.join(path, file))
128 paths_list = RenderTextFiles.find_relevant_files(path)
129 self.assertEqual(full_ubuntu_files,
130 sorted(paths_list,
131 cmp=RenderTextFiles.sort_paths_list_by_files_list))
132 self.assertNotEqual(full_ubuntu_files, paths_list)
133122
=== modified file 'license_protected_downloads/views.py'
--- license_protected_downloads/views.py 2012-10-22 12:48:48 +0000
+++ license_protected_downloads/views.py 2012-10-22 17:04:19 +0000
@@ -454,6 +454,7 @@
454 # the user back to the original directory this file is in?454 # the user back to the original directory this file is in?
455 return response455 return response
456456
457
457def get_textile_files(request):458def get_textile_files(request):
458459
459 if request.is_ajax():460 if request.is_ajax():
@@ -461,7 +462,6 @@
461 if not result:462 if not result:
462 raise Http404463 raise Http404
463464
464 type = result[0]
465 path = result[1]465 path = result[1]
466466
467 return HttpResponse(json.dumps(RenderTextFiles.find_and_render(path)))467 return HttpResponse(json.dumps(RenderTextFiles.find_and_render(path)))

Subscribers

People subscribed via source and target branches