Edgewall Software
Modify

Opened 12 years ago

Closed 12 years ago

#9059 closed defect (fixed)

Error in trac-admin env upgrade - AttributeError: 'Environment' object has no attribute 'env'

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.

Attachments (1)

env.py.diff (736 bytes ) - added by piotr@… 12 years ago.
The patch that fixes erroneous behavior describe above. (self.env changed to self)

Download all attachments as: .zip

Change History (5)

comment:1 by Christian Boos, 12 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@…, 12 years ago

Attachment: env.py.diff added

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

comment:2 by piotr@…, 12 years ago

I actually don't write Python at all… Anyway, the above works for me - was able to update. Thanx for quick response.

comment:3 by Christian Boos, 12 years ago

In env.py.diff, the second change is wrong. The EnvironmentSetup class is a Component, and therefore its instances have a self.env property which is the appropriate, owning, Environment instance. That mistake is not harmful until you'll create a new environment, so you'd better revert that change.

comment:4 by Remy Blank, 12 years ago

Resolution: fixed
Status: newclosed

Fix from comment:1 applied as part of [9194].

Modify Ticket

Change Properties
Set your email in Preferences
Action
as closed The owner will remain Christian Boos.
The resolution will be deleted. Next status will be 'reopened'.
to The owner will be changed from Christian Boos to the specified user.

Add Comment


E-mail address and name can be saved in the Preferences .
 
Note: See TracTickets for help on using tickets.