~launchpad-pqm/launchpad/devel

« back to all changes in this revision

Viewing changes to lib/lp/services/scripts/base.py

  • Committer: William Grant
  • Date: 2011-09-24 03:56:19 UTC
  • mto: This revision was merged to the branch mainline in revision 14030.
  • Revision ID: william.grant@canonical.com-20110924035619-ht8qu83op75xhdgr
LaunchpadScript no longer uses initZopeless.

Show diffs side-by-side

added added

removed removed

Lines of Context:
35
35
 
36
36
from canonical.config import config, dbconfig
37
37
from canonical.database.postgresql import ConnectionString
38
 
from canonical.database.sqlbase import (
39
 
    ISOLATION_LEVEL_DEFAULT,
40
 
    ZopelessTransactionManager,
41
 
    )
42
38
from canonical.launchpad import scripts
43
39
from canonical.launchpad.scripts.logger import OopsHandler
44
40
from canonical.launchpad.webapp.errorlog import globalErrorUtility
319
315
        """Actually run the script, executing zcml and initZopeless."""
320
316
 
321
317
        if isolation is None:
322
 
            isolation = ISOLATION_LEVEL_DEFAULT
 
318
            isolation = 'read_committed'
323
319
        self._init_zca(use_web_security=use_web_security)
324
320
        self._init_db(isolation=isolation)
325
321
 
365
361
        if dbuser is None:
366
362
            connstr = ConnectionString(dbconfig.main_master)
367
363
            dbuser = connstr.user or dbconfig.dbuser
368
 
        ZopelessTransactionManager.initZopeless(
369
 
            dbuser=dbuser, isolation=isolation)
 
364
        dbconfig.override(dbuser=dbuser, isolation_level=isolation)
370
365
        self.txn = transaction
371
366
 
372
367
    def record_activity(self, date_started, date_completed):
378
373
    @log_unhandled_exception_and_exit
379
374
    def lock_and_run(self, blocking=False, skip_delete=False,
380
375
                     use_web_security=False,
381
 
                     isolation=ISOLATION_LEVEL_DEFAULT):
 
376
                     isolation='read_committed'):
382
377
        """Call lock_or_die(), and then run() the script.
383
378
 
384
379
        Will die with sys.exit(1) if the locking call fails.