Modify

Opened 3 years ago

Closed 3 years ago

#8667 closed enhancement (fixed)

[Patch] Compatibility with Python 2.4

Reported by: jun66j5 Owned by: farialima
Priority: normal Component: TicketImportPlugin
Severity: normal Keywords:
Cc: Trac Release: 0.12

Description

The TicketImportPlugin is very usable and excellent, however, the plugin does not work with Python 2.4 on CentOS 5.5.

$ python2.4
Python 2.4.3 (#1, Nov 11 2010, 13:34:43)
[GCC 4.1.2 20080704 (Red Hat 4.1.2-48)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import talm_importer.importer
Traceback (most recent call last):
  File "<stdin>", line 1, in ?
  File "/home/jun66j5/src/ticketimportplugin.git/talm_importer/__init__.py", line 8, in ?
    from talm_importer.importer import *
  File "talm_importer/importer.py", line 310
    ticket_id = int(row[idcolumn]) if row[idcolumn] else 0
                                    ^
SyntaxError: invalid syntax

Because the plugin uses new syntax ... if ... else ... since Python 2.5.

Please apply the following patch, if you can.

  • talm_importer/importer.py

    diff --git a/talm_importer/importer.py b/talm_importer/importer.py
    index bc7afa6..7b820d4 100644
    a b class ImportModule(Component): 
    307307 
    308308        for row in rows: 
    309309            if idcolumn: 
    310                 ticket_id = int(row[idcolumn]) if row[idcolumn] else 0 
     310                ticket_id = int(row[idcolumn] or 0) 
    311311                if ticket_id: 
    312312                    self._check_ticket(db, ticket_id) 
    313313                else: 

Attachments (0)

Change History (1)

comment:1 Changed 3 years ago by farialima

  • Resolution set to fixed
  • Status changed from new to closed

Thanks - good catch - committed in [10018]

Add Comment

Modify Ticket

Action
as closed .
as The resolution will be set. Next status will be 'closed'.
to The owner will be changed from farialima. Next status will be 'closed'.
The resolution will be deleted. Next status will be 'reopened'.
Author


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

 
Note: See TracTickets for help on using tickets.