Modify

Opened 10 years ago

Closed 10 years ago

Last modified 10 years ago

#11636 closed defect (duplicate)

can't import time, changetime

Reported by: wxl@… Owned by: François Granade
Priority: normal Component: TicketImportPlugin
Severity: normal Keywords:
Cc: Trac Release: 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'

Attachments (0)

Change History (6)

comment:1 Changed 10 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 10 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 10 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 10 years ago by Jun Omae

Resolution: duplicate
Status: newclosed

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

comment:5 Changed 10 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 10 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

     
    8989            req.session['importer.uploadedfile'] = None
    9090            req.session['importer.uploadedfilename'] = None
    9191
     92            ticket_fields = TicketSystem(self.env).get_ticket_fields()
    9293            data = { 'reconciliate_by_owner_also': self._reconciliate_by_owner_also(),
    93                      'fields': ['ticket or id'] + [field['name'] for field in TicketSystem(self.env).get_ticket_fields()],
     94                     'fields': ['ticket or id'] + \
     95                               [field['name']
     96                                for field in ticket_fields
     97                                if field['name'] not in ('time', 'changetime')],
    9498                     'csv_default_encoding': self.csv_default_encoding,
    9599                     'encodings': self._get_encodings() }
    96100

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

Modify Ticket

Change Properties
Set your email in Preferences
Action
as closed The owner will remain François Granade.
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.