Edgewall Software

Opened 14 years ago

Last modified 14 years ago

#9059 closed defect

Error in trac-admin env upgrade - AttributeError: 'Environment' object has no attribute 'env' — at Version 1

Reported by: piotr@… Owned by: Christian Boos
Priority: high Milestone: 0.12
Component: admin/console Version: 0.12dev
Severity: trivial Keywords: env.py transaction
Cc: Branch:
Release Notes:
API Changes:
Internal Changes:

Description (last modified by Christian Boos)

It is now imposible to upgrade trac environment, due to the aforementioned error.

Stack trace is:

2010-02-15 16:11:15,448 Trac[console] ERROR: Exception in trac-admin command:
Traceback (most recent call last):
  File "build/bdist.linux-i686/egg/trac/admin/console.py", line 107, in onecmd
    rv = cmd.Cmd.onecmd(self, line) or 0
  File "/usr/lib/python2.6/cmd.py", line 218, in onecmd
    return self.default(line)
  File "build/bdist.linux-i686/egg/trac/admin/console.py", line 251, in default
    return cmd_mgr.execute_command(*args)
  File "build/bdist.linux-i686/egg/trac/admin/api.py", line 118, in execute_command
    return f(*fargs)
  File "build/bdist.linux-i686/egg/trac/env.py", line 745, in _do_upgrade
    self.env.upgrade(backup=no_backup is None)
  File "build/bdist.linux-i686/egg/trac/env.py", line 491, in upgrade
    @with_transaction(self.env)
AttributeError: 'Environment' object has no attribute 'env'

This was probably introduced with improvement of transaction handling in changeset r9183.

Change History (2)

comment:1 by Christian Boos, 14 years ago

Cc: Christian Boos removed
Description: modified (diff)
Owner: set to Christian Boos
Severity: criticaltrivial

Can you please try the following fix:

  • trac/env.py

     
    488488        if backup:
    489489            self.backup(backup_dest)
    490490
    491         @with_transaction(self.env)
     491        @with_transaction(self)
    492492        def do_upgrade(db):
    493493            for participant in upgraders:
    494494                participant.upgrade_environment(db)

(and no need to CC: me, I get notified of all the changes anyway ;-) )

by piotr@…, 14 years ago

Attachment: env.py.diff added

The patch that fixes erroneous behavior describe above. (self.env changed to self)

Note: See TracTickets for help on using tickets.