def put(self): ''' POST verb call Returns: JSON/HTML/PDF view of the data. ''' fileID = int(self.hasMember('file')) author = self.hasMember('author') programText = self.hasMember('programText') title = self.hasMember('title') readOnly = self.hasMember('readOnly') if readOnly is "true": data = {"error": "ReadOnly file", "missing": "false readOnly"} view = errorView(data=data) return view.returnData() else: readOnly = False fileData = fileDoc(hashID=fileID, author=author, programText=programText, title=title, readOnly=readOnly) fileData.save() fileData = fileDoc.view("file/admin", key=fileID).first() fileData = dict(fileData) fileData['update'] = True view = fileView(data=fileData) return view.returnData()
def post(self): ''' PUT verb call Returns: JSON/HTML/PDF view of the data ''' fileID = ''.join(random.choice(hashChoice) for i in range(10)) programText = self.hasMember('programText') author = self.hasMember('author') title = self.hasMember('title') readOnly = self.hasMember('readOnly') if readOnly is "true": readOnly = True else: readOnly = False fileData = fileDoc(hashID=int(fileID)) fileData.programText = programText fileData.title = title fileData.author = author fileData.readOnly = readOnly fileData.save() fileData = fileDoc.view("file/admin", key=fileID).first() fileData = dict(fileData) fileData['save'] = True view = fileView(data=fileData) return view.returnData()
def get(self): ''' GET verb call Returns: JSON/HTML/PDF view of the data. ''' fileID = int(self.hasMember('file')) fileData = fileDoc.view("file/admin", key=fileID).first() fileData = dict(fileData) view = fileView(data=fileData) return view.returnData()
def getFunc(self, **kwargs): ''' function documentation GET verb call Returns: ''' #Go through and make sure we're not in testing mode, in which case the unit tests will pass the barcode instead... try: wi = web.input() file = wi['file'] except: file = kwargs['file'] file = fileDoc.view("files/admin", key=bar).first() file = dict(file) view = fileView.fileView(file, wi) return view.returnData()