Modify

Opened 15 years ago

Closed 14 years ago

#6505 closed defect (duplicate)

[Patch] TracMetrix plugin encounters internal error "TypeError: milestone_stats_data() takes at least 4 arguments (3 given)"

Reported by: mar@… Owned by: Bhuricha Deen Sethanandha
Priority: normal Component: TracMetrixPlugin
Severity: critical Keywords:
Cc: mrichmon@… Trac Release: 0.11

Description

Trac version: 0.11.6 TracMetrix version: 0.1.7

After installing TracMetrix pre-requistites, restarting apache and enabling TracMetrix plug-in I get an internal trac error when clicking on the TracMetrix dashboard link.

The internal error is:

 Trac detected an internal error:
   TypeError: milestone_stats_data() takes at least 4 arguments (3 given)

How to Reproduce

While doing a GET operation on /pdashboard, Trac issued an internal error.

(please provide additional details here)

User Agent was: Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10.6; en-US; rv:1.9.1.7) Gecko/20091221 Firefox/3.5.7

System Information

Trac 0.11.6
Python 2.6 (r26:66714, Dec 3 2008, 06:05:48)
[GCC 4.3.2 [gcc-4_3-branch revision 141291]]
setuptools 0.6c11
MySQL server: "5.0.67", client: "5.0.67", thread-safe: 0
MySQLdb 1.2.2
Genshi 0.5.1
mod_python 3.3.1
Pygments 1.1.1
RPC 1.0.6
Subversion 1.5.7 (r36142)
jQuery: 1.2.6

Python Traceback

Traceback (most recent call last):
  File "/usr/local/lib/python2.6/site-packages/Trac-0.11.6-py2.6.egg/trac/web/main.py", line 450, in _dispatch_request
    dispatcher.dispatch(req)
  File "/usr/local/lib/python2.6/site-packages/Trac-0.11.6-py2.6.egg/trac/web/main.py", line 206, in dispatch
    resp = chosen_handler.process_request(req)
  File "build/bdist.linux-i686/egg/tracmetrixplugin/web_ui.py", line 179, in process_request
    return self._render_view(req, db)
  File "build/bdist.linux-i686/egg/tracmetrixplugin/web_ui.py", line 197, in _render_view
    stats.append(milestone_stats_data(req, stat, milestone.name))
TypeError: milestone_stats_data() takes at least 4 arguments (3 given)

After investigation of the defect I found that milestone_stats_data() has changed to expect the environment to be passed as a new argument. The following patch fixes this problem in TracMetrix:

--- web_ui.py.orig	2010-01-28 11:29:40.000000000 -0800
+++ web_ui.py	2010-01-28 11:21:55.000000000 -0800
@@ -194,7 +194,7 @@
             tickets = get_tickets_for_milestone(self.env, db, milestone.name,
                                                 'owner')
             stat = get_ticket_stats(self.stats_provider, tickets)
-            stats.append(milestone_stats_data(req, stat, milestone.name))
+            stats.append(milestone_stats_data(self.env, req, stat, milestone.name))
 
         project = {
             'name': self.env.project_name,

Attachments (0)

Change History (16)

comment:1 Changed 15 years ago by mrichmon@…

Original ticket submission contains an incorrect email address. The correct address is mrichmon@…

comment:2 Changed 15 years ago by uray

Same problem after upgrade Trac from 0.11.1 to 0.11.6, and the fix works, thanks!

comment:3 Changed 15 years ago by Ryan J Ollos

Summary: TracMetrix plugin encounters internal error "TypeError: milestone_stats_data() takes at least 4 arguments (3 given)"[Patch] TracMetrix plugin encounters internal error "TypeError: milestone_stats_data() takes at least 4 arguments (3 given)"

Issue seems to be that the call web_ui, which I think you can fix with the following change to the call to milestone_stats_data:

milestone_stats_data(self.env, req, stat, milestone.name)

See change to Trac in [t 8625] which occurred between 0.11.5 and 0.11.6.

comment:4 Changed 15 years ago by Ryan J Ollos

Resolution: duplicate
Status: newclosed

This is actually a duplicate of #6149, which has a patch file attached.

comment:5 in reply to:  3 ; Changed 15 years ago by anonymous

Replying to rjollos:

Issue seems to be that the call web_ui, which I think you can fix with the following change to the call to milestone_stats_data:

milestone_stats_data(self.env, req, stat, milestone.name)

See change to Trac in [t 8625] which occurred between 0.11.5 and 0.11.6.

That would be the same change as provided in the description for this patch.

comment:6 in reply to:  5 Changed 15 years ago by Ryan J Ollos

Replying to anonymous:

That would be the same change as provided in the description for this patch.

Yeah, you are right ... I didn't read the description very carefully. Also wasted time tracking down a fix before I looked for open tickets.

comment:7 Changed 15 years ago by Ryan J Ollos

Added note to main page to help others avoid wasting time ;)

