diff --git a/trac/ticket/model.py b/trac/ticket/model.py
--- a/trac/ticket/model.py
+++ b/trac/ticket/model.py
@@ -45,7 +45,7 @@
     # 0.11 compatibility
     time_created = property(lambda self: self.values.get('time'))
     time_changed = property(lambda self: self.values.get('changetime'))
-    
+
     def __init__(self, env, tkt_id=None, db=None, version=None):
         self.env = env
         if tkt_id is not None:
@@ -164,7 +164,7 @@
                 return field[0].get('value', '')
         except KeyError:
             pass
-        
+
     def populate(self, values):
         """Populate the ticket with 'suitable' values from a dictionary"""
         field_names = [f['name'] for f in self.fields]
@@ -179,7 +179,7 @@
 
     def insert(self, when=None, db=None):
         """Add ticket to database.
-        
+
         The `db` argument is deprecated in favor of `with_transaction()`.
         """
         assert not self.exists, 'Cannot insert an existing ticket'
@@ -214,7 +214,7 @@
         for field in self.time_fields:
             if field in values:
                 values[field] = to_utimestamp(values[field])
-        
+
         # Insert ticket record
         tkt_id = [None]
         @self.env.with_transaction(db)
@@ -246,7 +246,7 @@
         Store ticket changes in the database. The ticket must already exist in
         the database.  Returns False if there were no changes to save, True
         otherwise.
-        
+
         The `db` argument is deprecated in favor of `with_transaction()`.
         """
         assert self.exists, 'Cannot update a new ticket'
@@ -337,7 +337,7 @@
                     VALUES (%s, %s, %s, %s, %s, %s)
                     """, (self.id, when_ts, author, name, self._old[name],
                           self[name]))
-            
+
             # always save comment, even if empty 
             # (numbering support for timeline)
             cursor.execute("""
@@ -345,7 +345,7 @@
                     (ticket,time,author,field,oldvalue,newvalue)
                 VALUES (%s,%s,%s,'comment',%s,%s)
                 """, (self.id, when_ts, author, comment_num, comment))
-    
+
             cursor.execute("UPDATE ticket SET changetime=%s WHERE id=%s",
                            (when_ts, self.id))
 
