Edgewall Software
Modify

Opened 16 years ago

Closed 16 years ago

#8120 closed defect (worksforme)

TypeError when attempting to download a Comma-delimted Text of a report

Reported by: peterson_eric_d@… Owned by:
Priority: normal Milestone:
Component: report system Version: 0.12dev
Severity: major Keywords:
Cc: Branch:
Release Notes:
API Changes:
Internal Changes:

Description (last modified by Christian Boos)

Clicking on Comma-delimited Text to save a report, I get no data but the header row in MS Excel. Looking at the log I see the following error. It is a rather long query, below. It works fine to see the data on the screen, yet my users would like to play in MS Excel (go figure).

----------------------------------------
Exception happened during processing of request from ('141.204.54.76', 4067)
Traceback (most recent call last):
  File "C:\Python25\lib\SocketServer.py", line 463, in process_request_thread
    self.finish_request(request, client_address)
  File "C:\Python25\lib\SocketServer.py", line 254, in finish_request
    self.RequestHandlerClass(request, client_address, self)
  File "C:\Python25\lib\SocketServer.py", line 521, in __init__
    self.handle()
  File "C:\Python25\lib\BaseHTTPServer.py", line 316, in handle
    self.handle_one_request()
  File "C:\Python25\lib\site-packages\trac-0.12dev_r7773-py2.5.egg\trac\web\wsgi.py", line 175, in handle_one_request
    gateway.run(self.server.application)
  File "C:\Python25\lib\site-packages\trac-0.12dev_r7773-py2.5.egg\trac\web\wsgi.py", line 87, in run
    response = application(self.environ, self._start_response)
  File "C:\Python25\lib\site-packages\trac-0.12dev_r7773-py2.5.egg\trac\web\standalone.py", line 89, in __call__
    return self.application(environ, start_response)
  File "C:\Python25\lib\site-packages\trac-0.12dev_r7773-py2.5.egg\trac\web\main.py", line 428, in dispatch_request
    return _dispatch_request(req, env, env_error)
  File "C:\Python25\lib\site-packages\trac-0.12dev_r7773-py2.5.egg\trac\web\main.py", line 524, in _dispatch_request
    req.send_error(exc_info, status=500, env=env, data=data)
  File "C:\Python25\lib\site-packages\trac-0.12dev_r7773-py2.5.egg\trac\web\api.py", line 397, in send_error
    exc_info)
  File "C:\Python25\lib\site-packages\trac-0.12dev_r7773-py2.5.egg\trac\web\main.py", line 457, in _dispatch_request
    dispatcher.dispatch(req)
  File "C:\Python25\lib\site-packages\trac-0.12dev_r7773-py2.5.egg\trac\web\main.py", line 214, in dispatch
    resp = chosen_handler.process_request(req)
  File "C:\Python25\lib\site-packages\trac-0.12dev_r7773-py2.5.egg\trac\ticket\report.py", line 106, in process_request
    template, data, content_type = self._render_view(req, db, id)
  File "C:\Python25\lib\site-packages\trac-0.12dev_r7773-py2.5.egg\trac\ticket\report.py", line 479, in _render_view
    filename=filename)
  File "C:\Python25\lib\site-packages\trac-0.12dev_r7773-py2.5.egg\trac\ticket\report.py", line 691, in _send_csv
    row[i] = converters[i](row[i]).encode('utf-8')
  File "C:\Python25\lib\site-packages\trac-0.12dev_r7773-py2.5.egg\trac\ticket\report.py", line 670, in iso_datetime
    return format_datetime(dt, 'iso8601')
  File "C:\Python25\lib\site-packages\trac-0.12dev_r7773-py2.5.egg\trac\util\datefmt.py", line 105, in format_datetime
    t = to_datetime(t, tzinfo).astimezone(tzinfo or localtz)
  File "C:\Python25\lib\site-packages\trac-0.12dev_r7773-py2.5.egg\trac\util\datefmt.py", line 51, in to_datetime
    type(t))
TypeError: expecting datetime, int, long, float, or None; got <type 'unicode'>
----------------------------------------