TracMetrixPlugin#RequiredComponents

comment:8 Changed 15 years ago by anonymous

Thank you, this patch run well 0.11.6

comment:9 Changed 15 years ago by mrichmon@…

Resolution: duplicate
Status: closedreopened

Note that to completely fix the problem there are two lines in mdashboard.py that also must be updated. These changes are shown in the patch below:

408c408
<         data.update(milestone_stats_data(req, stat, milestone.name))
---
>         data.update(milestone_stats_data(self.env, req, stat, milestone.name))
411c411
<         ticketstat.update(milestone_stats_data(req, tstat, milestone.name))
---
>         ticketstat.update(milestone_stats_data(self.env, req, tstat, milestone.name))

comment:10 in reply to:  9 Changed 15 years ago by Ryan J Ollos

Resolution: duplicate
Status: reopenedclosed

Replying to mrichmon@gmail.com:

Note that to completely fix the problem there are two lines in mdashboard.py that also must be updated. These changes are shown in the patch below:

The patch in #6149 addresses this change as well.

comment:11 Changed 15 years ago by anonymous

Resolution: duplicate
Status: closedreopened

I am also getting the same error.

Oops… Trac detected an internal error: TypeError: milestone_stats_data() takes at least 4 arguments (3 given) This is probably a local installation issue.

Can somebody help how to install this patch?

comment:12 Changed 15 years ago by anonymous

Cc: mrichmon@… added; anonymous removed

I am also getting the same error.

Oops… Trac detected an internal error: TypeError?: milestone_stats_data() takes at least 4 arguments (3 given) This is probably a local installation issue.

Can somebody help how to install this patch?

comment:13 Changed 15 years ago by Ryan J Ollos

I'd suggest installing the patch in #6149, which solves this problem.

Download the patch, change to the directory containing tracmetrixplugin, and run:

patch -p0 < fix__milestone_stats_data__trac0.11.diff

comment:14 in reply to:  13 ; Changed 15 years ago by anonymous

Replying to rjollos:

I'd suggest installing the patch in #6149, which solves this problem.

Download the patch, change to the directory containing tracmetrixplugin, and run:

patch -p0 < fix__milestone_stats_data__trac0.11.diff

When I am running this command in cmd in windows xp, the system is displaying 'patch' is not recognized as an internal or external command. Please give me the exact steps and command to install the patch.

comment:15 in reply to:  14 Changed 15 years ago by Ryan J Ollos

Replying to anonymous:

When I am running this command in cmd in windows xp, the system is displaying 'patch' is not recognized as an internal or external command. Please give me the exact steps and command to install the patch.

Do you have TortoiseSVN installed? If you don't know how to apply a patch, this should be the easiest way to get you started.

The TortoiseSVN documentation can explain it better than I could.

comment:16 Changed 14 years ago by Ryan J Ollos

Resolution: duplicate
Status: reopenedclosed

The patch in #6149 will be applied soon.

Modify Ticket

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