diff --git a/api/ECNQueue.py b/api/ECNQueue.py index 2d44844..6ee4122 100644 --- a/api/ECNQueue.py +++ b/api/ECNQueue.py @@ -87,12 +87,12 @@ class Item: Example: # Create an Item (ce100) - >>> item = Item("ce", 100, True) + >>> item = Item("ce", 100, headersOnly=false) Attributes: lastUpdated: An ISO 8601 formatted time string showing the last time the file was updated according to the filesystem. headers: A list of dictionaries containing header keys and values. - content: A list of section dictionaries (only included if wholeItem is True). + content: A list of section dictionaries (only included if headersOnly is False). isLocked: A boolean showing whether or not a lockfile for the item is present. userEmail: The email address of the person who this item is from. userName: The real name of the person who this item is from. @@ -106,7 +106,7 @@ class Item: jsonData: A JSON serializable representation of the Item. """ - def __init__(self, queue: str, number: int, wholeItem: bool) -> None: + def __init__(self, queue: str, number: int, headersOnly: bool = False) -> None: self.queue = queue try: @@ -119,7 +119,7 @@ def __init__(self, queue: str, number: int, wholeItem: bool) -> None: self.lastUpdated = self.__getLastUpdated() self.__rawItem = self.__getRawItem() self.headers = self.__parseHeaders() - if wholeItem: self.content = self.__parseSections() + if not headersOnly: self.content = self.__parseSections() self.isLocked = self.__isLocked() self.userEmail = self.__parseFromData(data="userEmail") self.userName = self.__parseFromData(data="userName") @@ -1209,8 +1209,9 @@ class Queue: jsonData: A JSON serializable representation of the Queue. """ - def __init__(self, name: str) -> None: + def __init__(self, name: str, headersOnly: bool = True) -> None: self.name = name + self.headersOnly = headersOnly self.__directory = queueDirectory + "/" + self.name + "/" self.items = self.__getItems() @@ -1233,7 +1234,7 @@ def __getItems(self) -> list: isFile = True if os.path.isfile(itemPath) else False if isFile and isValidItemName(item): - items.append(Item(self.name, item, False)) + items.append(Item(self.name, item, headersOnly=self.headersOnly)) return items @@ -1306,7 +1307,7 @@ def getQueueCounts() -> list: return queueInfo -def loadQueues() -> list: +def loadAllQueues(headersOnly: bool = True) -> list: """Return a list of Queues for each queue. Returns: @@ -1315,9 +1316,6 @@ def loadQueues() -> list: queues = [] for queue in getValidQueues(): - queues.append(Queue(queue)) + queues.append(Queue(queue, headersOnly=headersOnly)) - return queues -if __name__ == "__main__": - item = Item("ce", 100, False) - print() \ No newline at end of file + return queues \ No newline at end of file