示例#1
0
    def handle(self, *args, **options):
        for design in Design.objects.all():
            clean_design_name = clean_string(design.name)
            # raise CommandError('Poll "%s" does not exist' % poll_id)
            self.stdout.write("\n*** %r ***" % clean_design_name)
            self.stdout.write("\t%r" % design)

            sites = design.sites.all()
            count_info=[]
            for site in sites:
                pagetree_count = PageTree.objects.filter(design=design, site=site).count()
                count_info.append((site, pagetree_count))
                self.stdout.write("\tSite %r count: %i" % (site.name, pagetree_count))

            count_info.sort(key=lambda x: x[1])
            most_used_site=count_info[0][0]

            clean_site_name = clean_string(most_used_site.name)

            base_out_path = os.path.join(PATH_EXPORTED, clean_site_name, clean_design_name)

            shutil.rmtree(base_out_path, ignore_errors=True) # TODO: remove later!!!

            self._process_headfiles(design, base_out_path)
            self._process_template(design, base_out_path)
示例#2
0
    def handle(self, *args, **options):
        for design in Design.objects.all():
            clean_design_name = clean_string(design.name)
            # raise CommandError('Poll "%s" does not exist' % poll_id)
            self.stdout.write("\n*** %r ***" % clean_design_name)
            self.stdout.write("\t%r" % design)

            sites = design.sites.all()
            count_info = []
            for site in sites:
                pagetree_count = PageTree.objects.filter(design=design,
                                                         site=site).count()
                count_info.append((site, pagetree_count))
                self.stdout.write("\tSite %r count: %i" %
                                  (site.name, pagetree_count))

            count_info.sort(key=lambda x: x[1])
            most_used_site = count_info[0][0]

            clean_site_name = clean_string(most_used_site.name)

            base_out_path = os.path.join(PATH_EXPORTED, clean_site_name,
                                         clean_design_name)

            shutil.rmtree(base_out_path,
                          ignore_errors=True)  # TODO: remove later!!!

            self._process_headfiles(design, base_out_path)
            self._process_template(design, base_out_path)
示例#3
0
def _clean_project_name(name):
    clean_name = clean_string(name)
    if clean_name == name:
        return name

    click.echo("\nERROR: The given project name is not useable!")
    click.echo("Should i use:\n")
    click.echo("\t%s\n" % clean_name)
    click.confirm("Continue ?", abort=True)
    return clean_name
示例#4
0
def _clean_project_name(name):
    clean_name = clean_string(name)
    if clean_name == name:
        return name

    click.echo("\nERROR: The given project name is not useable!")
    click.echo("Should i use:\n")
    click.echo("\t%s\n" % clean_name)
    click.confirm("Continue ?", abort=True)
    return clean_name