Opened 7 years ago

Closed 7 years ago

#8411 closed defect (fixed)

error when create new type

Reported by: okamototk Owned by: François Granade
Priority: normal Component: TicketImportPlugin
Severity: normal Keywords:
Cc: Trac Release: 0.12


When create new type, plugin output following error:

2011-01-18 22:18:12,101 Trac[main] ERROR: Internal Server Error: 
Traceback (most recent call last):
  File "build\bdist.win32\egg\trac\web\", line 511, in _dispatch_request
  File "build\bdist.win32\egg\trac\web\", line 237, in dispatch
    resp = chosen_handler.process_request(req)
  File "build\bdist.win32\egg\talm_importer\", line 76, in process_request
    return self._do_import(req.session['uploadedfile'], int(req.session['sheet']), req, req.session['uploadedfilename'], tickettime)
  File "build\bdist.win32\egg\talm_importer\", line 118, in _do_import
    return self._process(filereader, get_reporter_id(req), ImportProcessor(self.env, req, uploadedfilename, tickettime))
  File "build\bdist.win32\egg\talm_importer\", line 369, in _process
  File "build\bdist.win32\egg\talm_importer\", line 156, in process_new_lookups
  File "build\bdist.win32\egg\trac\ticket\", line 709, in insert
  File "build\bdist.win32\egg\trac\db\", line 77, in transaction_wrapper
  File "build\bdist.win32\egg\trac\ticket\", line 720, in do_insert
    (self.type,, self.value))
  File "build\bdist.win32\egg\trac\db\", line 65, in execute
    return self.cursor.execute(sql_escape_percent(sql), args)
  File "build\bdist.win32\egg\trac\db\", line 78, in execute
    result = PyFormatCursor.execute(self, *args)
  File "build\bdist.win32\egg\trac\db\", line 56, in execute
    args or [])
  File "build\bdist.win32\egg\trac\db\", line 48, in _rollback_on_error
    return function(self, *args, **kwargs)
IntegrityError: columns type, name are not unique

ticket type is 'ticket_type' enum but plugin treat just 'type'. Following patch fixed the problem.

---       (revision 9770)
+++       (working copy)
@@ -134,6 +134,9 @@
             elif field == 'version':
                 class CurrentLookupEnum(model.Version):
+            elif field == 'type':
+                class CurrentLookupEnum(model.Type):
+                    pass
                 class CurrentLookupEnum(model.AbstractEnum):
                     # here, you shouldn't put 'self.' before the class field.

best regards,

Takashi Okamoto

Attachments (0)

Change History (1)

comment:1 Changed 7 years ago by François Granade

Resolution: fixed
Status: newclosed

Good catch, thank you - patch slighly improved and commited in [9772], with test.

Modify Ticket

Change Properties
Set your email in Preferences
as closed The owner will remain François Granade.
The resolution will be deleted.

Add Comment

E-mail address and name can be saved in the Preferences.

Note: See TracTickets for help on using tickets.