System Information
Trac:0.12dev-r7773
Python:2.5 (r25:51908, Sep 19 2006, 09:52:17) [MSC v.1310 32 bit (Intel)]
setuptools:0.6c9
SQLite:3.6.2
pysqlite:2.5.1
Genshi:0.6dev-r1019
Pygments:1.0
Subversion:1.5.4 (r33841)
jQuery:1.2.6



-- ## 15: Not Closed with  LastComment ## --

SELECT
  P.value AS __color__,
  T.id,
  (
  SELECT
    SA1.value
  FROM
    session_attribute SA1
  WHERE
    SA1.sid = T.owner AND
    SA1.name = 'name'
  ) || ' (' || T.owner || ')' AS __group__,
  T.summary,
  T.component,
  T.type,
  T.status,
  T.time AS created,
  D.value AS due_date,
  T.changetime AS modified,
  T.priority,
  WUPT.value AS _wup_ticket,
  WUPO.value AS _wup_author,
  T.reporter AS _reporter,
  (
  SELECT
    SA2.value
  FROM
    session_attribute SA2
  WHERE
    SA2.sid = T.reporter AND
    SA2.name = 'name'
  ) || ' (' || T.reporter || ')' AS reporter_name,
  W.value AS _resolution_status,
  T.description AS _description_,
  C.comment AS _last_comment_
FROM
    ticket T
  LEFT JOIN enum P
    ON ( P.name = T.priority AND
         P.type = 'priority' )
  LEFT JOIN ticket_custom WUPT
    ON ( WUPT.ticket = T.id AND
         WUPT.name = 'wup_ticket' )
  LEFT JOIN ticket_custom WUPO
    ON ( WUPO.ticket = T.id AND
         WUPO.name = 'wup_author' )
  LEFT JOIN ticket_custom W
    ON ( W.ticket = T.id AND
         W.name = 'workaround' )
  LEFT JOIN
  (
  SELECT
    TC1.ticket AS ticket,
    TC1.time,
    TC1.author,
    (
    SELECT
      SA1.value
    FROM
      session_attribute SA1
    WHERE
      SA1.sid = TC1.author AND
      SA1.name = 'name'
    ) || ' (' || TC1.author || ')' AS commenter,
    TC1.newvalue AS comment
  FROM
      ticket_change TC1
    JOIN
    (
    SELECT
      C.ticket AS ticket,
      MAX ( C.oldvalue ) AS max_old
    FROM
      ticket_change C
    WHERE
      C.field = 'comment' AND
      LENGTH ( TRIM ( C.newvalue ) ) > 0
    GROUP BY
      C.ticket
    ) TC2
      ON ( TC2.ticket = TC1.ticket AND
           TC2.max_old = TC1.oldvalue )
  WHERE
    TC1.field = 'comment' AND
    LENGTH ( TRIM ( TC1.newvalue ) ) > 0
  ) C
    ON ( C.ticket = T.id )
  LEFT JOIN ticket_custom D
    ON ( D.ticket = T.id AND
         D.name = 'due' )
WHERE
  T.status != 'closed'
ORDER BY
  T.owner ASC,
  T.severity ASC,
  T.id ASC

Attachments (0)

Change History (3)

comment:1 by anonymous, 16 years ago

Resolution: fixed
Status: newclosed

comment:2 by ebray, 16 years ago

Resolution: fixed
Status: closedreopened

comment:3 by Christian Boos, 16 years ago

Description: modified (diff)
Milestone: 0.12
Resolution: worksforme
Status: reopenedclosed

I modified slightly your report (diffs can be seen using … the (diff) link and original version can be obtained by looking at ticket:8120?version=0, adding a missing AS, removing the datetime functions and changing the time column names to known names, as documented in TracReports#Automaticallyformattedcolumns.

Modify Ticket

Change Properties
Set your email in Preferences
Action
as closed The ticket will remain with no owner.
The resolution will be deleted. Next status will be 'reopened'.
to The owner will be changed from (none) to the specified user.

Add Comment


E-mail address and name can be saved in the Preferences .
 
Note: See TracTickets for help on using tickets.