Merge lp:~stevanr/linaro-license-protection/add-textile-api into lp:~linaro-automation/linaro-license-protection/trunk

Proposed by Stevan Radaković
Status: Merged
Approved by: Stevan Radaković
Approved revision: 138
Merged at revision: 138
Proposed branch: lp:~stevanr/linaro-license-protection/add-textile-api
Merge into: lp:~linaro-automation/linaro-license-protection/trunk
Diff against target: 44 lines (+20/-0)
2 files modified
license_protected_downloads/views.py (+15/-0)
urls.py (+5/-0)
To merge this branch: bzr merge lp:~stevanr/linaro-license-protection/add-textile-api
Reviewer Review Type Date Requested Status
Georgy Redkozubov Approve
Review via email: mp+130809@code.launchpad.net

Description of the change

Add async call for fetching rendered textile files.

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

I would suggest to add 'type' check for test_path returned value if it is file.
Otherwise approved.

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'license_protected_downloads/views.py'
--- license_protected_downloads/views.py 2012-10-15 11:14:42 +0000
+++ license_protected_downloads/views.py 2012-10-22 12:50:35 +0000
@@ -1,5 +1,6 @@
1import glob1import glob
2import hashlib2import hashlib
3import json
3import mimetypes4import mimetypes
4import os5import os
5import re6import re
@@ -452,3 +453,17 @@
452 # TODO: Is it possible to add a redirect to response so we can take453 # TODO: Is it possible to add a redirect to response so we can take
453 # the user back to the original directory this file is in?454 # the user back to the original directory this file is in?
454 return response455 return response
456
457def get_textile_files(request):
458
459 if request.is_ajax():
460 result = test_path(request.GET.get("path"))
461 if not result:
462 raise Http404
463
464 type = result[0]
465 path = result[1]
466
467 return HttpResponse(json.dumps(RenderTextFiles.find_and_render(path)))
468 else:
469 raise NotImplementedError
455470
=== modified file 'urls.py'
--- urls.py 2012-10-10 14:52:13 +0000
+++ urls.py 2012-10-22 12:50:35 +0000
@@ -37,6 +37,11 @@
37 'license_protected_downloads.views.accept_license',37 'license_protected_downloads.views.accept_license',
38 name='accept_license'),38 name='accept_license'),
3939
40 # Recursively get files for rendering (async calls accepted only).
41 url(r'^get-textile-files',
42 'license_protected_downloads.views.get_textile_files',
43 name='get_textile_files'),
44
40 # Catch-all. We always return a file (or try to) if it exists.45 # Catch-all. We always return a file (or try to) if it exists.
41 # This handler does that.46 # This handler does that.
42 url(r'(?P<path>.*)', 'license_protected_downloads.views.file_server'),47 url(r'(?P<path>.*)', 'license_protected_downloads.views.file_server'),

Subscribers

People subscribed via source and target branches