Modify

Opened 13 years ago

Closed 13 years ago

#8667 closed enhancement (fixed)

[Patch] Compatibility with Python 2.4

Reported by: Jun Omae Owned by: François Granade
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 13 years ago by François Granade

Resolution: fixed
Status: newclosed

Thanks - good catch - committed in [10018]

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.