diff --git a/PyTracker/trunk/PyTrackerServer.py b/PyTracker/trunk/PyTrackerServer.py index 589b29d..5ceb356 100644 --- a/PyTracker/trunk/PyTrackerServer.py +++ b/PyTracker/trunk/PyTrackerServer.py @@ -63,15 +63,19 @@ class TrackServer: print "Something went wrong.." def NewTrack(self, username): - if not self.TrackDict[username]: - self.TrackDict[username] = WriteGPX("%s%s%s" % (self.datadir, username, time.strftime("%Y%m%d%H%M%S")) - print "Created track", self.TrackDict[username] +# if a track has already started it needs to be closed (finished) + if self.TrackDict[username]: + self.TrackDict[username].close() +# start the new track + self.TrackDict[username] = WriteGPX("%s%s%s" % (self.datadir, username, time.strftime("%Y%m%d%H%M%S")) + print "Created track", self.TrackDict[username] def CloseTrack(self, username): if self.TrackDict[username]: self.TrackDict[username].close() print "Closed track", self.TrackDict[username] - del self.TrackDict[username] + else: + print "ha, no track for %s exists!" % (username) def AddToTrack(self, username, data): lat, lon, ele, time = data.split(',') diff --git a/PyTracker/trunk/WriteGPX.py b/PyTracker/trunk/WriteGPX.py index c87a709..5f5e4de 100644 --- a/PyTracker/trunk/WriteGPX.py +++ b/PyTracker/trunk/WriteGPX.py @@ -12,11 +12,6 @@ The file musst be closed, otherwise the file will be incomplete ''' from __future__ import with_statement -<<<<<<< .mine -======= -from __future__ import with_statement - ->>>>>>> .r158 class WriteGPX: def __init__(self, filename): self.filename = filename