Index: src/sas/sasgui/perspectives/fitting/basepage.py
===================================================================
--- src/sas/sasgui/perspectives/fitting/basepage.py	(revision a1b8fee73528559155793dd74cda07d0c32e9d72)
+++ src/sas/sasgui/perspectives/fitting/basepage.py	(revision 78312f78ace85630125cafc0f9f54ed8d905db13)
@@ -6,6 +6,4 @@
 import sys
 import os
-import wx
-import numpy as np
 import time
 import copy
@@ -14,9 +12,15 @@
 import logging
 import traceback
-
 from collections import defaultdict
+
+import numpy as np
+
+import wx
 from wx.lib.scrolledpanel import ScrolledPanel
 
 from sasmodels.weights import MODELS as POLYDISPERSITY_MODELS
+
+from sas.sascalc.dataloader.data_info import Detector
+from sas.sascalc.dataloader.data_info import Source
 
 from sas.sasgui.guiframe.panel_base import PanelBase
@@ -30,9 +34,9 @@
 from sas.sasgui.guiframe.dataFitting import check_data_validity
 from sas.sasgui.guiframe.gui_style import GUIFRAME_ID
-from sas.sascalc.dataloader.data_info import Detector
-from sas.sascalc.dataloader.data_info import Source
-from sas.sasgui.perspectives.fitting.pagestate import PageState
 from sas.sasgui.guiframe.CategoryInstaller import CategoryInstaller
 from sas.sasgui.guiframe.documentation_window import DocumentationWindow
+
+from sas.sasgui.perspectives.fitting.pagestate import PageState
+from sas.sasgui.perspectives.fitting.report_dialog import ReportDialog
 
 logger = logging.getLogger(__name__)
@@ -619,6 +623,50 @@
         # Get plot image from plotpanel
         images, canvases = self.get_images()
-        # get the report dialog
-        self.state.report(images, canvases)
+        imgRAM, images, refs = self._build_plots_for_report(images, canvases)
+
+        # get the strings for report
+        report_str, text_str = self.state.report(fig_urls=refs)
+
+        # Show the dialog
+        report_list = [report_str, text_str, images]
+        dialog = ReportDialog(report_list, None, wx.ID_ANY, "")
+        dialog.Show()
+
+    def _build_plots_for_report(self, figs, canvases):
+        """
+        Build image state that wx.html understand
+        by plotting, putting it into wx.FileSystem image object
+        """
+        images = []
+        refs = []
+
+        # For no figures in the list, prepare empty plot
+        if figs is None or len(figs) == 0:
+            figs = [None]
+
+        # Loop over the list of figures
+        # use wx.MemoryFSHandler
+        imgRAM = wx.MemoryFSHandler()
+        for fig in figs:
+            if fig is not None:
+                ind = figs.index(fig)
+                canvas = canvases[ind]
+
+            # store the image in wx.FileSystem Object
+            wx.FileSystem.AddHandler(wx.MemoryFSHandler())
+
+            # index of the fig
+            ind = figs.index(fig)
+
+            # AddFile, image can be retrieved with 'memory:filename'
+            name = 'img_fit%s.png' % ind
+            refs.append('memory:' + name)
+            imgRAM.AddFile(name, canvas.bitmap, wx.BITMAP_TYPE_PNG)
+
+            # append figs
+            images.append(fig)
+
+        return imgRAM, images, refs
+
 
     def on_save(self, event):
Index: src/sas/sasgui/perspectives/fitting/pagestate.py
===================================================================
--- src/sas/sasgui/perspectives/fitting/pagestate.py	(revision 959eb0181ad06828a748f04512f953aad5b31659)
+++ src/sas/sasgui/perspectives/fitting/pagestate.py	(revision 78312f78ace85630125cafc0f9f54ed8d905db13)
@@ -15,5 +15,4 @@
 import os
 import sys
-import wx
 import copy
 import logging
@@ -519,5 +518,5 @@
         rep = "\nState name: %s\n" % self.file
         t = time.localtime(self.timestamp)
-        time_str = time.strftime("%b %d %Y %H;%M;%S ", t)
+        time_str = time.strftime("%b %d %Y %H:%M:%S ", t)
 
         rep += "State created: %s\n" % time_str
@@ -596,5 +595,5 @@
         return rep
 
