Modify

Opened 16 years ago

Closed 16 years ago

Last modified 13 years ago

#2174 closed defect (fixed)

Work Log fails in Timeline page

Reported by: karmadude@… Owned by: Colin Guthrie
Priority: high Component: WorkLogPlugin
Severity: critical Keywords:
Cc: Trac Release: 0.10

Description

I am getting the following error from WorkLog in the Timeline page, anyone else seen this before, and any ideas what might be causing it?

Work Log changes event provider (WorkLogTimelineAddon) failed:

AttributeError: 'Request' object has no attribute 'cursor'

Attachments (1)

worklog.timeline_hook.py.patch (836 bytes) - added by jonathan.steffan@… 16 years ago.
Patch to fix #2174

Download all attachments as: .zip

Change History (15)

comment:1 Changed 16 years ago by Colin Guthrie

Hmmm, odd.

Can you get a better backtrace with line numbers etc.

From what I can see it can only be the call to db.cursor(), which would imply that the db connection has failed and is somehow returning a request object???? Odd.

comment:2 Changed 16 years ago by karmadude@…

This is all I am seeing in the trac log. Is there a setting to turn on to see the backtrace?

2007-11-13 11:16:41,730 Trac[loader] DEBUG: Loading egg plugin worklog from d:\tools\python24\scripts\trac\pcg_source\plugins\worklog-0.1-py2.4.egg
2007-11-13 11:16:42,012 Trac[api] DEBUG: Updating wiki page index
2007-11-13 11:16:42,153 Trac[main] WARNING: 500 Internal Error (Work Log changes  event provider (<tt>WorkLogTimelineAddon</tt>) failed:<br /><br />AttributeError: 'Request' object has no attribute 'cursor'<p>You may want to see the other kind of events from the <a href="/trac/timeline?ticket=on&amp;milestone=on&amp;changeset=on&amp;wiki=on">Timeline</a></p>)
2007-11-13 11:16:42,246 Trac[api] DEBUG: Updating wiki page index
2007-11-13 11:16:42,339 Trac[main] WARNING: 500 Internal Error (Work Log changes  event provider (<tt>WorkLogTimelineAddon</tt>) failed:<br /><br />AttributeError: 'Request' object has no attribute 'cursor'<p>You may want to see the other kind of events from the <a href="/trac/timeline?ticket=on&amp;milestone=on&amp;changeset=on&amp;wiki=on">Timeline</a></p>)

comment:3 Changed 16 years ago by Adrian Fritz

