def __init__(self, env, w, id, action, label, configfile): """ @param configfile: Path to the configfile for the cms. """ self.posts_folder, self.theme_folder, self.process_command, \ self.sync_command = parse_config(configfile) super(StaticCmsEdit, self).__init__( env, w, id, action, label)
def cli(): p = OptionParser( usage = "%prog [options]", description = "'--validate' and/or '--create' options must be supplied. "\ "If both are supplied, '--validate' is executed first, and " "if it fails the program aborts.") p.add_option("--validate", dest="validate", action="store_true", help="Validate all the given posts. If not -p is given, " \ "validate all posts.") p.add_option("--create", dest="create", action="store_true", help="Create the cms.") p.add_option("-p", "--post-id", dest="post_id", help="The id(filename) of a post. Only used by the " \ "--create action.") p.add_option("-c", "--config-file", dest="config_file", help="Path to the config-file. Defaults to staticcms.cfg.", default="staticcms.cfg") p.add_option("-v", "--verbose", dest="verbose", action="store_true", help="Show some extra informative output.") p.add_option("-d", "--very-verbose", dest="vverbose", action="store_true", help="Show debugging information. For theme writers.") (opt, args) = p.parse_args() if not (opt.validate or opt.create): p.print_help() exit(1) if opt.verbose: logging.basicConfig(level=logging.INFO) elif opt.vverbose: logging.basicConfig(level=logging.DEBUG) try: posts_folder, theme_folder, process_command, sync_command = \ parse_config(opt.config_file) except Exception, e: if exists(opt.config_file): raise else: raise SystemExit("Config-file '%s' does not exist." % opt.config_file)