two bugs fixed

git-svn-id: http://www.neo1973-germany.de/svn@160 46df4e5c-bc4e-4628-a0fc-830ba316316d
This commit is contained in:
edistar 2008-09-17 21:00:27 +00:00
parent 946badb6b8
commit 4792e251c5
2 changed files with 8 additions and 9 deletions

View file

@ -63,15 +63,19 @@ class TrackServer:
print "Something went wrong.." print "Something went wrong.."
def NewTrack(self, username): def NewTrack(self, username):
if not self.TrackDict[username]: # if a track has already started it needs to be closed (finished)
self.TrackDict[username] = WriteGPX("%s%s%s" % (self.datadir, username, time.strftime("%Y%m%d%H%M%S")) if self.TrackDict[username]:
print "Created track", 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): def CloseTrack(self, username):
if self.TrackDict[username]: if self.TrackDict[username]:
self.TrackDict[username].close() self.TrackDict[username].close()
print "Closed track", self.TrackDict[username] print "Closed track", self.TrackDict[username]
del self.TrackDict[username] else:
print "ha, no track for %s exists!" % (username)
def AddToTrack(self, username, data): def AddToTrack(self, username, data):
lat, lon, ele, time = data.split(',') lat, lon, ele, time = data.split(',')

View file

@ -12,11 +12,6 @@ The file musst be closed, otherwise the file will be incomplete
''' '''
from __future__ import with_statement from __future__ import with_statement
<<<<<<< .mine
=======
from __future__ import with_statement
>>>>>>> .r158
class WriteGPX: class WriteGPX:
def __init__(self, filename): def __init__(self, filename):
self.filename = filename self.filename = filename