def run(self, boilerplatefile, session, printer, **options): printer = Printer(int(options['verbosity']), logfile='djeese.log') config = BoilerplateConfiguration(printer=printer) config.read(boilerplatefile) bundle = bundle_boilerplate(config) boilerplatename = config['boilerplate']['name'] response = self.upload(boilerplatename, bundle, session, printer) if response.status_code == 201: printer.always("Upload successful (created)") elif response.status_code == 204: printer.always("Upload successful (updated)") elif response.status_code == 400: self.handle_bad_request(response, printer) printer.always("Upload failed") elif response.status_code == 403: printer.error("Authentication failed") printer.always("Upload failed") self.clear_auth() elif response.status_code == 502: printer.error("Temporarily unavailable") printer.always("Upload failed") else: printer.error("Unexpected response: %s" % response.status_code) printer.log_only(response.content) printer.always("Upload failed, check djeese.log for more details")
def handle(self, boilerplate=None, **options): if not boilerplate: raise CommandError("You must provide the path to your boilerplate file as first argument") if not os.path.exists(boilerplate): raise CommandError("Boilerplate file %r not found." % appfile) boilerplatecfg = BoilerplateConfiguration(int(options['verbosity'])) boilerplatecfg.read(boilerplate) if not boilerplatecfg.validate(): sys.exit(1)
def handle(self, boilerplate=None, **options): if not boilerplate: raise CommandError( "You must provide the path to your boilerplate file as first argument" ) if not os.path.exists(boilerplate): raise CommandError("Boilerplate file %r not found." % appfile) boilerplatecfg = BoilerplateConfiguration(int(options['verbosity'])) boilerplatecfg.read(boilerplate) if not boilerplatecfg.validate(): sys.exit(1)