Modify

Opened 15 years ago

Closed 15 years ago

#5309 closed defect (fixed)

[TracCiaPlugin] Wrong ticket link and postgresql error

Reported by: Oliver Metz Owned by: Mikhail Gusarov
Priority: normal Component: TracCiaPlugin
Severity: normal Keywords:
Cc: Trac Release: 0.11

Description

When a new ticket is created the link is displayed like this:

http://trac.freetz.org/ticket/459/459

The ticket number is appended twice. Attached is a patch to fix this and a postgresql error I got. (Sorry, lost error message. It was something like comment is not a valid column.)

  • __init__.py

     
    200200        elif action == 'created':
    201201            args['url'] = t_url + '/' + str(ticket.id)
    202202            args['log'] = 'Created ['+ticket['type']+']: ('+ticket['summary']+')' + (version and (' in ' + version) or '')
    203             args['log'] += ' (' + t_url + '/' + str(ticket.id) + ')'
     203            args['log'] += ' (' + t_url + ')'
    204204        elif action == 'changed':
    205205            old = kwargs.get('old_values', {})
    206206            db = self.env.get_db_cnx()
    207207            cursor = db.cursor()
    208             cursor.execute('SELECT count(*) FROM ticket_change WHERE ticket = %s and field = "comment"' % (ticket.id));
     208            cursor.execute("SELECT count(*) FROM ticket_change WHERE ticket = %s and field = 'comment'" % (ticket.id));
    209209            r = cursor.fetchone()
    210210            num_comments = int(r and r[0] or 0)
    211211            if num_comments:

Attachments (0)

Change History (11)

comment:1 Changed 15 years ago by Mikhail Gusarov

Did you try the latest svn version? I fixed the similar bug some time ago.

comment:2 Changed 15 years ago by Oliver Metz

Sure I did. If you look at the two lines argsurl? and argslog? you will see that the ticket id is appended twice.

comment:3 Changed 15 years ago by Mikhail Gusarov

PostgreSQL fix committed.

Though I still don't see the problem with ticket.id: args['url'] = t_url + '/' + str(ticket.id) does not change the value of t_url, so it's necessary to append the id again while adding the link to the log.

Anyway, either both url/log links should have ticket id appended, or both should not have it, depending on the actual value of t_url.

comment:4 Changed 15 years ago by Oliver Metz

Sorry. You are right. I will take a closer look and try to find my problem.

comment:5 Changed 15 years ago by Mikhail Gusarov

Resolution: fixed
Status: newclosed

Okay, so I'm closing this ticket.

Thanks for SQL fix.

comment:6 Changed 15 years ago by Oliver Metz

Can you explain to me why ticket delete and ticket changed methods don't need this str(ticket.id) in the url and log but the ticket create method does?

Can you give me a hint how I can do "dry runs" without creating a real ticket and how I can log something into trac.log?

Thank you.

comment:7 Changed 15 years ago by Mikhail Gusarov

Ask the trac guys :) Arguments are non-consistent.

Regarding dry runs - no idea. I'm just using a local test trac instance.

comment:8 Changed 15 years ago by Oliver Metz

Resolution: fixed
Status: closedreopened

Next new ticket was created. Log message as follows:

CIA-1: Whoopie tickets/kernel * #461 /: Created [defect]: (7170 crashes with usb-root and "replace kernel") in devel (http://trac.freetz.org/ticket/461/461)

I'm using the actual svn revision without modifications.

comment:9 Changed 15 years ago by Oliver Metz

With this patch I get the following message:

  • traccia/__init__.py

    f
     
    201201            args['url'] = t_url + '/' + str(ticket.id)
    202202            args['log'] = 'Created ['+ticket['type']+']: ('+ticket['summary']+')' + (version and (' in ' + version) or '')
    203203            args['log'] += ' (' + t_url + '/' + str(ticket.id) + ')'
     204            self.log.warn('Ticket URL: %s', t_url)
    204205        elif action == 'changed':
    205206            old = kwargs.get('old_values', {})
    206207            db = self.env.get_db_cnx()

trac.log:

2009-06-05 10:03:32,270 Trac[__init__] WARNING: Ticket URL: http://trac.freetz.org/ticket/462

comment:10 Changed 15 years ago by Mikhail Gusarov

Interesting, maybe it's version-dependent.

I'll have a look.

comment:11 Changed 15 years ago by Mikhail Gusarov

Resolution: fixed
Status: reopenedclosed

Yes, confirmed, and fix committed in r6389.

Modify Ticket

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