Modify

Opened 16 years ago

Closed 16 years ago

Last modified 16 years ago

#3205 closed enhancement (fixed)

Interaction with tracprivatetickets request

Reported by: js@… Owned by: Russ Tyndall
Priority: normal Component: TimingAndEstimationPlugin
Severity: normal Keywords:
Cc: Trac Release: 0.11

Description

I just installed the Plugin in my Trac 0.11 RC2 Environment.

If I go to management tab and try to open one of the reports with TRAC_ADMIN Permission, everything works fine. But as a non-admin I get the following error message by all reports (except "Ticket Work Summary"):

Trac detected an internal error:

ValueError: invalid literal for int() with base 10: 'None'

afaik as I understood the docs correctly, TimingAndEstimationPlugin has no buildin security yet, so that cannot be the problem.

Attachments (1)

trac.log (39.1 KB) - added by js@… 16 years ago.
trac.log with traceback of this error

Download all attachments as: .zip

Change History (12)

comment:1 Changed 16 years ago by Russ Tyndall

My guess is that this is a problem in the new trac release candidate. When I get a chance I will investigate and if necessary make a ticket over there.

russ

comment:2 Changed 16 years ago by js@…

Type: defectenhancement

I noticed that the error occures in conjunction with the tracprivatetickets 2.0.2 plugin.

I changed the type to enhancement, it would be a great feature if both extensions would work together (a programmer sees only the estimated and total hours of tickets he is allowed to view (TICKET_VIEW_SELF etc. from tracprivatetickets)

comment:3 Changed 16 years ago by Russ Tyndall

Summary: Reports only viewable by TRAC_ADMINInteraction with tracprivatetickets request

comment:4 Changed 16 years ago by Russ Tyndall

Resolution: fixed
Status: newclosed

Are you sure that this is the case? I ran both of these plugins side by side the other day and did not have this experience. If you can post the error from your trac log then I might be able to track down what is causing this.

If you write back feel free to reopen, but for now (given my recent experience of running both) I am assuming this is closed/fixed.

comment:5 Changed 16 years ago by js@…

Ok, here´s what I did: I opened Trac and clicked Management -> Ticket Hours with Description. Same error.

In the Log file these lines should be interesting:

2008-09-22 08:04:24,871 Trac[perm] DEBUG: No policy allowed juergen performing TRAC_ADMIN on <Resource u'ticket:26'>
2008-09-22 08:04:24,888 Trac[perm] DEBUG: No policy allowed juergen performing TRAC_ADMIN on <Resource u'ticket:80'>
2008-09-22 08:04:24,888 Trac[perm] DEBUG: No policy allowed juergen performing TRAC_ADMIN on <Resource u'ticket:81'>
2008-09-22 08:04:24,903 Trac[perm] DEBUG: No policy allowed juergen performing TRAC_ADMIN on <Resource u'ticket:None'>
2008-09-22 08:04:24,903 Trac[main] ERROR: invalid literal for int() with base 10: 'None'

I don´t know why, but it seems there is a ticket without a number in our environment. Don´t know how it happened, but everything else works without a problem, so I didn´t notice it yet.

Changed 16 years ago by js@…

Attachment: trac.log added

trac.log with traceback of this error

comment:6 Changed 16 years ago by Russ Tyndall

Hmmm... This is definitely a bug in PrivateTicketsPlugin, but one that I think has been fixed as it skips tickets with resource none in the most recent release. Perhaps try updating that plugin and see if your problems disappear.

http://trac-hacks.org/browser/privateticketsplugin/0.11/privatetickets/policy.py#L43

comment:7 Changed 16 years ago by js@…

Sorry, but an update to the latest revision didn´t solve it. I ivestigated a little bit and think I found the problem.

  1. If have no ticket with an empty ticket id in my db
  2. If I run the statement (look at the statement in the attached trac.log where the error occures) against our db I see that the last union select (where the remaining time is calculated) uses a null value for the ticket id
SELECT '1' AS __color__,
       'background-color:#DFE;' as __style__,
       NULL as ticket, 'Total' AS summary,
       NULL as component,NULL as version, NULL as severity, NULL as  milestone,
       'Time Remaining: ' as status,
       CAST(
       SUM(CASE WHEN EstimatedHours.value = '' OR EstimatedHours.value IS NULL THEN 0
         ELSE CAST( EstimatedHours.value AS DECIMAL ) END) -
       SUM(CASE WHEN totalhours.value = '' OR totalhours.value IS NULL THEN 0
         ELSE CAST( totalhours.value AS DECIMAL ) END)
         AS CHAR(512))  as owner,
       SUM(CASE WHEN EstimatedHours.value = '' OR EstimatedHours.value IS NULL THEN 0
         ELSE CAST( EstimatedHours.value AS DECIMAL ) END) as Estimated_work,
       SUM(CASE WHEN totalhours.value = '' OR totalhours.value IS NULL THEN 0
         ELSE CAST( totalhours.value AS DECIMAL ) END) as Total_work,
       NULL as billable,
       NULL as created, NULL as modified,         -- ## Dates are formatted

       NULL AS _description_,
       NULL AS _changetime,
       NULL AS _reporter
       ,1 as _ord
  FROM ticket as t
  JOIN enum as p ON p.name=t.priority AND p.type='priority'

LEFT JOIN ticket_custom as EstimatedHours ON EstimatedHours.name='estimatedhours'
      AND EstimatedHours.Ticket = t.Id

LEFT JOIN ticket_custom as totalhours ON totalhours.name='totalhours'
      AND totalhours.Ticket = t.Id

LEFT JOIN ticket_custom as billable ON billable.name='billable'
      AND billable.Ticket = t.Id

  WHERE t.status IN (%s, %s, %s, %s, %s)
    AND billable.value in (%s, %s)
)  as tbl
ORDER BY _ord ASC, ticket
     ) AS tab  LIMIT 100 OFFSET 0

I am not so familiar with the internals of trac, but I could imagine that the result of this query is passed to private ticket which expects a ticket id to check if the user has access rights on it. Can you tell me where this query is located (file system or db?), so I can change it to a real ticket id (just for testing, maybe that fixes the problem)

comment:8 Changed 16 years ago by anonymous

Update: Just noticed how to edit the query. If I disable PrivateTicket and run the query, I can use the "Edit Report" Button.

If I change the query to:

SELECT '1' AS __color__,
       'background-color:#DFE;' as __style__,
       '''0''' as ticket, 'Total' AS summary,

the error is gone (only the "total" row now shows a link to ticket #0 which does not exist)

comment:9 Changed 16 years ago by Russ Tyndall

I think you will find that you have some caching going on where you didnt expect. (You might wish to remove your trac-eggs-cache folder and restart your webserver). The line of code I mentioned, in the previous version is a check to verify that the ticket id is not null before we try to instantiate it.

You can certainly edit all of the reports (go to the report screen and click the edit button), but I do not think that is the problem.

HTH, Russ

comment:10 Changed 16 years ago by Russ Tyndall

previous version

should have been previous comment

comment:11 Changed 16 years ago by anonymous

Upps,

The query is nonsense, I wanted to highlight the 0 with bold text. It should read:

SELECT '1' AS __color__,
       'background-color:#DFE;' as __style__,
       0 as ticket, 'Total' AS summary,

Modify Ticket

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