Same error, different message:

  • When I enable all less worklog.api.worklogsetupparticipant (= disabled), then:
    • I have a link through ">Admin >Tickets >Work Log" and I'm able to change configuration parameters;
    • Nothing changes on tickets
    • at >Timeline I have the following message "Work Log changes event provider (WorkLogTimelineAddon) failed: DatabaseError: no such table: work_log" when I've selected "Work Log changes" view
  • When I enable all WorkLog components I have an "500 Internal Server Error"
    • Here follows debug info
      [root@XXX trac]# trac-admin /XXXX/trac/PPPPP upgrade
      10:39:06 Trac[loader] DEBUG: Loading file plugin easy_install from /usr/share/trac/plugins/easy_ins tall.py
      10:39:06 Trac[loader] DEBUG: Loading file plugin include from /usr/share/trac/plugins/include.py
      10:39:06 Trac[loader] DEBUG: Loading file plugin excel_report_plugin from /usr/share/trac/plugins/excel_report_plugin.py
      10:39:06 Trac[loader] DEBUG: Loading egg plugin timingandestimationplugin from /usr/lib/python2.4/site-packages/timingandestimationplugin-0.5.2-py2.4.egg
      10:39:06 Trac[loader] DEBUG: Loading egg plugin webadmin.logging from /usr/lib/python2.4/site-packages/TracWebAdmin-0.1.2dev_r4240-py2.4.egg
      10:39:06 Trac[loader] DEBUG: Loading egg plugin webadmin.ticket from /usr/lib/python2.4/site-packages/TracWebAdmin-0.1.2dev_r4240-py2.4.egg
      10:39:06 Trac[loader] DEBUG: Loading egg plugin webadmin.basics from /usr/lib/python2.4/site-packag es/TracWebAdmin-0.1.2dev_r4240-py2.4.egg
      10:39:06 Trac[loader] DEBUG: Loading egg plugin webadmin.perm from /usr/lib/python2.4/site-packages /TracWebAdmin-0.1.2dev_r4240-py2.4.egg
      10:39:06 Trac[loader] DEBUG: Loading egg plugin webadmin.web_ui from /usr/lib/python2.4/site-packag es/TracWebAdmin-0.1.2dev_r4240-py2.4.egg
      10:39:06 Trac[loader] DEBUG: Loading egg plugin webadmin.plugin from /usr/lib/python2.4/site-packag es/TracWebAdmin-0.1.2dev_r4240-py2.4.egg
      10:39:06 Trac[loader] DEBUG: Loading egg plugin ctxtnavadd.web_ui from /usr/lib/python2.4/site-pack ages/TracCtxtnavAdd-1.1_r1-py2.4.egg
      10:39:06 Trac[loader] DEBUG: Loading egg plugin pagetopdf.pagetopdf from /usr/lib/python2.4/site-pa ckages/TracPageToPDF-0.2-py2.4.egg
      10:39:07 Trac[loader] DEBUG: Loading egg plugin worklog from /usr/lib/python2.4/site-packages/workl og-0.1-py2.4.egg
      10:39:07 Trac[loader] DEBUG: Loading egg plugin doxygentrac from /usr/lib/python2.4/site-packages/T racDoxygen-0.4-py2.4.egg
      10:39:07 Trac[loader] DEBUG: Loading egg plugin wikitemplates from /usr/lib/python2.4/site-packages /TracWikiTemplates-0.3.0rc3-py2.4.egg
      10:39:07 Trac[loader] DEBUG: Loading egg plugin tractoc.macro from /usr/lib/python2.4/site-packages /TracTocMacro-1.0-py2.4.egg
      10:39:07 Trac[loader] DEBUG: Loading egg plugin combinewiki.web_ui from /usr/lib/python2.4/site-pac kages/TracCombineWiki-1.2-py2.4.egg
      10:39:07 Trac[loader] DEBUG: Loading egg plugin combinewiki.formats from /usr/lib/python2.4/site-pa ckages/TracCombineWiki-1.2-py2.4.egg
      10:39:07 Trac[loader] DEBUG: Loading egg plugin tracdnd from /usr/lib/python2.4/site-packages/Trac_ Drag_and_Drop-0.1-py2.4.egg
      10:39:07 Trac[loader] DEBUG: Loading egg plugin TracXMLRPC from /usr/lib/python2.4/site-packages/Tr acXMLRPC-0.1-py2.4.egg
      10:39:07 Trac[loader] DEBUG: Loading egg plugin condfields.web_ui from /usr/lib/python2.4/site-pack ages/TracCondFields-1.0-py2.4.egg
      10:39:07 Trac[loader] DEBUG: Loading egg plugin TracBurndown from /usr/lib/python2.4/site-packages/ TracBurndown-01.04.10-py2.4.egg
      10:39:07 Trac[loader] DEBUG: Loading plugin /usr/lib/python2.4/site-packages/TracGantt-0.3.2a-py2.4 .egg
      10:39:07 Trac[loader] DEBUG: Loading egg plugin acct_mgr.htfile from /usr/lib/python2.4/site-packag es/TracAccountManager-0.1.3dev_r1581-py2.4.egg
      10:39:07 Trac[loader] DEBUG: Loading egg plugin acct_mgr.web_ui from /usr/lib/python2.4/site-packag es/TracAccountManager-0.1.3dev_r1581-py2.4.egg
      10:39:07 Trac[loader] DEBUG: Loading egg plugin acct_mgr.admin from /usr/lib/python2.4/site-package s/TracAccountManager-0.1.3dev_r1581-py2.4.egg
      10:39:07 Trac[loader] DEBUG: Loading egg plugin acct_mgr.api from /usr/lib/python2.4/site-packages/ TracAccountManager-0.1.3dev_r1581-py2.4.egg
      10:39:07 Trac[loader] DEBUG: Loading egg plugin acct_mgr.http from /usr/lib/python2.4/site-packages /TracAccountManager-0.1.3dev_r1581-py2.4.egg
      10:39:07 Trac[loader] DEBUG: Loading egg plugin datamover.ticket from /usr/lib/python2.4/site-packa ges/TracDatamoverPlugin-1.2-py2.4.egg
      10:39:07 Trac[loader] DEBUG: Loading egg plugin datamover.component from /usr/lib/python2.4/site-pa ckages/TracDatamoverPlugin-1.2-py2.4.egg
      10:39:07 Trac[loader] DEBUG: Loading egg plugin datamover.wiki from /usr/lib/python2.4/site-package s/TracDatamoverPlugin-1.2-py2.4.egg
      10:39:07 Trac[loader] DEBUG: Loading egg plugin datamover.enum from /usr/lib/python2.4/site-package s/TracDatamoverPlugin-1.2-py2.4.egg
      10:39:07 Trac[loader] DEBUG: Loading egg plugin datamover.providers from /usr/lib/python2.4/site-pa ckages/TracDatamoverPlugin-1.2-py2.4.egg
      10:39:07 Trac[loader] DEBUG: Loading egg plugin datamover.milestone from /usr/lib/python2.4/site-pa ckages/TracDatamoverPlugin-1.2-py2.4.egg
      10:39:07 Trac[loader] DEBUG: Loading egg plugin datamover.web_ui from /usr/lib/python2.4/site-packa ges/TracDatamoverPlugin-1.2-py2.4.egg
      10:39:07 Trac[loader] DEBUG: Loading egg plugin datamover.version from /usr/lib/python2.4/site-pack ages/TracDatamoverPlugin-1.2-py2.4.egg
      10:39:07 Trac[loader] DEBUG: Loading egg plugin datamover.attachment from /usr/lib/python2.4/site-p ackages/TracDatamoverPlugin-1.2-py2.4.egg
      10:39:07 Trac[loader] DEBUG: Loading egg plugin datamover.permission from /usr/lib/python2.4/site-p ackages/TracDatamoverPlugin-1.2-py2.4.egg
      10:39:07 Trac[loader] DEBUG: Loading egg plugin tractags from /usr/lib/python2.4/site-packages/Trac Tags-0.4-py2.4.egg
      10:39:07 Trac[loader] DEBUG: Loading egg plugin excelviewer from /usr/lib/python2.4/site-packages/T racExcelViewer-0.1-py2.4.egg
      10:39:07 Trac[loader] DEBUG: Loading egg plugin wikinotification from /usr/lib/python2.4/site-packa ges/TracWikiNotification-0.1.0rc4-py2.4.egg
      10:39:07 Trac[env] WARNING: Component <worklog.api.WorkLogSetupParticipant object at 0xb78da38c> re quires environment upgrade
      Worklog needs an upgrade
      Upgrading Database
      Creating work_log table
      Updating work_log table (v2)
      10:39:07 Trac[api] ERROR: WorklogPlugin Exception: near "ADD": syntax error
      Done upgrading Worklog
      Upgrade done.
      [root@anchova trac]# service httpd restart
      Stopping httpd:                                            [  OK  ]
      Starting httpd: [Fri Dec 28 10:40:21 2007] [warn] module python_module is already loaded, skipping
                                                                 [  OK  ]
      [root@XXX trac]#
      
  • To make the environment work again I just have to disable "worklog.api.worklogsetupparticipant" at 'trac.ini' file
    • I've got this (just last 2 lines from upgrade process):
      11:25:50 Trac[loader] DEBUG: Loading egg plugin wikinotification from /usr/lib/python2.4/site-packages/TracWikiNotification-0.1.0rc4-py2.4.egg
      Database is up to date, no upgrade necessary.
      

