launchpad-reviewers team mailing list archive
-
launchpad-reviewers team
-
Mailing list archive
-
Message #06901
[Merge] lp:~cjwatson/launchpad/kill-sqlbase-commit into lp:launchpad
Colin Watson has proposed merging lp:~cjwatson/launchpad/kill-sqlbase-commit into lp:launchpad.
Requested reviews:
Launchpad code reviewers (launchpad-reviewers)
For more details, see:
https://code.launchpad.net/~cjwatson/launchpad/kill-sqlbase-commit/+merge/99526
sqlbase.commit has been marked DEPRECATED since September. Kill it off properly.
I fixed a bit of pre-existing lint. There was some more which was either a false positive:
./lib/lp/bugs/tests/bugs-emailinterface.txt
2358: Comment belongs in narrative.
... or didn't look like fixing it would be much of a readability improvement:
./lib/lp/translations/utilities/tests/test_xpi_po_exporter.py
133: E501 line too long (120 characters)
139: E501 line too long (90 characters)
181: E501 line too long (82 characters)
--
https://code.launchpad.net/~cjwatson/launchpad/kill-sqlbase-commit/+merge/99526
Your team Launchpad code reviewers is requested to review the proposed merge of lp:~cjwatson/launchpad/kill-sqlbase-commit into lp:launchpad.
=== modified file 'lib/lp/archiveuploader/tests/nascentupload-publishing-accepted-sources.txt'
--- lib/lp/archiveuploader/tests/nascentupload-publishing-accepted-sources.txt 2011-12-30 06:14:56 +0000
+++ lib/lp/archiveuploader/tests/nascentupload-publishing-accepted-sources.txt 2012-03-27 13:46:28 +0000
@@ -58,8 +58,7 @@
We have to commit in order to have new Librarian files available to
server by Librarian Server:
- >>> from lp.services.database.sqlbase import commit
- >>> commit()
+ >>> transaction.commit()
Now let's submit a new source version of ed (0.2-21) which will be
automatically accepted and published resulting in a PackageUpload
=== modified file 'lib/lp/archiveuploader/tests/upload-karma.txt'
--- lib/lp/archiveuploader/tests/upload-karma.txt 2011-12-30 06:14:56 +0000
+++ lib/lp/archiveuploader/tests/upload-karma.txt 2012-03-27 13:46:28 +0000
@@ -31,8 +31,7 @@
Nothing is printed from the listener yet, so no karma was assigned.
We'll accept the upload now.
- >>> from lp.services.database.sqlbase import commit
- >>> commit()
+ >>> transaction.commit()
>>> bar_src.queue_root.acceptFromQueue()
Karma added: action=distributionuploadaccepted, distribution=ubuntu
@@ -54,7 +53,7 @@
>>> name16 = getUtility(IPersonSet).getByName('name16')
>>> key = getUtility(IGPGKeySet).getGPGKeysForPeople([name16])[0]
>>> removeSecurityProxy(foo_src.queue_root).signing_key = key
- >>> commit()
+ >>> transaction.commit()
>>> foo_src.queue_root.acceptFromQueue()
Karma added: action=distributionuploadaccepted, distribution=ubuntu
Karma added: action=sponsoruploadaccepted, distribution=ubuntu
=== modified file 'lib/lp/bugs/doc/bugtask-expiration.txt'
--- lib/lp/bugs/doc/bugtask-expiration.txt 2012-03-08 11:51:36 +0000
+++ lib/lp/bugs/doc/bugtask-expiration.txt 2012-03-27 13:46:28 +0000
@@ -486,7 +486,8 @@
>>> BugTask.selectBy(status=BugTaskStatus.EXPIRED).count()
0
- >>> # We want to check the hoary bugtask messages later.
+We want to check the hoary bugtask messages later.
+
>>> starting_bug_messages_count = (hoary_bugtask.bug.messages.count())
The script 'expire-bugtasks.py' writes its report to stdout. It makes
@@ -499,7 +500,7 @@
# Commit the current transaction because the script will run in
# another transaction, and thus it won't see the changes done on
# this test unless we commit.
- >>> commit()
+ >>> transaction.commit()
>>> import subprocess
>>> process = subprocess.Popen(
=== modified file 'lib/lp/bugs/doc/bugtracker-person.txt'
--- lib/lp/bugs/doc/bugtracker-person.txt 2012-01-20 15:42:44 +0000
+++ lib/lp/bugs/doc/bugtracker-person.txt 2012-03-27 13:46:28 +0000
@@ -1,4 +1,5 @@
-= The BugTrackerPerson interface =
+The BugTrackerPerson interface
+==============================
The IBugTrackerPerson interfaces allows Launchpad to link Persons to
bugtrackers. BugTrackerPersons are created using the
@@ -18,7 +19,6 @@
We'll rename the bugtracker to make the tests more readable.
- >>> from lp.services.database.sqlbase import commit
>>> from lp.testing.dbuser import lp_dbuser
>>> with lp_dbuser():
@@ -60,7 +60,8 @@
name12
-== ensurePersonForSelf() ==
+ensurePersonForSelf()
+---------------------
IBugTracker has a method, ensurePersonForSelf(), which is
responsible for returning the correct BugTrackerPerson for a given
@@ -149,7 +150,7 @@
>>> print bugtracker_person.person.name
noemail-bugzilla-checkwatches
- >>> commit()
+ >>> transaction.commit()
If we rename the BugTracker and then create another with the same name,
calling ensurePersonForSelf() for 'noemail' on that BugTracker
=== modified file 'lib/lp/bugs/doc/externalbugtracker-debbugs.txt'
--- lib/lp/bugs/doc/externalbugtracker-debbugs.txt 2012-01-20 16:11:11 +0000
+++ lib/lp/bugs/doc/externalbugtracker-debbugs.txt 2012-03-27 13:46:28 +0000
@@ -621,13 +621,12 @@
bug numbers to be imported. It will link the bugs to the debbugs bug
tracker.
- >>> from lp.services.database.sqlbase import commit
>>> debbugs = getUtility(ILaunchpadCelebrities).debbugs
>>> [bug.title for bug in debbugs.getBugsWatching('237001')]
[]
>>> [bug.title for bug in debbugs.getBugsWatching('322535')]
[]
- >>> commit()
+ >>> transaction.commit()
# Make sane data to play this test.
>>> from lp.testing.dbuser import lp_dbuser
@@ -656,7 +655,7 @@
INFO Committing the transaction.
<BLANKLINE>
- >>> commit()
+ >>> transaction.commit()
>>> debbugs = getUtility(ILaunchpadCelebrities).debbugs
>>> [bug.title for bug in debbugs.getBugsWatching('237001')]
[u'evolution mail crashes on opening an email with a TIFF attachment']
=== modified file 'lib/lp/bugs/externalbugtracker/debbugs.py'
--- lib/lp/bugs/externalbugtracker/debbugs.py 2011-12-30 06:14:56 +0000
+++ lib/lp/bugs/externalbugtracker/debbugs.py 2012-03-27 13:46:28 +0000
@@ -1,4 +1,4 @@
-# Copyright 2009-2011 Canonical Ltd. This software is licensed under the
+# Copyright 2009-2012 Canonical Ltd. This software is licensed under the
# GNU Affero General Public License version 3 (see the file LICENSE).
"""Debbugs ExternalBugTracker utility."""
@@ -19,6 +19,7 @@
import os.path
import pytz
+import transaction
from zope.component import getUtility
from zope.interface import implements
@@ -43,7 +44,6 @@
from lp.bugs.scripts import debbugs
from lp.services.config import config
from lp.services.database.isolation import ensure_no_transaction
-from lp.services.database.sqlbase import commit
from lp.services.mail.sendmail import simple_sendmail
from lp.services.messages.interfaces.message import IMessageSet
from lp.services.webapp import urlsplit
@@ -331,7 +331,7 @@
message = getUtility(IMessageSet).fromEmail(comment, poster,
parsed_message=parsed_comment, date_created=msg_date)
- commit()
+ transaction.commit()
return message
@ensure_no_transaction
=== modified file 'lib/lp/bugs/mail/tests/test_handler.py'
--- lib/lp/bugs/mail/tests/test_handler.py 2012-03-25 23:33:53 +0000
+++ lib/lp/bugs/mail/tests/test_handler.py 2012-03-27 13:46:28 +0000
@@ -1,4 +1,4 @@
-# Copyright 2010-2011 Canonical Ltd. This software is licensed under the
+# Copyright 2010-2012 Canonical Ltd. This software is licensed under the
# GNU Affero General Public License version 3 (see the file LICENSE).
"""Test MaloneHandler."""
@@ -29,7 +29,6 @@
)
from lp.bugs.model.bugnotification import BugNotification
from lp.services.config import config
-from lp.services.database.sqlbase import commit
from lp.services.identity.interfaces.emailaddress import EmailAddressStatus
from lp.services.mail import stub
from lp.services.webapp.authorization import LaunchpadSecurityPolicy
@@ -679,7 +678,7 @@
handler = MaloneHandler()
with person_logged_in(self.factory.makePerson()):
handler.process(msg, msg['To'])
- commit()
+ transaction.commit()
# Since there were no commands in the poorly-timestamped message, no
# error emails were generated.
self.assertEqual(stub.test_emails, [])
@@ -699,7 +698,7 @@
del stub.test_emails[:]
with person_logged_in(self.factory.makePerson()):
handler.process(msg, msg['To'])
- commit()
+ transaction.commit()
# Since there were no commands in the poorly-timestamped message, no
# error emails were generated.
self.assertEqual(stub.test_emails, [])
=== modified file 'lib/lp/bugs/tests/bugs-emailinterface.txt'
--- lib/lp/bugs/tests/bugs-emailinterface.txt 2012-03-01 05:12:30 +0000
+++ lib/lp/bugs/tests/bugs-emailinterface.txt 2012-03-27 13:46:28 +0000
@@ -86,7 +86,6 @@
>>> process_email(submit_mail)
- >>> from lp.services.database.sqlbase import commit
>>> from lp.bugs.interfaces.bug import IBugSet
>>> from lp.services.mail import stub
>>> bugset = getUtility(IBugSet)
@@ -269,7 +268,7 @@
... """
>>> process_email(comment_mail)
- >>> commit()
+ >>> transaction.commit()
>>> from lp.services.messages.interfaces.message import IMessageSet
>>> bug_one = bugset.get(1)
@@ -311,7 +310,7 @@
... """
>>> process_email(edit_mail)
- >>> commit()
+ >>> transaction.commit()
No comments were added to the bugs:
@@ -340,7 +339,7 @@
... """
>>> process_email(edit_mail)
- >>> commit()
+ >>> transaction.commit()
This time, neither bug four or five were updated.
@@ -352,7 +351,7 @@
And the person sending the email has received an error message.
>>> def print_latest_email():
- ... commit()
+ ... transaction.commit()
... if not stub.test_emails:
... raise AssertionError("No emails queued!")
... from_addr, to_addrs, raw_message = stub.test_emails[-1]
@@ -423,7 +422,7 @@
... /Sample Person
... """
>>> process_email(comment_mail)
- >>> commit()
+ >>> transaction.commit()
The Malone handler saw that this email was signed, but since
IWeaklyAuthenticatedPrincipal was provided by the current principal, no
@@ -462,7 +461,7 @@
... msg, msg['To'],
... )
True
- >>> commit()
+ >>> transaction.commit()
>>> added_message = getUtility(IMessageSet).get('<yada-yada-test2>')[0]
Traceback (most recent call last):
@@ -499,7 +498,7 @@
... /Sample Person
... """
>>> process_email(comment_mail)
- >>> commit()
+ >>> transaction.commit()
>>> added_message = getUtility(IMessageSet).get('<yada-yada-test3>')[0]
>>> bug_one = bugset.get(1)
@@ -532,7 +531,7 @@
... handler.process(
... msg, msg['To'],
... )
- ... commit()
+ ... transaction.commit()
>>> def submit_commands(bug, *commands):
... msg = construct_command_email(bug, *commands)
@@ -714,7 +713,7 @@
True
>>> bug_four.setPrivate(False, getUtility(ILaunchBag).user)
True
- >>> commit()
+ >>> transaction.commit()
Specifying something else than 'yes' or 'no' produces an error:
@@ -1040,7 +1039,7 @@
user.
>>> bug = new_firefox_bug()
- >>> commit()
+ >>> transaction.commit()
>>> submit_commands(bug, 'cve no-such-cve')
>>> bug.cves.count()
0
@@ -1163,7 +1162,7 @@
>>> login(sampledata.USER_EMAIL)
>>> bug = new_firefox_bug()
- >>> commit()
+ >>> transaction.commit()
>>> login('no-priv@xxxxxxxxxxxxx')
>>> for bugtask in bug.bugtasks:
@@ -2046,7 +2045,7 @@
The To and Subject headers got set to the values we provided:
- >>> commit()
+ >>> transaction.commit()
>>> from_addr, to_addrs, raw_message = stub.test_emails[-1]
>>> sent_msg = email.message_from_string(raw_message)
>>> sent_msg['To']
@@ -2104,7 +2103,7 @@
... sampledata.USER_EMAIL, 'Some subject', 'Some error message.',
... test_msg, failing_command=['foo bar'],
... max_return_size=max_return_size)
- >>> commit()
+ >>> transaction.commit()
>>> from_addr, to_addrs, raw_message = stub.test_emails[-1]
>>> sent_msg = email.message_from_string(raw_message)
>>> failure_msg, original_msg = sent_msg.get_payload()
@@ -2226,7 +2225,7 @@
fail, and 'status triaged' which is OK. 'security' commands cause the
entire email to not to be processed, though.
- >>> commit()
+ >>> transaction.commit()
>>> submit_mail = """From: Sample Person <test@xxxxxxxxxxxxx>
... To: %s@xxxxxxxxxxxxxxxxxx
... Date: Thu Apr 3 11:53:23 BST 2008
@@ -2378,7 +2377,7 @@
... if len(list(attachments)) == 0:
... print "No attachments"
... return
- ... commit()
+ ... transaction.commit()
... for attachment in attachments:
... lib = attachment.libraryfile
... print lib.__class__.__name__, lib.filename, lib.mimetype,
@@ -2984,7 +2983,7 @@
>>> bug_with_watch = firefox.createBug(CreateBugParams(
... no_priv, 'New Bug with watch',
... msg=initial_bug_message, datecreated=creation_date))
- >>> commit()
+ >>> transaction.commit()
>>> with lp_dbuser():
... from lp.app.interfaces.launchpad import ILaunchpadCelebrities
@@ -3044,7 +3043,7 @@
... }
>>> process_email(reply_mail)
- >>> commit()
+ >>> transaction.commit()
>>> [reply_message] = list(bug_with_watch.messages)[-1:]
>>> print reply_message.rfc822msgid
@@ -3108,7 +3107,7 @@
... }
>>> process_email(reply_mail)
- >>> commit()
+ >>> transaction.commit()
>>> [reply_message] = list(bug_with_watch.messages)[-1:]
=== modified file 'lib/lp/bugs/tests/test_doc.py'
--- lib/lp/bugs/tests/test_doc.py 2012-01-20 15:42:44 +0000
+++ lib/lp/bugs/tests/test_doc.py 2012-03-27 13:46:28 +0000
@@ -1,4 +1,4 @@
-# Copyright 2009 Canonical Ltd. This software is licensed under the
+# Copyright 2009-2012 Canonical Ltd. This software is licensed under the
# GNU Affero General Public License version 3 (see the file LICENSE).
"""
@@ -11,7 +11,6 @@
from lp.code.tests.test_doc import branchscannerSetUp
from lp.services.config import config
-from lp.services.database.sqlbase import commit
from lp.services.mail.tests.test_doc import ProcessMailLayer
from lp.soyuz.tests.test_doc import (
lobotomize_stevea,
@@ -104,7 +103,6 @@
def bugtaskExpirationSetUp(test):
"""Setup globs for bug expiration."""
setUp(test)
- test.globs['commit'] = commit
login('test@xxxxxxxxxxxxx')
=== modified file 'lib/lp/codehosting/tests/servers.py'
--- lib/lp/codehosting/tests/servers.py 2011-12-30 06:14:56 +0000
+++ lib/lp/codehosting/tests/servers.py 2012-03-27 13:46:28 +0000
@@ -1,4 +1,4 @@
-# Copyright 2009 Canonical Ltd. This software is licensed under the
+# Copyright 2009-2012 Canonical Ltd. This software is licensed under the
# GNU Affero General Public License version 3 (see the file LICENSE).
"""Server used in codehosting acceptance tests."""
@@ -19,6 +19,7 @@
get_transport,
Server,
)
+import transaction
from twisted.python.util import sibpath
from zope.component import getUtility
@@ -29,7 +30,6 @@
from lp.registry.interfaces.ssh import ISSHKeySet
from lp.services.config import config
from lp.services.daemons.tachandler import TacTestSetup
-from lp.services.database.sqlbase import commit
def set_up_test_user(test_user, test_team):
@@ -53,7 +53,7 @@
'Z5Q8/OTdViTaalvGXaRIsBdaQamHEBB+Vek/VpnF1UGGm8YAAABAaCXDl0r1k93J'
'hnMdF0ap4UJQ2/NnqCyoE8Xd5KdUWWwqwGdMzqB1NOeKN6ladIAXRggLc2E00Usn'
'UXh3GE3Rgw== testuser')
- commit()
+ transaction.commit()
class CodeHostingTac(TacTestSetup):
=== modified file 'lib/lp/registry/doc/mailinglist-xmlrpc.txt'
--- lib/lp/registry/doc/mailinglist-xmlrpc.txt 2011-12-24 15:18:32 +0000
+++ lib/lp/registry/doc/mailinglist-xmlrpc.txt 2012-03-27 13:46:28 +0000
@@ -7,8 +7,8 @@
initiated by Mailman in all cases; in other words, Mailman polls Launchpad to
see if there is any work for Mailman to do.
- >>> # Note that this test is run multiple times, with the harness
- >>> # providing `mailinglist_api` and `commit` for impedance matching.
+Note that this test is run multiple times, with the harness providing
+`mailinglist_api` and `commit` for impedance matching.
Constructing the mailing lists
@@ -29,7 +29,7 @@
>>> no_priv = person_set.getByName('no-priv')
>>> team_one = factory.makeTeam(no_priv, name='team-one')
>>> team_two = factory.makeTeam(no_priv, name='team-two')
- >>> commit()
+ >>> transaction.commit()
A team owner must request that a mailing list be created for their team. When
Mailman polls for actions, there will be mailing lists to create.
@@ -38,7 +38,7 @@
>>> list_set = getUtility(IMailingListSet)
>>> list_one = list_set.new(team_one)
>>> list_two = list_set.new(team_two)
- >>> commit()
+ >>> transaction.commit()
>>> print list_one.status.name
APPROVED
>>> print list_two.status.name
@@ -85,7 +85,7 @@
... 'team-two': 'failure',
... })
True
- >>> commit()
+ >>> transaction.commit()
We can see that the statuses of the mailing lists have been updated in the
database.
@@ -113,7 +113,7 @@
... subscription_policy=TeamSubscriptionPolicy.RESTRICTED,
... visibility=PersonVisibility.PRIVATE)
>>> list_private = list_set.new(team_private)
- >>> commit()
+ >>> transaction.commit()
Now there is another mailing list for Mailman to create.
@@ -125,7 +125,7 @@
... 'team-private': 'success',
... })
True
- >>> commit()
+ >>> transaction.commit()
Deactivating mailing lists
@@ -138,7 +138,7 @@
Now, say team one's owner wants to deactivate their list.
>>> list_one.deactivate()
- >>> commit()
+ >>> transaction.commit()
This will show up in the actions pending for Mailman.
@@ -153,10 +153,10 @@
>>> ddaa = person_set.getByName('ddaa')
>>> team_three = person_set.newTeam(ddaa, 'team-three', 'Team Three')
>>> list_three = list_set.new(team_three)
- >>> commit()
+ >>> transaction.commit()
>>> pending_actions = mailinglist_api.getPendingActions()
- >>> commit()
+ >>> transaction.commit()
>>> print_actions(pending_actions)
team-three --> create {}
team-one --> deactivate
@@ -164,7 +164,7 @@
True
>>> list_three = list_set.get('team-three')
>>> list_three.deactivate()
- >>> commit()
+ >>> transaction.commit()
We now have two active mailing lists for which deactivation has been
requested.
@@ -201,7 +201,7 @@
>>> list_four = list_set.new(team_four)
>>> team_five = person_set.newTeam(ddaa, 'team-five', 'Team Five')
>>> list_five = list_set.new(team_five)
- >>> commit()
+ >>> transaction.commit()
>>> pending_actions = mailinglist_api.getPendingActions()
>>> print_actions(pending_actions)
team-five --> create {}
@@ -211,7 +211,7 @@
... 'team-five': 'success',
... })
True
- >>> commit()
+ >>> transaction.commit()
>>> mailinglist_api.getPendingActions()
{}
@@ -222,7 +222,7 @@
>>> list_four.welcome_message = u'Welcome to Team Four'
>>> list_five = list_set.get('team-five')
>>> list_five.welcome_message = u'Welcome to Team Five'
- >>> commit()
+ >>> transaction.commit()
>>> print_actions(mailinglist_api.getPendingActions())
team-five --> modify {'welcome_message': u'Welcome to Team Five'}
team-four --> modify {'welcome_message': u'Welcome to Team Four'}
@@ -337,7 +337,7 @@
>>> list_four = list_set.get('team-four')
>>> list_four.deactivate()
- >>> commit()
+ >>> transaction.commit()
>>> pending_actions = mailinglist_api.getPendingActions()
>>> print_actions(pending_actions)
team-four --> deactivate
=== modified file 'lib/lp/registry/doc/message-holds-xmlrpc.txt'
--- lib/lp/registry/doc/message-holds-xmlrpc.txt 2010-10-09 16:36:22 +0000
+++ lib/lp/registry/doc/message-holds-xmlrpc.txt 2012-03-27 13:46:28 +0000
@@ -36,7 +36,7 @@
>>> mailinglist_api.holdMessage('team-one', message_anne.as_string())
True
- >>> commit()
+ >>> transaction.commit()
This message is now in Launchpad's librarian and accessible through the
IMessageApprovalSet interface.
@@ -104,7 +104,7 @@
Anne's message is on-topic so the list administrator approves it.
>>> held_message_anne.approve(team_one.teamowner)
- >>> commit()
+ >>> transaction.commit()
>>> held_message_anne.status
<DBItem PostedMessageStatus.APPROVAL_PENDING, (20) Approval pending>
@@ -126,7 +126,7 @@
True
>>> held_message_bart = message_set.getMessageByMessageID('<second-post>')
>>> held_message_bart.reject(team_one.teamowner)
- >>> commit()
+ >>> transaction.commit()
>>> held_message_bart.status
<DBItem PostedMessageStatus.REJECTION_PENDING, (30) Decline pending>
@@ -148,7 +148,7 @@
True
>>> held_message_cris = message_set.getMessageByMessageID('<third-post>')
>>> held_message_cris.discard(team_one.teamowner)
- >>> commit()
+ >>> transaction.commit()
>>> held_message_cris.status
<DBItem PostedMessageStatus.DISCARD_PENDING, (60) Discard pending>
@@ -192,7 +192,7 @@
>>> from lp.registry.interfaces.mailinglist import IMailingListSet
>>> list_private = getUtility(IMailingListSet).new(team_private)
- >>> commit()
+ >>> transaction.commit()
>>> ignore = mail_helpers.pop_notifications()
>>> private_message = message_from_string("""\
@@ -208,7 +208,7 @@
>>> mailinglist_api.holdMessage(
... 'team-private', private_message.as_string())
True
- >>> commit()
+ >>> transaction.commit()
Once the message is approved in Launchpad, Mailman will allow it to be posted
to the mailing list.
@@ -216,7 +216,7 @@
>>> held_message_private = message_set.getMessageByMessageID(
... '<fourth-post>')
>>> held_message_private.approve(team_private.teamowner)
- >>> commit()
+ >>> transaction.commit()
>>> dispositions = mailinglist_api.getMessageDispositions()
>>> print_dispositions(dispositions)
@@ -247,7 +247,7 @@
... 'team-one',
... xmlrpclib.Binary(spam_message.as_string()))
True
- >>> commit()
+ >>> transaction.commit()
>>> held_message_spam = message_set.getMessageByMessageID(
... '<fifth-post\\xa9>')
=== modified file 'lib/lp/services/database/sqlbase.py'
--- lib/lp/services/database/sqlbase.py 2012-02-21 22:46:28 +0000
+++ lib/lp/services/database/sqlbase.py 2012-03-27 13:46:28 +0000
@@ -5,7 +5,6 @@
__all__ = [
'block_implicit_flushes',
'clear_current_connection_cache',
- 'commit',
'connect',
'convert_storm_clause_to_string',
'cursor',
@@ -49,7 +48,6 @@
Storm,
)
from storm.zope.interfaces import IZStorm
-import transaction
from twisted.python.util import mergeFunctionMetadata
from zope.component import getUtility
from zope.interface import implements
@@ -558,11 +556,6 @@
return mergeFunctionMetadata(func, reset_store_decorator)
-# DEPRECATED -- use transaction.commit() directly.
-def commit():
- transaction.commit()
-
-
def connect(user=None, dbname=None, isolation=ISOLATION_LEVEL_DEFAULT):
"""Return a fresh DB-API connection to the MAIN MASTER database.
=== modified file 'lib/lp/services/librarian/doc/librarian.txt'
--- lib/lp/services/librarian/doc/librarian.txt 2012-02-15 04:09:40 +0000
+++ lib/lp/services/librarian/doc/librarian.txt 2012-03-27 13:46:28 +0000
@@ -294,7 +294,9 @@
librarian.
>>> from zope.interface.verify import verifyObject
- >>> from lp.services.librarian.interfaces.client import IRestrictedLibrarianClient
+ >>> from lp.services.librarian.interfaces.client import (
+ ... IRestrictedLibrarianClient,
+ ... )
>>> restricted_client = getUtility(IRestrictedLibrarianClient)
>>> verifyObject(IRestrictedLibrarianClient, restricted_client)
True
@@ -589,8 +591,7 @@
Commit the just-created files.
- >>> from lp.services.database.sqlbase import commit
- >>> commit()
+ >>> transaction.commit()
>>> deleted_file = getUtility(ILibraryFileAliasSet)[deleted_file.id]
>>> print deleted_file.deleted
=== modified file 'lib/lp/soyuz/doc/distroarchseriesbinarypackage.txt'
--- lib/lp/soyuz/doc/distroarchseriesbinarypackage.txt 2012-01-20 15:42:44 +0000
+++ lib/lp/soyuz/doc/distroarchseriesbinarypackage.txt 2012-03-27 13:46:28 +0000
@@ -228,8 +228,7 @@
...
>>> cprov.archive.updateArchiveCache()
- >>> from lp.services.database.sqlbase import commit
- >>> commit()
+ >>> transaction.commit()
>>> flush_database_updates()
Then, supersede all pmount publications in warty for pmount (this sets
@@ -252,7 +251,7 @@
>>> for p in pubs:
... if p.binarypackagerelease.binarypackagename == pmount_name:
... s = p.supersede()
- >>> commit()
+ >>> transaction.commit()
>>> flush_database_updates()
>>> switch_dbuser(config.statistician.dbuser)
=== modified file 'lib/lp/soyuz/scripts/tests/test_chrootmanager.py'
--- lib/lp/soyuz/scripts/tests/test_chrootmanager.py 2012-01-19 03:09:38 +0000
+++ lib/lp/soyuz/scripts/tests/test_chrootmanager.py 2012-03-27 13:46:28 +0000
@@ -10,11 +10,11 @@
import tempfile
from unittest import TestCase
+import transaction
from zope.component import getUtility
from lp.registry.interfaces.distribution import IDistributionSet
from lp.services.config import config
-from lp.services.database.sqlbase import commit
from lp.soyuz.scripts.chrootmanager import (
ChrootManager,
ChrootManagerError,
@@ -89,7 +89,7 @@
self.assertEqual(chrootfilename, pocket_chroot.chroot.filename)
# required to turn librarian results visible.
- commit()
+ transaction.commit()
dest = self._create_file('chroot.gotten')
@@ -127,7 +127,7 @@
self.assertEqual(chrootfilename, pocket_chroot.chroot.filename)
# required to turn librarian results visible.
- commit()
+ transaction.commit()
chroot_manager = ChrootManager(self.distroarchseries)
=== modified file 'lib/lp/soyuz/stories/ppa/xx-ppa-files.txt'
--- lib/lp/soyuz/stories/ppa/xx-ppa-files.txt 2011-12-30 06:14:56 +0000
+++ lib/lp/soyuz/stories/ppa/xx-ppa-files.txt 2012-03-27 13:46:28 +0000
@@ -90,8 +90,7 @@
Commit everything.
- >>> from lp.services.database.sqlbase import commit
- >>> commit()
+ >>> transaction.commit()
PPA file links
@@ -283,7 +282,7 @@
... 'http://launchpad.dev/~no-priv/+archive/ppa/+files/%s' %
... dsc_file.filename)
- >>> commit()
+ >>> transaction.commit()
>>> logout()
>>> print file_librarian_url
@@ -355,7 +354,7 @@
>>> store.commit()
>>> from zope.security.proxy import removeSecurityProxy
>>> removeSecurityProxy(dsc_file).content = None
- >>> commit()
+ >>> transaction.commit()
The librarian URL for a deleted file is None, by convention. See
`ILibraryFileAlias` for more information on this.
=== modified file 'lib/lp/soyuz/tests/test_doc.py'
--- lib/lp/soyuz/tests/test_doc.py 2012-01-20 15:42:44 +0000
+++ lib/lp/soyuz/tests/test_doc.py 2012-03-27 13:46:28 +0000
@@ -1,4 +1,4 @@
-# Copyright 2009-2011 Canonical Ltd. This software is licensed under the
+# Copyright 2009-2012 Canonical Ltd. This software is licensed under the
# GNU Affero General Public License version 3 (see the file LICENSE).
"""
@@ -9,8 +9,9 @@
import os
import unittest
+import transaction
+
from lp.services.config import config
-from lp.services.database.sqlbase import commit
from lp.testing import logout
from lp.testing.dbuser import switch_dbuser
from lp.testing.layers import (
@@ -48,7 +49,7 @@
stevea_emailaddress = EmailAddress.byEmail(
'steve.alexander@xxxxxxxxxxxxxxx')
stevea_emailaddress.status = EmailAddressStatus.NEW
- commit()
+ transaction.commit()
def uploaderSetUp(test):
=== modified file 'lib/lp/translations/utilities/tests/test_xpi_po_exporter.py'
--- lib/lp/translations/utilities/tests/test_xpi_po_exporter.py 2011-12-30 06:14:56 +0000
+++ lib/lp/translations/utilities/tests/test_xpi_po_exporter.py 2012-03-27 13:46:28 +0000
@@ -1,4 +1,4 @@
-# Copyright 2009-2010 Canonical Ltd. This software is licensed under the
+# Copyright 2009-2012 Canonical Ltd. This software is licensed under the
# GNU Affero General Public License version 3 (see the file LICENSE).
__metaclass__ = type
@@ -6,6 +6,7 @@
from textwrap import dedent
import unittest
+import transaction
from zope.component import (
getAdapter,
getUtility,
@@ -15,7 +16,6 @@
from lp.app.interfaces.launchpad import ILaunchpadCelebrities
from lp.registry.interfaces.person import IPersonSet
from lp.registry.interfaces.product import IProductSet
-from lp.services.database.sqlbase import commit
from lp.testing.layers import LaunchpadZopelessLayer
from lp.translations.enums import RosettaImportStatus
from lp.translations.interfaces.potemplate import IPOTemplateSet
@@ -91,7 +91,7 @@
getUtility(ILaunchpadCelebrities).rosetta_experts)
# The file data is stored in the Librarian, so we have to commit the
# transaction to make sure it's stored properly.
- commit()
+ transaction.commit()
# Prepare the import queue to handle a new .xpi import.
(subject, body) = self.firefox_template.importFromQueue(entry)