Merge lp:~adeuring/charmworld/1199790-last-change-error into lp:~juju-jitsu/charmworld/trunk
Status: | Merged |
---|---|
Approved by: | Abel Deuring |
Approved revision: | 329 |
Merged at revision: | 329 |
Proposed branch: | lp:~adeuring/charmworld/1199790-last-change-error |
Merge into: | lp:~juju-jitsu/charmworld/trunk |
Diff against target: |
228 lines (+82/-22) 7 files modified
charmworld/models.py (+17/-2) charmworld/testing/factory.py (+17/-13) charmworld/tests/test_models.py (+18/-4) charmworld/views/charms.py (+0/-1) charmworld/views/helpers.py (+7/-2) charmworld/views/tests/test_api.py (+12/-0) charmworld/views/tests/test_helpers.py (+11/-0) |
To merge this branch: | bzr merge lp:~adeuring/charmworld/1199790-last-change-error |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Abel Deuring (community) | Approve | ||
Aaron Bentley (community) | Approve | ||
Review via email: mp+177865@code.launchpad.net |
Commit message
Return dummy data for Charm.last_change and Charm.first_change, if a branch does not have any commits.
Description of the change
This branch fixes bug 1199780: search requests errors when a charm has no
last_change
While the root cause of the error described in the bug report (a branch is
registered in LP but no real branch exists) may be fixed by recent changes
to the ingest job, a similar situation may still exist: A branch that
exists but that has no commits.
This problem affects not only the API views but also views which
use the function views.helpers.
I changed class Charm in models.py so that it does not return None in
this case but some dummy data.
The function format_change() still needs a change: Calling
datetime.strftime() obviously does not work if for non-existent
timestamp -- and using a default timestamp does not make sense either.
This is fine as a first step, but I hope there will be a follow-on that changes all the views to check for None when accessing Charm.last_change and Charm.first_change, since that will look better.