Merge lp:~danilo/linaro-license-protection/bug-1075999 into lp:~linaro-automation/linaro-license-protection/trunk
Status: | Merged |
---|---|
Approved by: | Stevan Radaković |
Approved revision: | 149 |
Merged at revision: | 148 |
Proposed branch: | lp:~danilo/linaro-license-protection/bug-1075999 |
Merge into: | lp:~linaro-automation/linaro-license-protection/trunk |
Diff against target: |
171 lines (+107/-5) 3 files modified
license_protected_downloads/tests/__init__.py (+5/-1) license_protected_downloads/tests/test_views.py (+94/-0) license_protected_downloads/views.py (+8/-4) |
To merge this branch: | bzr merge lp:~danilo/linaro-license-protection/bug-1075999 |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Stevan Radaković | Approve | ||
Review via email: mp+133431@code.launchpad.net |
Description of the change
When loading a directory listing which contains subdirectories without BUILD-INFO file, we'd get an exception as seen in bug 1075999.
The problem is that BuildInfo(path) looks for BUILD-INFO.txt file in
path/BUILD-INFO.txt if path is a directory, and in dirname(
if it's not. However, the pre-check in is_protected() only checks for
dirname(
this returns the parent directory, and no BUILD-INFO.txt file is found.
I am not entirely sure of the intent of this code, so I am fixing it to work
and look for BUILD-INFO/
a few tests to ensure this works as I intended, but I plan to rework this to
be a bit saner and understandable (iow, encapsulated in the right places).
Tests
=====
To run the new tests
./manage.py test license_
QA
==
Create a directory with a file, BUILD-INFO.txt that opens it up and an empty
subdirectory. It should not crash when you browse into it.
Looks good, thanks for the fix.
Approve +1.