示例#1
0
 def handle_noargs(self,  **options):
     super(Command, self).handle_noargs(**options)
     if not options.get('shrink'):
         return
     extensions = handle_extensions(options['extensions'])
     templates = set()
     for loader_dot in settings.TEMPLATE_LOADERS:
         loader = import_string(loader_dot)()
         if hasattr(loader, 'get_template_sources'):
             for template_dir in loader.get_template_sources(''):
                 if isdir(template_dir):
                     for (dirpath, dirnames, filenames) in os.walk(template_dir):
                         for f in filenames:
                             if splitext(f)[1] in extensions:
                                 templates.add(get_template(pjoin(dirpath, f)))
     for t in templates:
         rshrink(t, t)
示例#2
0
 def handle_noargs(self, **options):
     super(Command, self).handle_noargs(**options)
     if not options.get('shrink'):
         return
     extensions = handle_extensions(options['extensions'])
     templates = set()
     for loader_dot in settings.TEMPLATE_LOADERS:
         loader = import_string(loader_dot)()
         if hasattr(loader, 'get_template_sources'):
             for template_dir in loader.get_template_sources(''):
                 if isdir(template_dir):
                     for (dirpath, dirnames,
                          filenames) in os.walk(template_dir):
                         for f in filenames:
                             if splitext(f)[1] in extensions:
                                 templates.add(
                                     get_template(pjoin(dirpath, f)))
     for t in templates:
         rshrink(t, t)
 def handle_noargs(self,  **options):
     super(Command, self).handle_noargs(**options)
     if not options.get('shrink'):
         return
     extensions = handle_extensions(options['extensions'])
     templates = set()
     for loader_dot in settings.TEMPLATE_LOADERS:
         loader = import_string(loader_dot)()
         if hasattr(loader, 'get_template_sources'):
             for template_dir in loader.get_template_sources(''):
                 if isdir(template_dir):
                     for (dirpath, dirnames, filenames) in os.walk(template_dir):
                         for f in filenames:
                             if splitext(f)[1] in extensions:
                                 try:
                                     templates.add(get_template(pjoin(dirpath, f)))
                                 except (TemplateSyntaxError,
                                         TemplateEncodingError,
                                         TemplateDoesNotExist,
                                         VariableDoesNotExist,
                                         InvalidTemplateLibrary):
                                     pass
     for t in templates:
         rshrink(t, t)