| | 306 | |
| | 307 | # this dict will have enum values for sorting |
| | 308 | # and will be used in sortkey(), if non-empty: |
| | 309 | sortValues = {} |
| | 310 | if sort_col in ['status', 'resolution', 'priority', 'severity']: |
| | 311 | # must fetch sort values for that columns |
| | 312 | # instead of comparing them as strings |
| | 313 | if not db: |
| | 314 | db = self.env.get_db_cnx() |
| | 315 | cursor = db.cursor() |
| | 316 | cursor.execute("SELECT name," + db.cast('value', 'int') + " FROM enum WHERE type=%s", |
| | 317 | (sort_col,)) |
| | 318 | for name, value in cursor: |
| | 319 | sortValues[name] = value |
| | 320 | |