Modify

Opened 5 years ago

Closed 5 years ago

Last modified 5 years ago

#13108 closed defect (fixed)

TypeError: 'ConnectionWrapper' object is not iterable

Reported by: mx.tian@… Owned by: Jun Omae
Priority: normal Component: TicketCalendarPlugin
Severity: major Keywords:
Cc: Trac Release: 1.2

Description (last modified by Jun Omae)

Using the TicketCalendarPlugin to generate an internal error when I visit the page:

2017-03-15 11:36:23,666 Trac[main] ERROR: Internal Server Error: <RequestWithSession "GET '/ticketcalendar-box'">, referrer 'http://trac.xxx.cn/admin'
Traceback (most recent call last):
  File "/usr/lib/python2.6/site-packages/trac/web/main.py", line 613, in _dispatch_request
    dispatcher.dispatch(req)
  File "/usr/lib/python2.6/site-packages/trac/web/main.py", line 253, in dispatch
    resp = chosen_handler.process_request(req)
  File "build/bdist.linux-x86_64/egg/ticketcalendar/web_ui.py", line 765, in process_request
    data = calendar.template_data(req, query)
  File "build/bdist.linux-x86_64/egg/ticketcalendar/web_ui.py", line 296, in template_data
    tickets = query.execute(req, db)
  File "/usr/lib/python2.6/site-packages/trac/ticket/query.py", line 295, in execute
    sql, args = self.get_sql(req, cached_ids, authname, tzinfo, locale)
  File "/usr/lib/python2.6/site-packages/trac/ticket/query.py", line 639, in get_sql
    (','.join(str(id) for id in cached_ids)))
TypeError: 'ConnectionWrapper' object is not iterable

Attachments (0)

Change History (12)

comment:1 Changed 5 years ago by anonymous

Trac Release: 1.2

comment:2 Changed 5 years ago by Jun Omae

Description: modified (diff)
Priority: highnormal

comment:3 Changed 5 years ago by Jun Omae

In 16331:

