def api_save_system(self, request, name, type=None, description=None, *args, **kwargs): c = CPClient() if c.has_system(): try: c.update_system(name, type, description=description) except CPClient.Error, why: return {"status": False, "message": str(why)}
def api_save_system(self, request, name, type=None, description=None, *args, **kwargs): c = CPClient() if c.has_system(): try: c.update_system(name, type, description=description) except CPClient.Error as e: return {"status": False, "message": str(e)} else: # Create account try: c.create_system(name, type, description=description) except CPClient.Error as e: return {"status": False, "message": str(e)} return {"status": True, "message": "System saved"}