Modify

Opened 9 years ago

Closed 9 years ago

#12558 closed defect (fixed)

Creating of table failed - db.py missing at sources

Reported by: andreas.podskalsky@… Owned by: Ryan J Ollos
Priority: normal Component: DefaultCcPlugin
Severity: normal Keywords:
Cc: Trac Release:

Description (last modified by Jun Omae)

After installation of plugin an db upgrade ...

trac-admin /data/projects/TEST/trac upgrade
InternalError: current transaction is aborted, commands ignored until end of transaction block

I see that db.py is missing for creating new table.

At older projects with old version of Plugin and existing using of latest trunk and 0.3 version of plugin is ok.

Attachments (2)

t12558-defaultcc-trunk-r14810.diff (2.8 KB) - added by Jun Omae 9 years ago.
t12558.2-defaultcc-trunk-r14810.diff (5.1 KB) - added by Jun Omae 9 years ago.

Download all attachments as: .zip

Change History (17)

comment:1 Changed 9 years ago by Jun Omae

Description: modified (diff)
Priority: highestnormal

Are you using PostgreSQL? Could you please provide trac.log in your environment after enabling TracLogging with DEBUG level?

I see that db.py is missing for creating new table.

No. db_backend.to_sql(table) generates DDL for new tables at defaultccplugin/trunk/defaultcc/admin.py@14809:65#L60.

p.s. the priority should be set by only plugin maintainers.

comment:2 Changed 9 years ago by andreas.podskalsky@…

I'm running Trac 0.12.5 with PostgreSQL

Last lines fron log file:

2015-10-28 13:53:56,032 Trac[console] ERROR: Exception in trac-admin command: 
Traceback (most recent call last):
  File "/usr/lib/python2.6/site-packages/trac/admin/console.py", line 111, in onecmd
    rv = cmd.Cmd.onecmd(self, line) or 0
  File "/usr/lib64/python2.6/cmd.py", line 218, in onecmd
    return self.default(line)
  File "/usr/lib/python2.6/site-packages/trac/admin/console.py", line 279, in default
    return cmd_mgr.execute_command(*args)
  File "/usr/lib/python2.6/site-packages/trac/admin/api.py", line 124, in execute_command
    return f(*fargs)
  File "/usr/lib/python2.6/site-packages/trac/env.py", line 787, in _do_upgrade
    self.env.upgrade(backup=no_backup is None)
  File "/usr/lib/python2.6/site-packages/trac/env.py", line 522, in upgrade
    self.backup(backup_dest)
  File "/usr/lib/python2.6/site-packages/trac/env.py", line 494, in backup
    return DatabaseManager(self).backup(dest)
  File "/usr/lib/python2.6/site-packages/trac/db/api.py", line 175, in backup
    dest_name = '%s.%i.%d.bak' % (db_name, self.env.get_version(),
  File "/usr/lib/python2.6/site-packages/trac/env.py", line 419, in get_version
    (initial and 'initial_' or ''))
  File "/usr/lib/python2.6/site-packages/trac/db/util.py", line 66, in execute
    return self.cursor.execute(sql)
InternalError: current transaction is aborted, commands ignored until end of transaction block
InternalError: current transaction is aborted, commands ignored until end of transaction block
Last edited 9 years ago by Jun Omae (previous) (diff)

Changed 9 years ago by Jun Omae

comment:3 Changed 9 years ago by Jun Omae

Please try latest of defaultccplugin with t12558-defaultcc-trunk-r14810.diff.

  • Prevent abort of transaction in environment_needs_upgrade() for PostgreSQL
  • Compatibilities with Trac 0.12.x

comment:4 Changed 9 years ago by Ryan J Ollos

Is there anything preventing you from upgrading to Trac 1.0? The trunk intentionally supports only Trac >= 1.0.

Changed 9 years ago by Jun Omae

comment:5 Changed 9 years ago by Jun Omae

I think that plugin is small and it is easy to be compatibilities with both 0.12 and 1.0.

Again, t12558.2-defaultcc-trunk-r14810.diff.

comment:6 Changed 9 years ago by Ryan J Ollos

It is a small plugin, but I'm not going to go out of my way to help someone avoid upgrading their Trac instance. That's coddling poor behavior. User can use patch if they like but I won't commit 0.12 compatibility.

Last edited 9 years ago by Ryan J Ollos (previous) (diff)

comment:7 Changed 9 years ago by Ryan J Ollos

Status: newaccepted

