Index: 0.11/ticketmodifiedfiles/ticketmodifiedfiles.py
===================================================================
--- 0.11/ticketmodifiedfiles/ticketmodifiedfiles.py	(révision 12607)
+++ 0.11/ticketmodifiedfiles/ticketmodifiedfiles.py	(copie de travail)
@@ -114,85 +114,86 @@
         #Retrieve all the revisions which's messages contain "#<TICKETID>"
         cursor.execute("SELECT rev, time, author, message FROM revision WHERE message LIKE '%%#%s%%'" % id)
         repos = self.env.get_repository()
-        for rev, time, author, message, in cursor:
-            #Filter out non-related revisions.
-            #for instance, you are lookink for #19, so you don't want #190, #191, #192, etc. to interfere
-            #To filter, check what the eventual char after "#19" is.
-            #If it's a number, we dont' want it (validrevision = False), but if it's text, keep this revision
-            validrevision = True
-            tempstr = message.split("#" + str(id), 1)
-            if len(tempstr[1]) > 0:
-                try:
-                    int(tempstr[1][0])
-                    validrevision = False
-                except:
-                    pass
-                
-            if validrevision:
-                if not justnumconflictingtickets:
-                    date = "(" + format_time(time, str('%d/%m/%Y - %H:%M')) + ")"
-                    revisions.append((rev, author, date))
-                for node_change in repos.get_changeset(rev).get_changes():
-                    files.append(node_change[0])
-                    
+        if repos is not None
+           for rev, time, author, message, in cursor:
+               #Filter out non-related revisions.
+               #for instance, you are lookink for #19, so you don't want #190, #191, #192, etc. to interfere
+               #To filter, check what the eventual char after "#19" is.
+               #If it's a number, we dont' want it (validrevision = False), but if it's text, keep this revision
+               validrevision = True
+               tempstr = message.split("#" + str(id), 1)
+               if len(tempstr[1]) > 0:
+                   try:
+                       int(tempstr[1][0])
+                       validrevision = False
+                   except:
+                       pass
+                   
+               if validrevision:
+                   if not justnumconflictingtickets:
+                       date = "(" + format_time(time, str('%d/%m/%Y - %H:%M')) + ")"
+                       revisions.append((rev, author, date))
+                   for node_change in repos.get_changeset(rev).get_changes():
+                       files.append(node_change[0])
+                       
+           
+           #Remove duplicated values
+           files = self.__remove_duplicated_elements_and_sort(files)
+           
+           filestatus = {}
+           
+           for file in files:
+               #Get the last status of each file
+               if not justnumconflictingtickets:
+                   try:
+                       node = repos.get_node(file)
+                       filestatus[file] = node.get_history().next()[2]
+                   except:
+                       #If the node doesn't exist (in the last revision) it means that it has been deleted
+                       filestatus[file] = "delete"
+           
+               #Get the list of conflicting tickets per file
+               tempticketslist = []
+               cursor.execute("SELECT message FROM revision WHERE rev IN (SELECT rev FROM node_change WHERE path='%s')" % file)
+               for message, in cursor:
+                   #Extract the ticket number
+                   match = re.search(r'#([0-9]+)', message)
+                   if match:
+                       ticket = int(match.group(1))
+                       #Don't add yourself
+                       if ticket != id:
+                           tempticketslist.append(ticket)
+               tempticketslist = self.__remove_duplicated_elements_and_sort(tempticketslist)
+               
+               ticketsperfile[file] = []
+               #Keep only the active tickets
+               for ticket in tempticketslist:
+                   try:
+                       if Ticket(self.env, ticket)['status'] not in ignored_statuses:
+                           ticketsperfile[file].append(ticket)
+                   except:
+                       pass
+           
+           #Get the global list of conflicting tickets
+           #Only if the ticket is not already closed
+           conflictingtickets=[]
+           ticketsdescription={}
+           ticketsdescription[id] = thisticket['summary']
+           ticketisclosed = True
+           if thisticket['status'] not in ignored_statuses:
+               ticketisclosed = False
+               for fn, relticketids in ticketsperfile.items():
+                   for relticketid in relticketids:
+                       tick = Ticket(self.env, relticketid)
+                       conflictingtickets.append((relticketid, tick['status'], tick['owner']))
+                       ticketsdescription[relticketid] = tick['summary']
+       
+               #Remove duplicated values
+               conflictingtickets = self.__remove_duplicated_elements_and_sort(conflictingtickets)
+           
+           #Close the repository
+           repos.close()
         
-        #Remove duplicated values
-        files = self.__remove_duplicated_elements_and_sort(files)
-        
-        filestatus = {}
-        
-        for file in files:
-            #Get the last status of each file
-            if not justnumconflictingtickets:
-                try:
-                    node = repos.get_node(file)
-                    filestatus[file] = node.get_history().next()[2]
-                except:
-                    #If the node doesn't exist (in the last revision) it means that it has been deleted
-                    filestatus[file] = "delete"
-        
-            #Get the list of conflicting tickets per file
-            tempticketslist = []
-            cursor.execute("SELECT message FROM revision WHERE rev IN (SELECT rev FROM node_change WHERE path='%s')" % file)
-            for message, in cursor:
-                #Extract the ticket number
-                match = re.search(r'#([0-9]+)', message)
-                if match:
-                    ticket = int(match.group(1))
-                    #Don't add yourself
-                    if ticket != id:
-                        tempticketslist.append(ticket)
-            tempticketslist = self.__remove_duplicated_elements_and_sort(tempticketslist)
-            
-            ticketsperfile[file] = []
-            #Keep only the active tickets
-            for ticket in tempticketslist:
-                try:
-                    if Ticket(self.env, ticket)['status'] not in ignored_statuses:
-                        ticketsperfile[file].append(ticket)
-                except:
-                    pass
-        
-        #Get the global list of conflicting tickets
-        #Only if the ticket is not already closed
-        conflictingtickets=[]
-        ticketsdescription={}
-        ticketsdescription[id] = thisticket['summary']
-        ticketisclosed = True
-        if thisticket['status'] not in ignored_statuses:
-            ticketisclosed = False
-            for fn, relticketids in ticketsperfile.items():
-                for relticketid in relticketids:
-                    tick = Ticket(self.env, relticketid)
-                    conflictingtickets.append((relticketid, tick['status'], tick['owner']))
-                    ticketsdescription[relticketid] = tick['summary']
-    
-            #Remove duplicated values
-            conflictingtickets = self.__remove_duplicated_elements_and_sort(conflictingtickets)
-        
-        #Close the repository
-        repos.close()
-        
         #Return only the number of conflicting tickets (if asked for)
         if justnumconflictingtickets:
             return len(conflictingtickets)