ticketcalendar: make compatible with Trac 1.2 (refs #13108)

comment:4 Changed 5 years ago by mx.tian@…

I updated the code that you submitted, and there are still errors about the date of the problem.

2017-03-15 12:32:26,066 Trac[main] ERROR: Internal Server Error: <RequestWithSession "POST '/ticketcalendar-box'">, referrer 'http://trac.xxx.cn/ticketcalendar-box'
Traceback (most recent call last):
  File "/usr/lib/python2.6/site-packages/trac/web/main.py", line 613, in _dispatch_request
    dispatcher.dispatch(req)
  File "/usr/lib/python2.6/site-packages/trac/web/main.py", line 253, in dispatch
    resp = chosen_handler.process_request(req)
  File "build/bdist.linux-x86_64/egg/ticketcalendar/web_ui.py", line 779, in process_request
    data = calendar.template_data(req, query)
  File "build/bdist.linux-x86_64/egg/ticketcalendar/web_ui.py", line 302, in template_data
    tickets = self._query_execute(query, req)
  File "build/bdist.linux-x86_64/egg/ticketcalendar/web_ui.py", line 313, in _query_execute
    return query.execute(req)
  File "/usr/lib/python2.6/site-packages/trac/ticket/query.py", line 330, in execute
    val = from_utimestamp(long(val)) if val else ''
ValueError: invalid literal for long() with base 10: '05-10-2016'

comment:5 Changed 5 years ago by Jun Omae

Please post how to reproduce it. Your post doesn't have the details.

comment:6 Changed 5 years ago by Jun Omae

Also, confirm whether it is able to view ticket which has '05-10-2016' on custom query. I think value in the ticket is broken on your environment.

comment:7 Changed 5 years ago by Jun Omae

Resolution: fixed
Status: newclosed

The original issue has been fixed.

comment:8 Changed 5 years ago by mx.tian@…

I found in the database "ticket_custom" table, the value of the field "due_date" is the character date "05-12-2016", if the number can be changed, such as "001489507200000000", so in order to solve it, I put all the characters date The replacement.

At this point the problem seems to have been resolved, but it is not true.

Now I want to report a new question, in the calendar click "New ticket with" 2017/02/28 "as the start date", give a new error.

TypeError: expecting datetime, int, long, float, or None; got <type 'unicode'>
2017-03-15 14:07:28,532 Trac[main] ERROR: Internal Server Error: <RequestWithSession "GET '/newticket?due_date=2017/02/28'">, referrer 'http://trac.xxx.cn/ticketcalendar-box?owner=!tianmingxing&status=accepted&status=assigned&status=closed&status=new&status=reopened&status=reviewing&order=priority&_month=2017-03'
Traceback (most recent call last):
  File "/usr/lib/python2.6/site-packages/trac/web/main.py", line 613, in _dispatch_request
    dispatcher.dispatch(req)
  File "/usr/lib/python2.6/site-packages/trac/web/main.py", line 273, in dispatch
    iterable=chrome.use_chunked_encoding)
  File "/usr/lib/python2.6/site-packages/trac/web/chrome.py", line 1159, in render_template
    encoding='utf-8')
  File "build/bdist.linux-x86_64/egg/genshi/core.py", line 184, in render
    return encode(generator, method=method, encoding=encoding, out=out)
  File "build/bdist.linux-x86_64/egg/genshi/output.py", line 58, in encode
    for chunk in iterator:
  File "build/bdist.linux-x86_64/egg/genshi/output.py", line 350, in __call__
    for kind, data, pos in stream:
  File "build/bdist.linux-x86_64/egg/genshi/output.py", line 829, in __call__
    for kind, data, pos in stream:
  File "build/bdist.linux-x86_64/egg/genshi/output.py", line 669, in __call__
    for kind, data, pos in stream:
  File "build/bdist.linux-x86_64/egg/genshi/output.py", line 774, in __call__
    for kind, data, pos in chain(stream, [(None, None, None)]):
  File "build/bdist.linux-x86_64/egg/genshi/output.py", line 594, in __call__
    for ev in stream:
  File "build/bdist.linux-x86_64/egg/genshi/core.py", line 289, in _ensure
    for event in stream:
  File "build/bdist.linux-x86_64/egg/genshi/core.py", line 289, in _ensure
    for event in stream:
  File "/usr/lib/python2.6/site-packages/trac/web/chrome.py", line 1426, in _strip_accesskeys
    for kind, data, pos in stream:
  File "build/bdist.linux-x86_64/egg/genshi/core.py", line 289, in _ensure
    for event in stream:
  File "/usr/lib/python2.6/site-packages/trac/web/chrome.py", line 1415, in _generate
    for kind, data, pos in stream:
  File "build/bdist.linux-x86_64/egg/genshi/core.py", line 289, in _ensure
    for event in stream:
  File "build/bdist.linux-x86_64/egg/genshi/core.py", line 289, in _ensure
    for event in stream:
  File "build/bdist.linux-x86_64/egg/genshi/filters/transform.py", line 706, in _unmark
    for mark, event in stream:
  File "build/bdist.linux-x86_64/egg/genshi/filters/transform.py", line 1076, in __call__
    for mark, event in stream:
  File "build/bdist.linux-x86_64/egg/genshi/filters/transform.py", line 118, in __iter__
    event = self.stream.next()
  File "build/bdist.linux-x86_64/egg/genshi/filters/transform.py", line 734, in __call__
    for mark, event in stream:
  File "build/bdist.linux-x86_64/egg/genshi/filters/transform.py", line 702, in _mark
    for event in stream:
  File "build/bdist.linux-x86_64/egg/genshi/core.py", line 289, in _ensure
    for event in stream:
  File "build/bdist.linux-x86_64/egg/genshi/filters/transform.py", line 706, in _unmark
    for mark, event in stream:
  File "build/bdist.linux-x86_64/egg/genshi/filters/transform.py", line 1127, in __call__
    for mark, event in stream:
  File "build/bdist.linux-x86_64/egg/genshi/filters/transform.py", line 118, in __iter__
    event = self.stream.next()
  File "build/bdist.linux-x86_64/egg/genshi/filters/transform.py", line 734, in __call__
    for mark, event in stream:
  File "build/bdist.linux-x86_64/egg/genshi/filters/transform.py", line 702, in _mark
    for event in stream:
  File "build/bdist.linux-x86_64/egg/genshi/core.py", line 289, in _ensure
    for event in stream:
  File "build/bdist.linux-x86_64/egg/genshi/filters/transform.py", line 706, in _unmark
    for mark, event in stream:
  File "build/bdist.linux-x86_64/egg/genshi/filters/transform.py", line 1127, in __call__
    for mark, event in stream:
  File "build/bdist.linux-x86_64/egg/genshi/filters/transform.py", line 118, in __iter__
    event = self.stream.next()
  File "build/bdist.linux-x86_64/egg/genshi/filters/transform.py", line 734, in __call__
    for mark, event in stream:
  File "build/bdist.linux-x86_64/egg/genshi/filters/transform.py", line 702, in _mark
    for event in stream:
  File "build/bdist.linux-x86_64/egg/genshi/core.py", line 289, in _ensure
    for event in stream:
  File "build/bdist.linux-x86_64/egg/genshi/filters/transform.py", line 706, in _unmark
    for mark, event in stream:
  File "build/bdist.linux-x86_64/egg/genshi/filters/transform.py", line 1127, in __call__
    for mark, event in stream:
  File "build/bdist.linux-x86_64/egg/genshi/filters/transform.py", line 118, in __iter__
    event = self.stream.next()
  File "build/bdist.linux-x86_64/egg/genshi/filters/transform.py", line 734, in __call__
    for mark, event in stream:
  File "build/bdist.linux-x86_64/egg/genshi/filters/transform.py", line 702, in _mark
    for event in stream:
  File "build/bdist.linux-x86_64/egg/genshi/core.py", line 289, in _ensure
    for event in stream:
  File "build/bdist.linux-x86_64/egg/genshi/filters/transform.py", line 706, in _unmark
    for mark, event in stream:
  File "build/bdist.linux-x86_64/egg/genshi/filters/transform.py", line 1127, in __call__
    for mark, event in stream:
  File "build/bdist.linux-x86_64/egg/genshi/filters/transform.py", line 118, in __iter__
    event = self.stream.next()
  File "build/bdist.linux-x86_64/egg/genshi/filters/transform.py", line 734, in __call__
    for mark, event in stream:
  File "build/bdist.linux-x86_64/egg/genshi/filters/transform.py", line 702, in _mark
    for event in stream:
  File "build/bdist.linux-x86_64/egg/genshi/template/base.py", line 618, in _include
    for event in stream:
  File "build/bdist.linux-x86_64/egg/genshi/template/markup.py", line 378, in _match
    ctxt, start=idx + 1, **vars):
  File "build/bdist.linux-x86_64/egg/genshi/template/markup.py", line 378, in _match
    ctxt, start=idx + 1, **vars):
  File "build/bdist.linux-x86_64/egg/genshi/template/markup.py", line 362, in _match
    content = list(content)
  File "build/bdist.linux-x86_64/egg/genshi/template/base.py", line 618, in _include
    for event in stream:
  File "build/bdist.linux-x86_64/egg/genshi/template/markup.py", line 326, in _match
    for event in stream:
  File "build/bdist.linux-x86_64/egg/genshi/template/markup.py", line 315, in _strip
    event = next()
  File "build/bdist.linux-x86_64/egg/genshi/template/base.py", line 558, in _flatten
    for kind, data, pos in stream:
  File "build/bdist.linux-x86_64/egg/genshi/core.py", line 289, in _ensure
    for event in stream:
  File "build/bdist.linux-x86_64/egg/genshi/path.py", line 588, in _generate
    subevent = next()
  File "build/bdist.linux-x86_64/egg/genshi/template/base.py", line 618, in _include
    for event in stream:
  File "build/bdist.linux-x86_64/egg/genshi/template/markup.py", line 315, in _strip
    event = next()
  File "build/bdist.linux-x86_64/egg/genshi/template/base.py", line 558, in _flatten
    for kind, data, pos in stream:
  File "build/bdist.linux-x86_64/egg/genshi/core.py", line 289, in _ensure
    for event in stream:
  File "build/bdist.linux-x86_64/egg/genshi/path.py", line 588, in _generate
    subevent = next()
  File "build/bdist.linux-x86_64/egg/genshi/template/base.py", line 618, in _include
    for event in stream:
  File "build/bdist.linux-x86_64/egg/genshi/template/markup.py", line 315, in _strip
    event = next()
  File "build/bdist.linux-x86_64/egg/genshi/template/base.py", line 578, in _flatten
    result = _eval_expr(data, ctxt, vars)
  File "build/bdist.linux-x86_64/egg/genshi/template/base.py", line 289, in _eval_expr
    retval = expr.evaluate(ctxt)
  File "build/bdist.linux-x86_64/egg/genshi/template/eval.py", line 177, in evaluate
    return eval(self.code, _globals, {'__data__': data})
  File "/usr/lib/python2.6/site-packages/trac/ticket/templates/ticket_box.html", line 94, in <Expression u"pretty_dateinfo(value, field.format, dateonly=field.format != 'relative') if value else None">
    ${pretty_dateinfo(value, field.format, dateonly=field.format != 'relative') if value else None}
  File "/usr/lib/python2.6/site-packages/trac/timeline/web_ui.py", line 281, in pretty_dateinfo
    absolute = user_time(req, format_date, date)
  File "/usr/lib/python2.6/site-packages/trac/util/datefmt.py", line 909, in user_time
    return func(*args, **kwargs)
  File "/usr/lib/python2.6/site-packages/trac/util/datefmt.py", line 318, in format_date
    return _format_datetime(t, format, tzinfo, locale, 'date')
  File "/usr/lib/python2.6/site-packages/trac/util/datefmt.py", line 268, in _format_datetime
    t = to_datetime(t, tzinfo or localtz)
  File "/usr/lib/python2.6/site-packages/trac/util/datefmt.py", line 179, in to_datetime
    type(t))
TypeError: expecting datetime, int, long, float, or None; got <type 'unicode'>

comment:9 Changed 5 years ago by anonymous

Resolution: fixed
Status: closedreopened

comment:10 in reply to:  8 Changed 5 years ago by Jun Omae

Resolution: fixed
Status: reopenedclosed

Replying to mx.tian@…:

I found in the database "ticket_custom" table, the value of the field "due_date" is the character date "05-12-2016", if the number can be changed, such as "001489507200000000", so in order to solve it, I put all the characters date The replacement.

At this point the problem seems to have been resolved, but it is not true.

That is not a issue on this plugin.

Now I want to report a new question, in the calendar click "New ticket with" 2017/02/28 "as the start date", give a new error.

That is another issue.

comment:11 Changed 5 years ago by mx.tian@…

Do I want to create a new task to report this problem? Or through Google Online Forum? The The

comment:12 Changed 5 years ago by Jun Omae

If you found another issue, please report as new ticket it after reading trac:wiki:NewTicketGuidelines#HowtoProceed.

Modify Ticket

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