In the interest of being community-friendly I'll go ahead and commit the change after adding a test. I'd really like to force users off these old versions of Trac though. It doesn't do the community any good to put our efforts towards supporting nearly obsolete versions when Trac 1.0 was released 3 years ago and Trac 1.2 will be released this year.

comment:8 Changed 9 years ago by podskalsky

Thank you for your support. Offcource we are planing the upgrade to Trac 1.0, but this will be in the next months. I have to check all used plugins and also to update or change self created plugins before.

comment:9 Changed 9 years ago by podskalsky

Status: I've now added the patch to the plugin. The database upgrade was ok - table is now existing.

trac_OnTrac1=# \d component_default_cc
Table "public.component_default_cc"
 Column | Type | Modifiers 
--------+------+-----------
 name   | text | not null
 cc     | text | 
Indexes:
    "component_default_cc_pkey" PRIMARY KEY, btree (name)
    "component_default_cc_name_idx" btree (name)

But after I've added a user to the CC at Componets there is a new error !

AttributeError: 'Environment' object has no attribute 'with_trasaction'

2015-10-29 13:15:53,373 Trac[main] ERROR: Internal Server Error: 
Traceback (most recent call last):
  File "/usr/lib/python2.6/site-packages/trac/web/main.py", line 525, in _dispatch_request
    dispatcher.dispatch(req)
  File "/usr/lib/python2.6/site-packages/trac/web/main.py", line 211, in dispatch
    chosen_handler)
  File "/usr/lib/python2.6/site-packages/trac/web/main.py", line 353, in _pre_process_request
    chosen_handler = filter_.pre_process_request(req, chosen_handler)
  File "build/bdist.linux-x86_64/egg/defaultcc/admin.py", line 92, in pre_process_request
    old_cc.delete()
  File "build/bdist.linux-x86_64/egg/defaultcc/model.py", line 36, in delete
    @self.env.with_trasaction()
AttributeError: 'Environment' object has no attribute 'with_trasaction'
2015-10-29 13:15:53,373 Trac[main] ERROR: Internal Server Error: 
Traceback (most recent call last):
  File "/usr/lib/python2.6/site-packages/trac/web/main.py", line 525, in _dispatch_request
    dispatcher.dispatch(req)
  File "/usr/lib/python2.6/site-packages/trac/web/main.py", line 211, in dispatch
    chosen_handler)
  File "/usr/lib/python2.6/site-packages/trac/web/main.py", line 353, in _pre_process_request
    chosen_handler = filter_.pre_process_request(req, chosen_handler)
  File "build/bdist.linux-x86_64/egg/defaultcc/admin.py", line 92, in pre_process_request
    old_cc.delete()
  File "build/bdist.linux-x86_64/egg/defaultcc/model.py", line 36, in delete
    @self.env.with_trasaction()
AttributeError: 'Environment' object has no attribute 'with_trasaction'
2015-10-29 13:15:53,625 Trac[util] DEBUG: SQL: '\n                SELECT name,cc FROM component_default_cc ORDER BY name\n                '
2015-10-29 13:15:53,625 Trac[util] DEBUG: SQL: '\n                SELECT name,cc FROM component_default_cc ORDER BY name\n                '

comment:10 Changed 9 years ago by Ryan J Ollos

It looks like that is just a typo which can be fixed by changing line 36 of the patch @self.env.with_trasaction() -> @self.env.with_transaction().

comment:11 Changed 9 years ago by podskalsky

The typo was also at line 48 !

Now the plugin for Trac 0.12 is OK - Thank you for your great support.

comment:12 Changed 9 years ago by Ryan J Ollos

In 15053:

0.3.1dev: Fix tables not created for PostgreSQL

Refs #12558.

comment:13 Changed 9 years ago by Ryan J Ollos

In 15054:

0.4dev: Merge [15053] and adapt to Trac >= 1.0 API

Refs #12558.

comment:14 Changed 9 years ago by Ryan J Ollos

In 15055:

0.3.1dev: Remove code that was overlooked in [15053]

Refs #12558.

comment:15 Changed 9 years ago by Ryan J Ollos

Resolution: fixed
Status: acceptedclosed

Assuming I didn't make yet another mistake, you should be able to install to Trac 0.12 from defaultccplugin/branches/0.3.

Modify Ticket

Change Properties
Set your email in Preferences
Action
as closed The owner will remain Ryan J Ollos.
The resolution will be deleted. Next status will be 'reopened'.

Add Comment


E-mail address and name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.