Merge lp:~abentley/launchpad/forbidden-oops into lp:launchpad
| Status: | Merged |
|---|---|
| Approved by: | Edwin Grubbs on 2010-02-10 |
| Approved revision: | not available |
| Merged at revision: | not available |
| Proposed branch: | lp:~abentley/launchpad/forbidden-oops |
| Merge into: | lp:launchpad |
| Diff against target: |
130 lines (+49/-16) 4 files modified
lib/canonical/launchpad/mail/errortemplates/branch-creation-exception.txt (+2/-0) lib/lp/code/mail/codehandler.py (+8/-2) lib/lp/code/mail/tests/test_codehandler.py (+38/-13) lib/lp/code/model/branchnamespace.py (+1/-1) |
| To merge this branch: | bzr merge lp:~abentley/launchpad/forbidden-oops |
| Related bugs: |
| Reviewer | Review Type | Date Requested | Status |
|---|---|---|---|
| Edwin Grubbs (community) | code | 2010-02-10 | Approve on 2010-02-10 |
|
Review via email:
|
|||
Commit Message
Mail instead of oops when branch creation forbidden
| Aaron Bentley (abentley) wrote : | # |
| Edwin Grubbs (edwin-grubbs) wrote : | # |
Hi Aaron,
This is a nice branch. I just have two formatting suggestions.
merge-approved
-Edwin
>=== modified file 'lib/lp/
>--- lib/lp/
>+++ lib/lp/
>@@ -22,33 +22,35 @@
> from zope.security.proxy import removeSecurityProxy
>
> from canonical.config import config
>+from canonical.
>+from canonical.
>+ EmailProcessing
>+from canonical.
>+from canonical.
>+from canonical.
>+from canonical.
>+ get_current_
>+from canonical.
>+from canonical.testing import LaunchpadZopele
> from lp.code.enums import (
> BranchMergeProp
> BranchType, CodeReviewNotif
I think it would be helpful to add a blank line between
the canonical imports and the lp imports.
>-from lp.codehosting.vfs import get_lp_server
>-from lp.services.
>+from lp.code.enums import BranchVisibilit
> from lp.code.
>-from canonical.
> from lp.code.
> CreateMergeProp
>-from lp.code.model.diff import PreviewDiff
>-from canonical.
>- EmailProcessing
> from lp.code.
> AddReviewerEmai
> CodeReviewEmail
> InvalidBranchMe
> MissingMergeDir
> UpdateStatusEma
>-from canonical.
>+from lp.code.model.diff import PreviewDiff
>+from lp.codehosting.vfs import get_lp_server
>+from lp.registry.
>+from lp.services.
> from lp.testing import login, login_person, TestCase, TestCaseWithFactory
> from lp.testing.
>-from canonical.
>-from canonical.
>-from canonical.
>- get_current_
>-from canonical.
>-from canonical.testing import LaunchpadZopele
>
>
> class TestGetCodeEmai
>@@ -1054,6 +1056,27 @@
> # The hosted copy has not been updated.
> self.assertEqua
>
>+ def test_forbidden_
>+ """Specifying a branch in a forbidden target generates email."""
>+ ...

= Summary =
This fixes bug #492275, "OOPS when submitting merge request for a project that
I don't have access to"
== Proposed fix ==
Catch BranchCreation exceptions and send email to the sender.
== Pre-implementation notes ==
None
== Implementation details ==
The actual exception was using %r, which was causing the name to be shown as
a unicode literal, e.g. u'~person/product'. End users shouldn't see unicode
literals, so I changed it to "%s".
Also, I sorted the imports.
== Tests == target
bin/test test_codehandler -t test_forbidden_
== Demo and Q/A ==
Use bzr send to request a merge into a project that does not allow you to
create branches in it. If you get back an error, it works. If you get back
nothing or an OOPs, it's broken.
= Launchpad lint =
Checking for conflicts. and issues in doctests and templates.
Running jslint, xmllint, pyflakes, and pylint.
Using normal rules.
Linting changed files: code/mail/ codehandler. py code/mail/ tests/test_ codehandler. py /launchpad/ mail/errortempl ates/branch- creation- exception. txt code/model/ branchnamespace .py
lib/lp/
lib/lp/
lib/canonical
lib/lp/
== Pylint notices ==
lib/lp/ code/mail/ codehandler. py
37: [F0401] Unable to import 'lazr.uri' (No module named uri)
lib/lp/ code/model/ branchnamespace .py .event' (No module named lifecycle)
20: [F0401] Unable to import 'lazr.lifecycle