Edgewall Software
Modify

Opened 13 years ago

Closed 13 years ago

Last modified 10 years ago

#9995 closed defect (cantfix)

AttributeError: 'datetime.datetime' object has no attribute 'encode'

Reported by: billmay Owned by:
Priority: normal Milestone:
Component: general Version: 0.12.1
Severity: normal Keywords:
Cc: support@… Branch:
Release Notes:
API Changes:
Internal Changes:

Description

How to Reproduce

While doing a GET operation on /backlog/Product Backlog/global, Trac issued an internal error.

I created a test project to try out the agilo plugin. The product log worked at first until I added a few more requirements, tasks, and stories. After navigating back to the product log, it no longer worked (it just appeared as a blank page with a page title of product log. I received this error when I clicked on the download in .csv format at the bottom of the product log page.

Request parameters:

{'format': u'csv', 'name': u'Product Backlog', 'scope': u'global'}

User agent: Mozilla/5.0 (Windows; U; Windows NT 6.1; en-US; rv:1.9.2.13) Gecko/20101203 Firefox/3.6.13

System Information

Trac 0.12.1
Trac 0.12.1
Agilo 0.9.2
Babel 0.9.5
Docutils 0.7
Genshi 0.6
mod_wsgi 2.5 (WSGIProcessGroup trac_http_wsgi WSGIApplicationGroup %{GLOBAL})
Pygments 1.4dev-20110115
pysqlite 2.4.1
Python 2.5.2 (r252:60911, Jan 24 2010, 18:02:01)
[GCC 4.3.2]
Python 2.5.2 (r252:60911, Jan 24 2010, 18:02:01)
[GCC 4.3.2]
pytz 2008c
pytz 2008c
RPC 1.1.0-r9395
setuptools 0.6c12
setuptools 0.6c12
SQLite 3.7.3
Subversion 1.6.15 (r1038135)
jQuery 1.4.2

Enabled Plugins

agilo 0.9.2
TracAnnouncer 0.12.1.dev
TracDownloads 0.3
TracTocMacro 11.0.0.3
TracWysiwyg 0.12.0.3-r9676
TracXMLRPC 1.1.0-r9395

Python Traceback

Traceback (most recent call last):
  File "/usr/local/lib/python2.5/site-packages/Trac-0.12.1-py2.5.egg/trac/web/main.py", line 511, in _dispatch_request
    dispatcher.dispatch(req)
  File "/usr/local/lib/python2.5/site-packages/Trac-0.12.1-py2.5.egg/trac/web/main.py", line 237, in dispatch
    resp = chosen_handler.process_request(req)
  File "/usr/local/lib/python2.5/site-packages/agilo-0.9.2-py2.5.egg/agilo/api/view.py", line 155, in process_request
    return self._call_filters_and_handler(req, handler)
  File "/usr/local/lib/python2.5/site-packages/agilo-0.9.2-py2.5.egg/agilo/api/view.py", line 143, in _call_filters_and_handler
    data = handler(req) or {}
  File "/usr/local/lib/python2.5/site-packages/agilo-0.9.2-py2.5.egg/agilo/scrum/backlog/web_ui.py", line 319, in do_get
    send_backlog_as(self.env, req, backlog, req.args['format'])
  File "/usr/local/lib/python2.5/site-packages/agilo-0.9.2-py2.5.egg/agilo/scrum/backlog/csv_export.py", line 49, in send_backlog_as
    mime.send_converted(req, BACKLOG_CONVERSION_KEY, backlog, format, filename=backlog.scope)
  File "/usr/local/lib/python2.5/site-packages/Trac-0.12.1-py2.5.egg/trac/mimeview/api.py", line 982, in send_converted
    content, selector)
  File "/usr/local/lib/python2.5/site-packages/Trac-0.12.1-py2.5.egg/trac/mimeview/api.py", line 681, in convert_content
    output = converter.convert_content(req, mimetype, content, ck)
  File "/usr/local/lib/python2.5/site-packages/agilo-0.9.2-py2.5.egg/agilo/scrum/backlog/csv_export.py", line 65, in convert_content
    return self.export_csv(req, backlog, mimetype='text/csv')
  File "/usr/local/lib/python2.5/site-packages/agilo-0.9.2-py2.5.egg/agilo/scrum/backlog/csv_export.py", line 102, in export_csv
    self._export_ticket(req, ticket, writer, field_names)
  File "/usr/local/lib/python2.5/site-packages/agilo-0.9.2-py2.5.egg/agilo/scrum/backlog/csv_export.py", line 89, in _export_ticket
    cols.append(value.encode('utf-8'))
AttributeError: 'datetime.datetime' object has no attribute 'encode'

Attachments (0)

Change History (4)

comment:1 by Remy Blank, 13 years ago

Cc: support@… added
Resolution: cantfix
Status: newclosed

comment:2 by Martin Häcker <martin.haecker@…>, 13 years ago

@reporter: can you please contact our support google group (details at AgiloForScrum) about this issue? To help us debug this a bit more information would help, most interesting to me: where exactly did you click the CSV-Format link?

Thanks!

@rblank: thanks for the wrangling. :)

comment:3 by Martin Häcker <martin.haecker@…>, 13 years ago

@reporter: can you please also add details about what data you entered into the test agilo and if you changed any of the standard settings? (as I can't reproduce this issue yet).

comment:4 by anonymous, 10 years ago

Found a bit of a workaround.

Replace the line in csv_export.py

           cols.append(value.encode('utf-8'))

with

            if type(value) is datetime:
                cols.append(value)
            else:
                cols.append(value.encode('utf-8'))

and don't forget imports!

from datetime import datetime

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.