Skip to content

Commit e3ad9bd

Browse files
committed
feat: Store Logs uuid
1 parent ab3f3f1 commit e3ad9bd

File tree

2 files changed

+18
-7
lines changed

2 files changed

+18
-7
lines changed

pycaching/cache.py

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1041,12 +1041,13 @@ def load_logbook(self, limit=float("inf")):
10411041
img_filename = log_data["LogTypeImage"].rsplit(".", 1)[0] # filename w/o extension
10421042

10431043
# create and fill log object
1044-
log = Log()
1045-
log.type = LogType.from_filename(img_filename)
1046-
log.text = log_data["LogText"]
1047-
log.visited = log_data["Visited"]
1048-
log.author = log_data["UserName"]
1049-
yield log
1044+
yield Log(
1045+
uuid=log_data['LogGuid'],
1046+
type=LogType.from_filename(img_filename),
1047+
text=log_data["LogText"],
1048+
visited=log_data["Visited"],
1049+
author=log_data["UserName"]
1050+
)
10501051

10511052
# TODO: trackable list can have multiple pages - handle it in similar way as _logbook_get_page
10521053
# for example see: http://www.geocaching.com/geocache/GC26737_geocaching-jinak-tb-gc-hrbitov

pycaching/log.py

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,9 @@
1212
class Log(object):
1313
"""Represents a log record with its properties."""
1414

15-
def __init__(self, *, type=None, text=None, visited=None, author=None):
15+
def __init__(self, *, uuid=None, type=None, text=None, visited=None, author=None):
16+
if uuid is not None:
17+
self.uuid = uuid
1618
if type is not None:
1719
self.type = type
1820
if text is not None:
@@ -26,6 +28,14 @@ def __str__(self):
2628
"""Return log text."""
2729
return self.text
2830

31+
@property
32+
def uuid(self):
33+
return self._uuid
34+
35+
@uuid.setter
36+
def uuid(self, uuid):
37+
self._uuid = uuid
38+
2939
@property
3040
def type(self):
3141
"""The log type.

0 commit comments

Comments
 (0)