def insert(self, entry):
"""Insert an entry. Automatic generate **uuid1** as entry's ID.
Args:
``entry`` (dict): Entry to be inserted.
Return:
``string``: Entry's UUID.
"""
# Must generate uuid1 here, since id_=str(uuid.uuid1()) in def args
# will return the same value all the times after first call.
id_ = str(uuid.uuid1())
if isinstance(entry, dict):
self._shelf[id_] = entry
return id_
else:
raise Exception('Entry is not a dict object')
评论列表
文章目录