comment:4 Changed 16 years ago by Adrian Fritz

One more info. At the time I create e ticket Trac gives an error about the inexistence of work_log table

  File "/usr/src/build/539311-i386/install//usr/lib/python2.4/site-packages/sqlite/main.py", line 255, in execute
DatabaseError: no such table: work_log

Thank you for your time

comment:5 Changed 16 years ago by Colin Guthrie

Yeah but disabling the worklog.api.worklogsetupparticipant you disable the bit that (attempts) to make sure all the necessary tables etc. are created.

Are you using the 0.10 or 0.11 version? And which db backend are you using? I've tested this with SQLite and AFAIK the syntax looks good for MySQL so I'm guessing I've messed up somewhere with pgsql? If you could take a look at worklogplugin/0.11/worklog/api.py@#L74 and the two SQL commands there and try them out manually on your DB and let me know the error message that comes back, that would be great. It could be that e.g. pgsql requires the transaction for create table to be committed prior to altering it and hence why this has failed. If this is the case you may get success by changing worklogplugin/0.11/worklog/api.py@#L31 to have a version of 1 and commenting out the second batch of SQL upgrades; installing and upgrading; revert to the original; then install and upgrade again. That would work around things. But please report back all the same so I can fix properly.

comment:6 Changed 16 years ago by adrian@…

