Index: report.py
===================================================================
--- report.py	(revision 6673)
+++ report.py	(working copy)
@@ -303,8 +303,27 @@
 
             if col == sort_col:
                 header['asc'] = asc
+                
+                # this dict will have enum values for sorting
+                # and will be used in sortkey(), if non-empty:
+                sortValues = {}
+                if sort_col in ['status', 'resolution', 'priority', 'severity']:
+                    # must fetch sort values for that columns
+                    # instead of comparing them as strings
+                    if not db:
+                        db = self.env.get_db_cnx()
+                    cursor = db.cursor()
+                    cursor.execute("SELECT name," + db.cast('value', 'int') + " FROM enum WHERE type=%s",
+                                  (sort_col,))
+                    for name, value in cursor:
+                        sortValues[name] = value
+
                 def sortkey(row):
                     val = row[idx]
+                    # check if we have sortValues, if we do - use them as sort keys.
+                    if sortValues:
+                        return sortValues.get(val)
+                    # otherwise, continue with string comparison:
                     if isinstance(val, basestring):
                         val = val.lower()
                     return val
