Modify

Opened 5 years ago

Closed 5 years ago

#5309 closed defect (fixed)

[TracCiaPlugin] Wrong ticket link and postgresql error

Reported by: olistudent Owned by: dottedmag
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 5 years ago by dottedmag

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

comment:2 Changed 5 years ago by olistudent

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 5 years ago by dottedmag

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 5 years ago by olistudent

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

comment:5 Changed 5 years ago by dottedmag

  • Resolution set to fixed
  • Status changed from new to closed

Okay, so I'm closing this ticket.

Thanks for SQL fix.

comment:6 Changed 5 years ago by olistudent

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 5 years ago by dottedmag

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 5 years ago by olistudent

  • Resolution fixed deleted
  • Status changed from closed to reopened

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 5 years ago by olistudent

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 5 years ago by dottedmag

Interesting, maybe it's version-dependent.

I'll have a look.

comment:11 Changed 5 years ago by dottedmag

  • Resolution set to fixed
  • Status changed from reopened to closed

Yes, confirmed, and fix committed in r6389.

Add Comment

Modify Ticket

Action
as closed .
as The resolution will be set. Next status will be 'closed'.
to The owner will be changed from dottedmag. Next status will be 'closed'.
The resolution will be deleted. Next status will be 'reopened'.
Author


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

 
Note: See TracTickets for help on using tickets.