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")
Example #2
0
 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)
Example #3
0
 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)
Example #4
0
    def handle(self, **options):
        config = BoilerplateConfiguration(1)
        contrib(config, 'boilerplate', 'name', ask, "Name", letterfirst)
        contrib(config, 'boilerplate', 'url', ask, 'Project URL (optional)', required=False)
        contrib(config, 'boilerplate', 'author', ask, 'Author')
        contrib(config, 'boilerplate', 'author-url', ask, 'Author URL (optional)', required=False)
        contrib(config, 'boilerplate', 'version', ask, 'Version')
        contrib(config, 'boilerplate', 'description', ask, 'Description (short)')
        contrib(config, 'boilerplate', 'license', ask, 'License')
        contrib(config, 'boilerplate', 'license-path', ask, 'Path to license file', PathValidator(), default=guess_license_path())
        print "Configuring CMS templates. Only list templates that should be selectable in the CMS"
        while True:
            name = ask('Verbose template name')
            path = ask('Path to the source of the template', PathValidator('templates'))
            config['templates'][path] = name
            if ask_boolean("Are there more templates?") == 'false':
                break

        config.write('boilerplate.ini')
    def handle(self, **options):
        config = BoilerplateConfiguration(1)
        contrib(config, 'boilerplate', 'name', ask, "Name", letterfirst)
        contrib(config,
                'boilerplate',
                'url',
                ask,
                'Project URL (optional)',
                required=False)
        contrib(config, 'boilerplate', 'author', ask, 'Author')
        contrib(config,
                'boilerplate',
                'author-url',
                ask,
                'Author URL (optional)',
                required=False)
        contrib(config, 'boilerplate', 'version', ask, 'Version')
        contrib(config, 'boilerplate', 'description', ask,
                'Description (short)')
        contrib(config, 'boilerplate', 'license', ask, 'License')
        contrib(config,
                'boilerplate',
                'license-path',
                ask,
                'Path to license file',
                PathValidator(),
                default=guess_license_path())
        print "Configuring CMS templates. Only list templates that should be selectable in the CMS"
        while True:
            name = ask('Verbose template name')
            path = ask('Path to the source of the template',
                       PathValidator('templates'))
            config['templates'][path] = name
            if ask_boolean("Are there more templates?") == 'false':
                break

        config.write('boilerplate.ini')