Merge lp:~wgrant/launchpad/fix-duplicate-harness-zcml into lp:launchpad

Proposed by William Grant
Status: Merged
Approved by: Abel Deuring
Approved revision: no longer in the source branch.
Merged at revision: not available
Proposed branch: lp:~wgrant/launchpad/fix-duplicate-harness-zcml
Merge into: lp:launchpad
Diff against target: 12 lines (+0/-2)
1 file modified
lib/canonical/database/harness.py (+0/-2)
To merge this branch: bzr merge lp:~wgrant/launchpad/fix-duplicate-harness-zcml
Reviewer Review Type Date Requested Status
Abel Deuring (community) code Approve
Review via email: mp+14464@code.launchpad.net
To post a comment you must log in.
Revision history for this message
William Grant (wgrant) wrote :

canonical.database.harness._get_locals calls execute_zcml_for_scripts, then executes script.zcml itself. Unfortunately, execute_zcml_for_scripts executes script.zcml itself, so all the ZCML is loaded twice. This means that "make harness" has duplicate subscriber registrations, causing calls like factory.makeBug() to fail with unique constraint violations.

To fix this, I've removed the direct execution of script.zcml.

To QA, verify that factory.makeBug() works in "make harness".

Revision history for this message
Abel Deuring (adeuring) wrote :

thanks for fixing this!

review: Approve (code)

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'lib/canonical/database/harness.py'
2--- lib/canonical/database/harness.py 2009-06-25 05:30:52 +0000
3+++ lib/canonical/database/harness.py 2009-11-05 13:40:27 +0000
4@@ -69,8 +69,6 @@
5 dbuser = None
6 print 'execute_zcml_for_scripts()...'
7 execute_zcml_for_scripts()
8- print 'xmlconfig.file()...'
9- xmlconfig.file('script.zcml', execute=True)
10 readline.parse_and_bind('tab: complete')
11 # Mimic the real interactive interpreter's loading of any $PYTHONSTARTUP file.
12 print 'Reading $PYTHONSTARTUP...'