def getOverrides(self, DBReq: DBRequest) -> None: self.overwrite_container = DBReq.get("overwrite_container", None) if type(self.overwrite_container) is not bool: self.overwrite_container = bool(self.overwrite_container) self.overwrite_entrys = DBReq.get("overwrite_entrys", None) if type(self.overwrite_entrys) is not bool: self.overwrite_entrys = bool(self.overwrite_entrys)
def getOffset(self, DBReq: DBRequest) -> None: self.offset = DBReq.get("offset", -1) if type(self.offset) is str: if self.offset.isdigit(): self.offset = int(self.offset) if type(self.offset) is not int: self.offset = -1
def getContainter(self, DBReq:DBRequest) -> None: self.container = DBReq.get("container", "") if type(self.container) is not str: self.container = str(self.container) self.container = self.container.replace('..', '') self.container = self.container.strip('/') if not self.container: self.container = ""
def getUpdate(self, DBReq: DBRequest) -> None: self.content = DBReq.get("content", None) if type(self.content) is dict: self.method = "dict" elif type(self.content) is str: self.method = "str" else: raise MissingUpdateContent()
def getContainter(self, DBReq: DBRequest) -> None: self.container = DBReq.get("of", "") if type(self.container) is not str: self.container = str(self.container) self.container = self.container.replace('..', '') self.container = self.container.strip('/') if not self.container: raise MissingOfField()
def getPath(self, DBReq: DBRequest) -> None: self.path = DBReq.get("path", "") if type(self.path) is not str: self.path = str(self.path) self.path = self.path.replace('..', '') self.path = self.path.strip('/') if not self.path: self.path = ""
def getContainterName(self, DBReq: DBRequest): self.container = DBReq.get("name", "") if type(self.container) is not str: self.container = str(self.container) self.container = self.container.replace('..', '') self.container = self.container.strip('/') if not self.container: raise MissingNameField()
def getLimit(self, DBReq: DBRequest) -> None: self.limit = DBReq.get("limit", math.inf) if type(self.limit) is str: if self.limit.isdigit(): self.limit = int(self.limit) if type(self.limit) is not int: self.limit = math.inf if self.limit <= 0: raise InvalidLimit()
def getContent(self, DBReq: DBRequest) -> None: self.content = DBReq.get("content", None) if type(self.content) is str: try: self.content = json.loads(self.content) except: raise InvalidContent() if type(self.content) is not dict: raise InvalidContent()
def getContainterTemplate(self, DBReq: DBRequest) -> None: self.default_content = DBReq.get("content", "") if type(self.default_content) is str: try: self.default_content = json.loads(self.default_content) except: raise InvalidContent() if type(self.default_content) is not dict: raise InvalidContent()
async def authorise(self, DBReq: DBRequest) -> bool: token: str = DBReq.get("token", None) if token: token = password(token) db_token: str = self.PhaazeDBS.token if not db_token: return True if token != db_token: return False else: return True
def getValue(self, DBReq: DBRequest): self.value = DBReq.get("value", None) if not self.value: self.value = None
def getRecursive(self, DBReq:DBRequest) -> None: self.recursive = DBReq.get("recursive",None) if type(self.recursive) is not bool: self.recursive = bool(self.recursive)
def getStore(self, DBReq: DBRequest) -> None: self.store = DBReq.get("store", None) if type(self.store) is not str: self.store = None
def getIgnore(self, DBReq: DBRequest) -> None: self.ignore_errors = DBReq.get("ignore_errors", None) if type(self.ignore_errors) is not bool: self.ignore_errors = bool(self.ignore_errors)
def getWhere(self, DBReq: DBRequest) -> None: self.where = DBReq.get("where", "")
def getFile(self, DBReq: DBRequest) -> None: self.fileObject = DBReq.get("phzdb", None) if not self.fileObject: raise MissingImportFile()
def getOption(self, DBReq: DBRequest): self.option = DBReq.get("option", None) if type(self.option) is not str: self.option = None if not self.option: raise MissingOptionField()
def getContainter(self, DBReq: DBRequest) -> None: self.container = DBReq.get("into", "") self.container = self.container.replace('..', '') self.container = self.container.strip('/') if not self.container: raise MissingIntoField()