Opened 9 years ago

Closed 9 years ago

# can't import time, changetime

Reported by: Owned by: wxl@… François Granade normal TicketImportPlugin normal 1.0

### Description

i'm trying to switch from spiceworks (ew) to trac (yay) and trying to get our old tickets out of it. i know this isn't the goal of this plugin but that its purpose has veered more towards this over time. i finally got some nice xls files ready to go with proper time, changetime fields. however, no matter what i do to the format in either the xls file or in trac.ini, i am faced with an error.

from what i gather by mousing over datetimes in trac, it appears that the standard format is %m/%d/%Y %H:%M:%S, so i edited my datetimes in the xls and get an error: ValueError: invalid literal for int() with base 10: '02/11/13'

so then i tried to stick with the native format from spiceworks, e.g. 2013-11-02 @ 05:15 pm so i edited trac.ini as such:

[importer]
datetime_format=%Y-%m-%d %I:%M %p


same problem, more or less: ValueError: invalid literal for int() with base 10: '2013-02-11 @ 05:28 pm'

### comment:1 Changed 9 years ago by François Granade

If I read the error correctly, you have a datetime that contains an "@" between the day and the time

you may want to try:

[importer]
datetime_format=%Y-%m-%d @ %I:%M %p


it may work, but I'm not sure. Probably a safer way is to review your spreadsheet, search (and remove) the "@ " (with a space).

### comment:2 Changed 9 years ago by anonymous

derp, sorry. that's what i meant i had for datetime_format, sorry.

i now have the xls with e.g.: 2013-02-11 05:28 PM

and:

[importer]
datetime_format=%Y-%m-%d %I:%M %p


and: ValueError: invalid literal for int() with base 10: '2013-02-11 05:28 PM'

### comment:3 Changed 9 years ago by anonymous

i don't know if this helps but i thought i saw the code was:

format_time(int(cell))


or something of the sort.

just popping open python, trying to do the string→int cast, it fails with a similar error, e.g.:

>>> int('2013-02-11')
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ValueError: invalid literal for int() with base 10: '2013-02-11'


not sure that's helpful, but hey.

### comment:4 Changed 9 years ago by Jun Omae

Resolution: → duplicate new → closed

A duplicate of #4783. The plugin currently doesn't support for ticket.time and ticket.changetime.

### comment:5 follow-up:  6 Changed 9 years ago by anonymous

the import page lists all the available fields. you should get rid of time and changetime from the list until it's possible to use them. that would make it far less confusing!

it would also be good to explain that the datetime_format variable is useful only for custom (string) date fields.

### comment:6 in reply to:  5 Changed 9 years ago by Jun Omae

the import page lists all the available fields. you should get rid of time and changetime from the list until it's possible to use them. that would make it far less confusing!

Okay. That's not good. The following patch don't show time and changetime for valid fields. I'll push it later.

• ## talm_importer/importer.py

 req.session['importer.uploadedfile'] = None req.session['importer.uploadedfilename'] = None ticket_fields = TicketSystem(self.env).get_ticket_fields() data = { 'reconciliate_by_owner_also': self._reconciliate_by_owner_also(), 'fields': ['ticket or id'] + [field['name'] for field in TicketSystem(self.env).get_ticket_fields()], 'fields': ['ticket or id'] + \ [field['name'] for field in ticket_fields if field['name'] not in ('time', 'changetime')], 'csv_default_encoding': self.csv_default_encoding, 'encodings': self._get_encodings() }

I've post patch to support time field. But the patch is too old and should be refreshed.

### Modify Ticket

Change Properties