def put_packageinstance(): try: # Add a new packageinstance. package_id = request.forms.get('package_id') arch_id = request.forms.get('arch_id') suite_id = request.forms.get('suite_id') dist_id = request.forms.get('dist_id') format_id = request.forms.get('format_id') slave = request.forms.get('slave') if not slave: slave = "false" if package_id and arch_id and suite_id and dist_id and format_id and slave: package = myDb.get_package_id(package_id) arch = myDb.get_arch_id(arch_id) suite = myDb.get_suite_id(suite_id) dist = myDb.get_dist_id(dist_id) pkg_format = myDb.get_format_id(format_id) myDb.put_packageinstance(package,arch,suite,dist,pkg_format,slave) else: response.status = "400 - Required fields missing." return except Exception as e: raise Exception('Exception encountered: ' + str(e)) return None
def get_format_id(format_id): try: # Returns all information about a specific format res = myDb.get_format_id(format_id) # check results returned if res: encoded = jsonpickle.encode(res) response.content_type = "application/json" return encoded else: response.status = "404 - No format found with this ID." return except Exception as e: raise Exception('Exception encountered: ' + str(e)) return None