Changeset 14515


Ignore:
Timestamp:
Apr 2, 2015, 6:02:53 AM (9 years ago)
Author:
Ryan J Ollos
Message:

4.0.0dev: Avoid traceback when custom field value is None.

Initial patch by leerw@…. Fixes #12180.

Location:
masterticketsplugin/trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • masterticketsplugin/trunk/mastertickets/model.py

    r14323 r14515  
    7171
    7272                if update_field is not None:
    73                     cursor.execute('SELECT value FROM ticket_custom WHERE ticket=%s AND name=%s',
    74                                    (n, str(field)))
    75                     old_value = (cursor.fetchone() or ('',))[0]
    76                     new_value = [x.strip() for x in old_value.split(',') if x.strip()]
     73                    old_value = self.env.db_query("""
     74                        SELECT value FROM ticket_custom WHERE ticket=%s AND name=%s
     75                        """, (n, field))[0][0]
     76                    if old_value:
     77                        new_value = [x.strip() for x in old_value.split(',') if x.strip()]
     78                    else:
     79                        new_value = []
    7780                    update_field(new_value)
    7881                    new_value = ', '.join(sorted(new_value, key=lambda x: int(x)))
  • masterticketsplugin/trunk/setup.py

    r14514 r14515  
    5151    ],
    5252
    53     install_requires=['Trac>=0.12'],
    54 
    5553    test_suite='mastertickets.tests.suite',
    5654    entry_points={
Note: See TracChangeset for help on using the changeset viewer.