def delete(args): logger.debug("delete " + args.shortname + " from console") try: Site.delete(args.shortname) except Site.DoesNotExist: logger.exception("There is no site named {0} in the DB".format(args.shortname)) except ShellActionFailed as e: logger.exception("Could not delete {0} because shell actions failed. The site record remains in the DB.".format(args.shortname))