Thank you for your fast answer.

  • Trac 0.10.3
  • DB = SQLite
  • Steps:
    1. Create "work_log" Table
      1. api.py@#L31 -> self.db_version = 1 #was2
      2. commented -> L85 to L88
      3. New Egg, Install, enabled WorkLoad, restart http server
      • Results:
        • Success: table created ("Creating work_log table")
        • Error: "Work Log changes event provider (WorkLogTimelineAddon) failed: DatabaseError: no such column: comment" when trying to activate "Work Log changes" option at >Timeline view.
    2. Add "Comment" column
      1. added L85 to L88 (but still keeped L31 = 1)
      2. New Egg, Install, enabled WorkLoad, restart http server
        • Error when trying to see ticket individually
          Traceback (most recent call last):
            File "/usr/lib/python2.4/site-packages/trac/web/main.py", line 387, in dispatch_request
              dispatcher.dispatch(req)
            File "/usr/lib/python2.4/site-packages/trac/web/main.py", line 208, in dispatch
              chrome.populate_hdf(req, chosen_handler)
            File "/usr/lib/python2.4/site-packages/trac/web/chrome.py", line 319, in populate_hdf
              for category, name, text in contributor.get_navigation_items(req):
            File "build/bdist.linux-i686/egg/worklog/uihooks_ticket.py", line 162, in get_navigation_items
            File "build/bdist.linux-i686/egg/worklog/manager.py", line 266, in get_active_task
            File "build/bdist.linux-i686/egg/worklog/manager.py", line 250, in get_latest_task
            File "/usr/lib/python2.4/site-packages/trac/db/util.py", line 50, in execute
              return self.cursor.execute(sql_escape_percent(sql), args)
            File "/usr/src/build/539311-i386/install//usr/lib/python2.4/site-packages/sqlite/main.py", line 255, in execute
          DatabaseError: no such column: wl.comment
          
        • Error when trying to create a ticket (even with error message a ticket is created)
          Traceback (most recent call last):
            File "/usr/lib/python2.4/site-packages/trac/web/main.py", line 387, in dispatch_request
              dispatcher.dispatch(req)
            File "/usr/lib/python2.4/site-packages/trac/web/main.py", line 208, in dispatch
              chrome.populate_hdf(req, chosen_handler)
            File "/usr/lib/python2.4/site-packages/trac/web/chrome.py", line 319, in populate_hdf
              for category, name, text in contributor.get_navigation_items(req):
            File "build/bdist.linux-i686/egg/worklog/uihooks_ticket.py", line 162, in get_navigation_items
            File "build/bdist.linux-i686/egg/worklog/manager.py", line 266, in get_active_task
            File "build/bdist.linux-i686/egg/worklog/manager.py", line 250, in get_latest_task
            File "/usr/lib/python2.4/site-packages/trac/db/util.py", line 50, in execute
              return self.cursor.execute(sql_escape_percent(sql), args)
            File "/usr/src/build/539311-i386/install//usr/lib/python2.4/site-packages/sqlite/main.py", line 255, in execute
          DatabaseError: no such column: wl.comment
          
    3. L31 back to 'self.db_version = 2'
      1. New Egg, Install, WorkLoad already enabled, restart http server
      2. Error: "500 Internal Server Error"

comment:7 Changed 16 years ago by Colin Guthrie

I did not expect things to work after A on it's own. You have to do A then C. C is the correct approach (e.g. fully revert to original) but you'll have to run the upgrade again (it detects that the installed version is 1 but the current version is 2 so requires a further upgrade).

Once you've done the upgrade again things should work. I'll do some work to make sure that it works with a fresh install. I guess SQLite doesn't let you change a table that's been created in the same transaction without a commit :s

comment:8 in reply to:  7 Changed 16 years ago by Adrian Fritz

Replying to coling:

Just to give you a feedback: we now upgraded to 0.11 and PG as DB. Then I'll not be able to test this on previous environment because both production and test are on 0.11. We'll do some effort later to test on 0.11.

Anyway, thank you for your fast answers.

Adrián

comment:9 Changed 16 years ago by Colin Guthrie

(In [3062]) Update to work with latest Trac SVN (6396). Refs #2174.

comment:10 Changed 16 years ago by Antti Kaihola

I had this issue, but after upgrading the WorkLogPlugin to current trunk and upgrading the trac database everything has been ok. This is Trac 0.11b1. If it helps anyone I can try to track down the revision number before and after the upgrade.

comment:11 Changed 16 years ago by Colin Guthrie

There were also some general fixes for PG db recently so if that's involved then as per comment:8 then hopefully it's all good now :)

comment:12 Changed 16 years ago by Colin Guthrie

Resolution: worksforme
Status: newclosed

I'm going to close this bug as I'm not supporting 0.10 anymore. If this is really really important to you, let me know and I'll maybe be convinced to look at it (will require me to setup a 0.10 env....) If patches are provided for 0.10 that fix things I'll happily commit them :)

Things seem to work OK on 0.11 for me just now.

comment:13 Changed 16 years ago by jonathan.steffan@…

Resolution: worksforme
Status: closedreopened

A simple patch fixes this issue.

Changed 16 years ago by jonathan.steffan@…

Patch to fix #2174

comment:14 Changed 16 years ago by Colin Guthrie

Resolution: fixed
Status: reopenedclosed

(In [3567]) Blindly apply 0.10 patch from Jonathan Steffan. I've not tested this as I don't really have a 0.10 env to play with any more.... Thanks Jonathan :) Closes #2174

Modify Ticket

Change Properties
Set your email in Preferences
Action
as closed The owner will remain Colin Guthrie.
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.