mirror of
https://github.com/GNS3/gns3-server.git
synced 2026-11-03 05:51:15 +02:00
Some cleaning.
This commit is contained in:
1 parent
bad3ef7003
commit
44074ff7c9
22 files changed
+122
-99
No files matched your search
@@ -36,10 +36,6 @@ import logging
|
||||
log = logging.getLogger(__name__)
|
||||
|
||||
|
||||
# The string use to extract the date from the filename
|
||||
FILENAME_TIME_FORMAT = "%d%m%y_%H%M%S"
|
||||
|
||||
|
||||
class Snapshot:
|
||||
"""
|
||||
A snapshot object
|
||||
@@ -59,7 +55,7 @@ class Snapshot:
|
||||
filename = (
|
||||
self._name
|
||||
+ "_"
|
||||
+ datetime.utcfromtimestamp(self._created_at).replace(tzinfo=None).strftime(FILENAME_TIME_FORMAT)
|
||||
+ datetime.utcfromtimestamp(self._created_at).replace(tzinfo=None).strftime("%d%m%y_%H%M%S")
|
||||
+ ".gns3project"
|
||||
)
|
||||
else:
|
||||
@@ -67,7 +63,7 @@ class Snapshot:
|
||||
datestring = filename.replace(self._name + "_", "").split(".")[0]
|
||||
try:
|
||||
self._created_at = (
|
||||
datetime.strptime(datestring, FILENAME_TIME_FORMAT).replace(tzinfo=timezone.utc).timestamp()
|
||||
datetime.strptime(datestring, "%d%m%y_%H%M%S").replace(tzinfo=timezone.utc).timestamp()
|
||||
)
|
||||
except ValueError:
|
||||
self._created_at = datetime.utcnow().timestamp()
|
||||
|
||||
Reference in new issue
Block a user