-    def set_report_string(self):
+    def _get_report_string(self):
         """
         Get the values (strings) from __str__ for report
@@ -611,19 +610,19 @@
         q_range = ""
         strings = self.__repr__()
+        fixed_parameter = False
         lines = strings.split('\n')
-
         # get all string values from __str__()
         for line in lines:
-            value = ""
-            content = line.split(":")
-            name = content[0]
-            try:
-                value = content[1]
-            except Exception:
-                msg = "Report string expected 'name: value' but got %r" % line
-                logger.error(msg)
-            if name.count("State created"):
-                repo_time = "" + value
-            if name.count("parameter name"):
+            # Skip lines which are not key: value pairs, which includes
+            # blank lines and freeform notes in SASNotes fields.
+            if not ':' in line:
+                #msg = "Report string expected 'name: value' but got %r" % line
+                #logger.error(msg)
+                continue
+
+            name, value = [s.strip() for s in line.split(":", 1)]
+            if name == "State created":
+                repo_time = value
+            elif name == "parameter name":
                 val_name = value.split(".")
                 if len(val_name) > 1:
@@ -634,46 +633,48 @@
                 else:
                     param_string += value + ','
-            if name == "value":
+            elif name == "value":
                 param_string += value + ','
-            fixed_parameter = False
-            if name == "selected":
-                if value == u' False':
-                    fixed_parameter = True
-            if name == "error value":
+            elif name == "selected":
+                # remember if it is fixed when reporting error value
+                fixed_parameter = (value == u'False')
+            elif name == "error value":
                 if fixed_parameter:
                     param_string += '(fixed),'
                 else:
                     param_string += value + ','
-            if name == "parameter unit":
+            elif name == "parameter unit":
                 param_string += value + ':'
-            if name == "Value of Chisqr ":
+            elif name == "Value of Chisqr":
                 chi2 = ("Chi2/Npts = " + value)
                 chi2_string = CENTRE % chi2
-            if name == "Title":
+            elif name == "Title":
                 if len(value.strip()) == 0:
                     continue
                 title = value + " [" + repo_time + "]"
                 title_name = HEADER % title
-            if name == "data ":
+            elif name == "data":
                 try:
-                    file_value = ("File name:" + content[2])
+                    # parsing "data : File:     filename [mmm dd hh:mm]"
+                    name = value.split(':', 1)[1].strip()
+                    file_value = "File name:" + name
                     file_name = CENTRE % file_value
                     if len(title) == 0:
-                        title = content[2] + " [" + repo_time + "]"
+                        title = name + " [" + repo_time + "]"
                         title_name = HEADER % title
                 except Exception:
                     msg = "While parsing 'data: ...'\n"
                     logger.error(msg + traceback.format_exc())
-            if name == "model name ":
+            elif name == "model name":
                 try:
-                    modelname = "Model name:" + content[1]
-                except:
+                    modelname = "Model name:" + value
+                except Exception:
                     modelname = "Model name:" + " NAN"
                 model_name = CENTRE % modelname
 
-            if name == "Plotting Range":
+            elif name == "Plotting Range":
                 try:
-                    q_range = content[1] + " = " + content[2] \
-                            + " = " + content[3].split(",")[0]
+                    parts = value.split(':')
+                    q_range = parts[0] + " = " + parts[1] \
+                            + " = " + parts[2].split(",")[0]
                     q_name = ("Q Range:    " + q_range)
                     q_range = CENTRE % q_name
@@ -681,4 +682,5 @@
                     msg = "While parsing 'Plotting Range: ...'\n"
                     logger.error(msg + traceback.format_exc())
+
         paramval = ""
         for lines in param_string.split(":"):
@@ -709,6 +711,5 @@
                                    "\n" + paramval_string + \
                                    "\n" + ELINE + \
-                                   "\n" + FEET_1 % title + \
-                                   "\n" + FEET_2
+                                   "\n" + FEET_1 % title
 
         return html_string, text_string, title
@@ -723,5 +724,5 @@
         return name
 
-    def report(self, figs=None, canvases=None):
+    def report(self, fig_urls):
         """
         Invoke report dialog panel
