Merge lp:~rockstar/launchpad/recipe-security into lp:launchpad
| Status: | Merged |
|---|---|
| Approved by: | Robert Collins on 2010-07-21 |
| Approved revision: | no longer in the source branch. |
| Merged at revision: | 11194 |
| Proposed branch: | lp:~rockstar/launchpad/recipe-security |
| Merge into: | lp:launchpad |
| Diff against target: |
205 lines (+32/-9) 5 files modified
lib/lp/code/browser/sourcepackagerecipe.py (+2/-0) lib/lp/code/browser/tests/test_sourcepackagerecipe.py (+10/-3) lib/lp/code/configure.zcml (+5/-4) lib/lp/code/model/tests/test_sourcepackagerecipe.py (+12/-1) lib/lp/registry/model/person.py (+3/-1) |
| To merge this branch: | bzr merge lp:~rockstar/launchpad/recipe-security |
| Related bugs: |
| Reviewer | Review Type | Date Requested | Status |
|---|---|---|---|
| Robert Collins (community) | Approve on 2010-07-21 | ||
| Björn Tillenius (community) | Needs Information on 2010-07-01 | ||
| Jelmer Vernooij (community) | code | 2010-06-24 | Needs Information on 2010-06-24 |
|
Review via email:
|
|||
Description of the Change
This branch fixes bug #593221 - We changed the recipe permission to be launchpad.View. This had adverse affects because of the delegation from SourcePackageRecipe to SourcePackageRe
As reviewer, please make sure all the places I've opted to do transaction.commit are sane. Ask me why I put them where I put them, etc.
| Paul Hummer (rockstar) wrote : | # |
We've always used transaction.commit instead of Store.flush. transaction.commit apparently has some hooks in it.
I'd be curious to know where you found tests pass that don't need transaction.commit. I'm pretty sure it's only in places where I needed to get the tests to pass.
| Björn Tillenius (bjornt) wrote : | # |
On Wed, Jun 30, 2010 at 04:35:40PM -0000, Paul Hummer wrote:
> We've always used transaction.commit instead of Store.flush.
> transaction.commit apparently has some hooks in it.
>
> I'd be curious to know where you found tests pass that don't need
> transaction.commit. I'm pretty sure it's only in places where I needed
> to get the tests to pass.
I'd like to know more, why you need a transaction.
code. In tests it's ok, but it should be avoided in real code, since
it breaks the 'one transaction per request' model that is used
everywhere else. By doing commits you have the risk of errors happening
after the commit causing the DB to have an inconsistent state.
If the commit would be necessary, it should definitely have a big
comment, explaining why. But it seems odd that we need it.
vote needsinformation
--
Björn Tillenius | https:/
| Robert Collins (lifeless) wrote : | # |
Let me second Björn's query: committing in the middle of prod code has serious consequences and we should totally avoid it. flush() is ok.

Sorry - local email fail, so retrying here using the web UI.
The places where you transaction. commit( ) all make sense to me, right after you create SourcePackageRe cipes. They don't all appear to be necessary though (tests still pass after I remove them), presumably because we do commits in other places (that we shouldn't rely on) as well?
Another thought; would it perhaps be possible to use Store.of().flush() rather than transaction. commit( )? It seems to work in at least some of the cases.