Database Query Contains Old Data

giraffeboy at gmail.com giraffeboy at gmail.com
Wed May 21 06:30:04 EDT 2008


Hi there,

I'm having a problem with the Python db api, using MySQL.

I've written a program with a GUI using wxPython, the GUI is contained
in main.py which imports another module - reports.py. There are
several reports that are selected using the gui, and each report is a
class in the file reports.py. These classes contain a method which is
passed data as arguments and produces a report, writing HTML to a file
and using matplotlib to create a graph file.

The report class methods are called from the GUI using the following
code:
        agentlist = self.getselected()
        detail = self.cb1.GetValue()
        if self.getdates() != False:
            fromdate, todate = self.getdates()
            app.mainframe.SetStatusText("Generating Report...")
            if self.reportchoice.GetSelection() == 0:
                thereport = reports.VehicleRunningCost()
                thereport.producereport(agentlist, fromdate=fromdate,
todate=todate, detail=detail)
            app.mainframe.SetStatusText("Report Complete")
            viewerframe = ViewerFrame(None, -1, "Mileage and Fuel
Report Viewer")
            viewerframe.Show(True)

The first time you run a report, everything works as expected but if
you run it a second time, after modifying data, it seems that the data
from before the modification is selected on the second report run.

It would be much appreciated if anyone could give me any hints as to
why the old data is selected. I haven't posted the full code because
it's quite long but will post more if anyone wants to see specific
parts.

Thanks!
Andrew



More information about the Python-list mailing list