@@ -729,33 +730,13 @@
         : param figs: list of pylab figures [list]
         """
-        from sas.sasgui.perspectives.fitting.report_dialog import ReportDialog
         # get the strings for report
-        html_str, text_str, title = self.set_report_string()
+        html_str, text_str, title = self._get_report_string()
         # Allow 2 figures to append
-        if len(figs) == 1:
-            add_str = FEET_3
-        elif len(figs) == 2:
-            add_str = ELINE
-            add_str += FEET_2 % ("%s")
-            add_str += ELINE
-            add_str += FEET_3
-        elif len(figs) > 2:
-            add_str = ELINE
-            add_str += FEET_2 % ("%s")
-            add_str += ELINE
-            add_str += FEET_2 % ("%s")
-            add_str += ELINE
-            add_str += FEET_3
-        else:
-            add_str = ""
+        image_links = [FEET_2%fig for fig in fig_urls]
 
         # final report html strings
-        report_str = html_str % ("%s") + add_str
-
-        # make plot image
-        images = self.set_plot_state(figs, canvases)
-        report_list = [report_str, text_str, images]
-        dialog = ReportDialog(report_list, None, wx.ID_ANY, "")
-        dialog.Show()
+        report_str = html_str + ELINE.join(image_links)
+
+        return report_str, text_str
 
     def _to_xml_helper(self, thelist, element, newdoc):
@@ -805,5 +786,5 @@
             try:
                 top_element = newdoc.createElement(FITTING_NODE_NAME)
-            except:
+            except Exception:
                 string = etree.tostring(doc, pretty_print=True)
                 newdoc = parseString(string)
@@ -814,5 +795,5 @@
                 try:
                     entry_node.appendChild(top_element)
-                except:
+                except Exception:
                     node_name = entry_node.tag
                     node_list = newdoc.getElementsByTagName(node_name)
@@ -1036,5 +1017,5 @@
                 try:
                     self.timestamp = float(entry.get('epoch'))
-                except:
+                except Exception:
                     msg = "PageState.fromXML: Could not"
                     msg += " read timestamp\n %s" % sys.exc_value
@@ -1104,43 +1085,4 @@
                         dic[name] = np.array(value_list)
                     setattr(self, varname, dic)
-
-    def set_plot_state(self, figs, canvases):
-        """
-        Build image state that wx.html understand
-        by plotting, putting it into wx.FileSystem image object
-
-        """
-        images = []
-
-        # Reset memory
-        self.imgRAM = None
-        wx.MemoryFSHandler()
-
-        # For no figures in the list, prepare empty plot
-        if figs is None or len(figs) == 0:
-            figs = [None]
-
-        # Loop over the list of figures
-        # use wx.MemoryFSHandler
-        self.imgRAM = wx.MemoryFSHandler()
-        for fig in figs:
-            if fig is not None:
-                ind = figs.index(fig)
-                canvas = canvases[ind]
-
-            # store the image in wx.FileSystem Object
-            wx.FileSystem.AddHandler(wx.MemoryFSHandler())
-
-            # index of the fig
-            ind = figs.index(fig)
-
-            # AddFile, image can be retrieved with 'memory:filename'
-            self.imgRAM.AddFile('img_fit%s.png' % ind,
-                                canvas.bitmap, wx.BITMAP_TYPE_PNG)
-
-            # append figs
-            images.append(fig)
-
-        return images
 
 
@@ -1410,5 +1352,5 @@
         return doc
 
-# Simple html report templet
+# Simple html report template
 HEADER = "<html>\n"
 HEADER += "<head>\n"
@@ -1438,14 +1380,12 @@
 """
 FEET_2 = \
-"""
-<img src="%s" >
-</img>
+"""<img src="%s" ></img>
 """
 FEET_3 = \
-"""
-</center>
+"""</center>
 </div>
 </body>
 </html>
 """
-ELINE = "<p class=MsoNormal>&nbsp;</p>"
+ELINE = """<p class=MsoNormal>&nbsp;</p>
+"""
Index: src/sas/sasgui/perspectives/fitting/report_dialog.py
===================================================================
--- src/sas/sasgui/perspectives/fitting/report_dialog.py	(revision 7432acb919f4013119ca918a73350297e0d4c93f)
+++ src/sas/sasgui/perspectives/fitting/report_dialog.py	(revision 78312f78ace85630125cafc0f9f54ed8d905db13)
@@ -38,22 +38,5 @@
         # number of images of plot
         self.nimages = len(self.report_list[2])
-
-        if self.report_list[2] is not None:
-            # put image path in the report string
-            if len(self.report_list[2]) == 1:
-                self.report_html = self.report_list[0] % \
-                                    "memory:img_fit0.png"
-            elif len(self.report_list[2]) == 2:
-                self.report_html = self.report_list[0] % \
-                                    ("memory:img_fit0.png",
-                                     "memory:img_fit1.png")
-            # allows up to three images
-            else:
-                self.report_html = self.report_list[0] % \
-                                    ("memory:img_fit0.png",
-                                     "memory:img_fit1.png",
-                                     "memory:img_fit2.png")
-        else:
-            self.report_html = self.report_list[0]
+        self.report_html = self.report_list[0]
         # layout
         self._setup_layout()
@@ -105,5 +88,5 @@
             elif self.nimages == 3:
                 html = report_frame % (str(pic_fname[0]), str(pic_fname[1]),
-                                          str(pic_fname[2]))
+                                       str(pic_fname[2]))
 
             # make/open file in case of absence
@@ -118,9 +101,9 @@
                     #Windows
                     os.startfile(str(fName))
-                except:
+                except Exception:
                     try:
                         #Mac
                         os.system("open %s" % fName)
-                    except:
+                    except Exception:
                         #DO not open
                         pass