@@ -384,7 +384,7 @@
         else:
             cursor.execute("""
                 SELECT time,author,field,oldvalue,newvalue, 1 AS permanent
-                FROM ticket_change WHERE ticket=%s
+                FROM ticket_change WHERE ticket=%s 
                   UNION 
                 SELECT time,author,'attachment',null,filename, 0 AS permanent
                 FROM attachment WHERE id=%s 
@@ -401,7 +401,7 @@
 
     def delete(self, db=None):
         """Delete the ticket.
-        
+
         The `db` argument is deprecated in favor of `with_transaction()`.
         """
         @self.env.with_transaction(db)
@@ -444,7 +444,7 @@
             if not row:
                 return
             ts = row[0]
-            
+
             # Find modified fields and their previous value
             cursor.execute("""
                 SELECT field, oldvalue, newvalue FROM ticket_change
@@ -479,12 +479,12 @@
                         cursor.execute("""
                             UPDATE ticket SET %s=%%s WHERE id=%%s
                             """ % field, (oldvalue, self.id))
-            
+
             # Delete the change
             cursor.execute("""
                 DELETE FROM ticket_change WHERE ticket=%s AND time=%s
                 """, (self.id, ts))
-            
+
             # Fix the last modification time
             cursor.execute("""
                 UPDATE ticket SET changetime=(
@@ -492,7 +492,7 @@
                     ORDER BY time DESC LIMIT 1)
                 WHERE id=%s
                 """, (self.id, self.id))
-        
+
         self._fetch_ticket(self.id)
 
     def modify_comment(self, cdate, author, comment, when=None):
@@ -517,7 +517,7 @@
                 break
             if comment == (old_comment or ''):
                 return
-        
+
             # Comment history is stored in fields named "_comment%d"
             # Find the next edit number
             cursor.execute("""
@@ -594,7 +594,7 @@
                               '%' + db.like_escape('.' + scnum)))
         for row in cursor:
             return row
-        
+
         # Fallback when comment number is not available in oldvalue
         num = 0
         cursor.execute("""
@@ -619,7 +619,7 @@
                 break
         else:
             return
-        
+
         # Find author if NULL
         if author is None:
             cursor.execute("""
@@ -631,7 +631,6 @@
                 break
         return (ts, author, comment)
 
-
 def simplify_whitespace(name):
     """Strip spaces and remove duplicate spaces within names"""
     if name:
@@ -668,7 +667,7 @@
 
     def delete(self, db=None):
         """Delete the enum value.
-        
+
         The `db` argument is deprecated in favor of `with_transaction()`.
         """
         assert self.exists, 'Cannot delete non-existent %s' % self.type
@@ -694,7 +693,7 @@
 
     def insert(self, db=None):
         """Add a new enum value.
-        
+
         The `db` argument is deprecated in favor of `with_transaction()`.
         """
         assert not self.exists, 'Cannot insert existing %s' % self.type
@@ -721,7 +720,7 @@
 
     def update(self, db=None):
         """Update the enum value.
-        
+
         The `db` argument is deprecated in favor of `with_transaction()`.
         """
         assert self.exists, 'Cannot update non-existent %s' % self.type
@@ -793,7 +792,6 @@
 
 
 class Component(object):
-
     def __init__(self, env, name=None, db=None):
         self.env = env
         name = simplify_whitespace(name)
@@ -820,7 +818,7 @@
 
     def delete(self, db=None):
         """Delete the component.
-        
+
         The `db` argument is deprecated in favor of `with_transaction()`.
         """
         assert self.exists, 'Cannot delete non-existent component'
@@ -835,7 +833,7 @@
 
     def insert(self, db=None):
         """Insert a new component.
-        
+
         The `db` argument is deprecated in favor of `with_transaction()`.
         """
         assert not self.exists, 'Cannot insert existing component'
@@ -856,7 +854,7 @@
 
     def update(self, db=None):
         """Update the component.
-        
+
         The `db` argument is deprecated in favor of `with_transaction()`.
         """
         assert self.exists, 'Cannot update non-existent component'
@@ -897,7 +895,6 @@
 
 
 class Milestone(object):
-
     def __init__(self, env, name=None, db=None):
         self.env = env
         name = simplify_whitespace(name)
@@ -947,7 +944,7 @@
 
     def delete(self, retarget_to=None, author=None, db=None):
         """Delete the milestone.
-        
+
         The `db` argument is deprecated in favor of `with_transaction()`.
         """
         @self.env.with_transaction(db)
@@ -974,7 +971,7 @@
 
     def insert(self, db=None):
         """Insert a new milestone.
-        
+
         The `db` argument is deprecated in favor of `with_transaction()`.
         """
         self.name = simplify_whitespace(self.name)
@@ -998,7 +995,7 @@
 
     def update(self, db=None):
         """Update the milestone.
-        
+
         The `db` argument is deprecated in favor of `with_transaction()`.
         """
         self.name = simplify_whitespace(self.name)
@@ -1066,7 +1063,6 @@
 
 
 class Version(object):
-
     def __init__(self, env, name=None, db=None):
         self.env = env
         name = simplify_whitespace(name)
@@ -1093,7 +1089,7 @@
 
     def delete(self, db=None):
         """Delete the version.
-        
+
         The `db` argument is deprecated in favor of `with_transaction()`.
         """
         assert self.exists, 'Cannot delete non-existent version'
@@ -1108,7 +1104,7 @@
 
     def insert(self, db=None):
         """Insert a new version.
-        
+
         The `db` argument is deprecated in favor of `with_transaction()`.
         """
         assert not self.exists, 'Cannot insert existing version'
@@ -1128,7 +1124,7 @@
 
     def update(self, db=None):
         """Update the version.
-        
+
         The `db` argument is deprecated in favor of `with_transaction()`.
         """
         assert self.exists, 'Cannot update non-existent version'

