def create_shelf(self, shelf):
""" Create one new shelf in the database.
Input---
shelf_data - list of shelf data to insert
Output---
shelf_data or error message
"""
shelf.id = None # DB engine will autochoose next id
if not shelf.mode:
shelf.mode = stat.S_IFREG + 0o666
tmp = int(time.time())
shelf.ctime = shelf.mtime = tmp
if shelf.parent_id == 0:
shelf.parent_id = 2 # is now a default for if it given to go in root
shelf.id = self._cur.INSERT('shelves', shelf.tuple())
return shelf
评论列表
文章目录