Merge lp:~gary/launchpad/bug676489 into lp:launchpad
| Status: | Merged |
|---|---|
| Approved by: | Gary Poster on 2010-11-17 |
| Approved revision: | no longer in the source branch. |
| Merged at revision: | 11935 |
| Proposed branch: | lp:~gary/launchpad/bug676489 |
| Merge into: | lp:launchpad |
| Diff against target: |
79 lines (+43/-7) 2 files modified
lib/lp/services/apachelogparser/base.py (+13/-7) lib/lp/services/apachelogparser/tests/test_apachelogparser.py (+30/-0) |
| To merge this branch: | bzr merge lp:~gary/launchpad/bug676489 |
| Related bugs: |
| Reviewer | Review Type | Date Requested | Status |
|---|---|---|---|
| Edwin Grubbs (community) | code | Approve on 2010-11-17 | |
| Benji York (community) | code* | 2010-11-17 | Approve on 2010-11-17 |
|
Review via email:
|
|||
Commit Message
[r=benji,
Description of the Change
This change fixes bug 676489 by adding code to handle a space in the path. I added tests for these changes, as well as for an existing code path pertinent to HTTP 1.0 possibly not including the protocol.
To run all the pertinent tests I know about, run ``./bin/test -vvt test_apachelogp
``make lint`` is happy.
Thank you.
| Edwin Grubbs (edwin-grubbs) wrote : | # |
Hi Gary,
I like benji's suggestion of using:
first, ignore, last = rest.rpartition(' ')
I believe our style guide wants a more explicit if-condition though. For example:
if first == "":
Otherwise, I think the branch is very nice.
-Edwin
| Benji York (benji) wrote : | # |
On Wed, Nov 17, 2010 at 5:27 PM, Edwin Grubbs
<email address hidden> wrote:
> I believe our style guide wants a more explicit if-condition though. For example:
> if first == "":
Correct: https:/
--
Benji York
| Gary Poster (gary) wrote : | # |
Thank you both. I changed the code per your suggestion.

This branch looks good. Edwin, my mentor, will also be reviewing it
momentarily.
I especially appreciate the thorough test coverage.
A small comment about this bit of code:
path, ignore, protocol = rest.rpartition(' ')
if not path:
# HTTP 1.0 requests might omit the HTTP version so we cope with them.
path = protocol
On first reading I'd expect the body of the if to assign a new value to
"protocol" as well (perhaps None).
On second reading I realize that protocol isn't used (other than if it
isn't actually the protocol) and wonder if restraining from naming the
strings until they're known-good might be better:
# HTTP 1.0 requests might omit the HTTP version so we cope with them.
first, ignore, last = rest.partition(' ')
if first:
path = first
else:
path = last
Or even the shorter but perhaps obscure:
# HTTP 1.0 requests might omit the HTTP version so we cope with them.
first, ignore, last = rest.partition(' ')
path = first or last