[Trac-tickets] [The Trac Project] #2206: Milestones.py uses row[STRING]= -- this breaks my installed postgres DBI

The Trac Project noreply at edgewall.com
Tue Oct 11 08:39:16 CDT 2005


#2206: Milestones.py uses row[STRING]= -- this breaks my installed postgres DBI
----------------------------+-----------------------------------------------
 Reporter:  anonymous       |       Owner:  cmlenz
     Type:  defect          |      Status:  new   
 Priority:  highest         |   Milestone:  0.9   
Component:  roadmap         |     Version:  0.8.4 
 Severity:  blocker         |   Keywords:  patch included  |  
----------------------------+-----------------------------------------------
 this works for me:
 using psyco

 /usr/lib/python2.3/site-packages/trac/Milestone.py +183

 {{{
 #!python
 def get_tickets_for_milestone(env, db, milestone, fields=[ 'component' ]):
     stdfields = TicketSystem(env).get_ticket_fields()
     cursor = db.cursor()
     sql = "SELECT DISTINCT "
     for field in fields:
         if field not in [f['name'] for f in stdfields if not
 f.get('custom')]:
             sql += "%s.value AS %s, " % (field, field)
         else:
             sql += "ticket.%s AS %s, " % (field, field)
     sql += "ticket.id AS id, ticket.status AS status FROM ticket "
     for field in fields:
         if field not in [f['name'] for f in stdfields if not
 f.get('custom')]:
             sql += "LEFT OUTER JOIN ticket_custom %s ON
 (ticket.id=%s.ticket AND %s.name='%s') " % (field, field, field, field)
     sql += "WHERE milestone='%s' ORDER BY %s" % (sql_escape(milestone),
 field)

     cursor.execute(sql)

     tickets = []
     for row in cursor:
 #    while 1:
 #        row = cursor.fetchone()
 #        if not row:
 #            break
         c=0
         ticket = {}
         for field in fields:
             ticket[field] = row[c]
             c = c + 1
         ticket['id']=row[c]
         c = c + 1
         ticket['status']=row[c]
         c = c + 1

         tickets.append(ticket)
     return tickets
 }}}

-- 
Ticket URL: <http://projects.edgewall.com/trac/ticket/2206>
The Trac Project <http://trac.edgewall.com/>


More information about the Trac-Tickets mailing list