Remove accidental dependency
parent
760c43f6d7
commit
634da60f18
|
@ -24,12 +24,9 @@
|
||||||
# Updated to add new fields and functions (kick, muzzle)
|
# Updated to add new fields and functions (kick, muzzle)
|
||||||
# and rewritten to use plain text file storage (CFDataFile) instead of shelve.
|
# and rewritten to use plain text file storage (CFDataFile) instead of shelve.
|
||||||
|
|
||||||
|
from time import localtime, strftime, strptime, time
|
||||||
|
|
||||||
import Crossfire
|
import Crossfire
|
||||||
|
|
||||||
from dateutil import parser
|
|
||||||
from time import localtime, strftime, time
|
|
||||||
|
|
||||||
from CFDataFile import CFDataFile, CFData
|
from CFDataFile import CFDataFile, CFData
|
||||||
|
|
||||||
TimeFormat = "%a, %d %b %Y %H:%M:%S %Z"
|
TimeFormat = "%a, %d %b %Y %H:%M:%S %Z"
|
||||||
|
@ -68,8 +65,20 @@ class CFLog:
|
||||||
def last_login(self, name):
|
def last_login(self, name):
|
||||||
record = self.info(name)
|
record = self.info(name)
|
||||||
try:
|
try:
|
||||||
return parser.parse(record['Last_Login_Date'])
|
r = record['Last_Login_Date']
|
||||||
except:
|
return strptime(r, TimeFormat)
|
||||||
|
except ValueError:
|
||||||
|
# If the server time zone changes, then %Z will no longer parse.
|
||||||
|
# Remove the time zone and try again.
|
||||||
|
BackupTimeFormat = "%a, %d %b %Y %H:%M:%S"
|
||||||
|
try:
|
||||||
|
time_no_tz = " ".join(r.split(" ")[:-1])
|
||||||
|
return strptime(time_no_tz, BackupTimeFormat)
|
||||||
|
except Exception as e:
|
||||||
|
Crossfire.Log(Crossfire.LogDebug, "CFLog: Failed to parse time: " + str(e))
|
||||||
|
return None
|
||||||
|
except Exception as e:
|
||||||
|
Crossfire.Log(Crossfire.LogDebug, "CFLog: Failed to parse time: " + str(e))
|
||||||
return None
|
return None
|
||||||
|
|
||||||
def kick_update(self, name):
|
def kick_update(self, name):
|
||||||
|
|
Loading…
Reference in New Issue