Edgewall Software

Opened 6 years ago

Last modified 4 years ago

#13040 closed defect

TypeError: expecting datetime, int, long, float, or None; got <type 'unicode'> - Clone button bug — at Initial Version

Reported by: pcelba Owned by:
Priority: normal Milestone: 1.4.1
Component: ticket system Version: 1.3.2
Severity: normal Keywords: ticketclone time field
Cc: Branch:
Release Notes:
API Changes:
Internal Changes:

Description

How to Reproduce

While doing a POST operation on /newticket, Trac issued an internal error.

When creating a new ticket by the Clone button click and the original ticket contains Time field defined as

test_eight = time
test_eight.format = date
test_eight.label = An absolute date
test_eight.order = 5
test_eight.value = 

the Type error appears and also the warning on top saying: Warning: The ticket field An absolute date is invalid: "1528603200000000" is an invalid date, or the date format is not known. Try "MMM d, y" or "YYYY-MM-DD" instead.

Request parameters:

{u'__FORM_TOKEN': u'af4e62a78a566df7aed49e9e',
 u'clone': u'+ Clone',
 u'field_blockedby': u'',
 u'field_blocking': u'',
 u'field_cc': u'',
 u'field_changetime': u'1528658560945708',
 u'field_client': u'',
 u'field_component': u'Infrastructure',
 u'field_description': u'Cloned from #1:\r\n> Some description here. Images will come later...\r\n> \r\n',
 u'field_estimatedhours': u'0',
 u'field_hours': u'0',
 u'field_keywords': u'',
 u'field_milestone': u'',
 u'field_owner': u'pcelba',
 u'field_parents': u'',
 u'field_priority': u'critical',
 u'field_summary': u'The first ticket with a large number of comments (cloned)',
 u'field_test_eight': u'1528603200000000',
 u'field_time': u'1528374973950465',
 u'field_totalhours': u'1640.5',
 u'field_type': u'task (no coding)',
 u'field_version': u'',
 u'preview': u''}

User agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/66.0.3359.181 Safari/537.36

System Information

Trac 1.3.2
Babel 2.6.0
Genshi 0.7 (without speedups)
Jinja2 2.10
pysqlite 2.6.0
Python 2.7.15 (v2.7.15:ca079a3ea3, Apr 30 2018, 16:30:26) [MSC v.1500 64 bit (AMD64)]
pytz 2018.4
setuptools 39.2.0
SQLite 3.14.2
jQuery 1.12.4
jQuery UI 1.12.1
jQuery Timepicker 1.6.3

Enabled Plugins

timingandestimationplugin 1.5.9
traccustomfieldadmin 0.2.13
tracmastertickets 4.0.2
tracsubticketsplugin 0.5.3

Interface Customization

shared-htdocs
shared-templates
site-htdocs malotraccloud3.jpg
site-templates

Python Traceback

Traceback (most recent call last):
  File "e:\pythonvirtual\trac13\lib\site-packages\trac\web\main.py", line 640, in _dispatch_request
    dispatcher.dispatch(req)
  File "e:\pythonvirtual\trac13\lib\site-packages\trac\web\main.py", line 263, in dispatch
    method=method)
  File "e:\pythonvirtual\trac13\lib\site-packages\trac\web\chrome.py", line 1418, in render_template
    fragment, iterable, method)
  File "e:\pythonvirtual\trac13\lib\site-packages\trac\web\chrome.py", line 1477, in _render_jinja_template
    page = self.render_template_string(template, data, text)
  File "e:\pythonvirtual\trac13\lib\site-packages\trac\web\chrome.py", line 1647, in render_template_string
    string = template.render(data)
  File "e:\pythonvirtual\trac13\lib\site-packages\jinja2\environment.py", line 1008, in render
    return self.environment.handle_exception(exc_info, True)
  File "e:\pythonvirtual\trac13\lib\site-packages\jinja2\environment.py", line 780, in handle_exception
    reraise(exc_type, exc_value, tb)
  File "e:\pythonvirtual\trac13\lib\site-packages\trac\ticket\templates\ticket.html", line 132, in top-level template code
    <a href="#comment:${cnum}" class="${cls}">${prefix}${cnum}</a>
  File "e:\pythonvirtual\trac13\lib\site-packages\trac\templates\layout.html", line 12, in top-level template code
    # import "macros.html" as jmacros with context
  File "e:\pythonvirtual\trac13\lib\site-packages\trac\templates\theme.html", line 22, in top-level template code
    # block body
  File "e:\pythonvirtual\trac13\lib\site-packages\trac\templates\theme.html", line 128, in block "body"
    # block content
  File "e:\pythonvirtual\trac13\lib\site-packages\trac\ticket\templates\ticket.html", line 621, in block "content"
    #     include 'ticket_box.html'
  File "e:\pythonvirtual\trac13\lib\site-packages\trac\ticket\templates\ticket_box.html", line 137, in top-level template code
    ${pretty_dateinfo(value, field.format,
  File "e:\pythonvirtual\trac13\lib\site-packages\trac\timeline\web_ui.py", line 280, in pretty_dateinfo
    absolute = user_time(req, format_date, date)
  File "e:\pythonvirtual\trac13\lib\site-packages\trac\util\datefmt.py", line 915, in user_time
    return func(*args, **kwargs)
  File "e:\pythonvirtual\trac13\lib\site-packages\trac\util\datefmt.py", line 324, in format_date
    return _format_datetime(t, format, tzinfo, locale, 'date')
  File "e:\pythonvirtual\trac13\lib\site-packages\trac\util\datefmt.py", line 274, in _format_datetime
    t = to_datetime(t, tzinfo or localtz)
  File "e:\pythonvirtual\trac13\lib\site-packages\trac\util\datefmt.py", line 179, in to_datetime
    type(t))
TypeError: expecting datetime, int, long, float, or None; got <type 'unicode'>

Change History (0)

Note: See TracTickets for help on using tickets.