def handle_noargs(self, verbosity, **options):
   all_css = set(chain(*[v['source_filenames'] for v in settings.COMPRESS_CSS.values()]))
   if verbosity >= 1:
     print "Analyzing *.css files from COMPRESS_CSS"
   urls = []
   for css in all_css:
     content = open(css, 'r').read()
     # todo - the correct way to do this is using css parsing util.
     urls += re.findall(r'''url\((['"a-zA-Z0-9./_-]*)\)''', content)
   urls = sorted(set(urls))
   for m in (re.search(GRADIENT_URL, url) for url in urls):
     if m:
       output_filename = os.path.join('static-media/quasi/', '%(hex1)s-%(hex2)s-%(direction)s-%(size)s.png' % m.groupdict())
       if verbosity >= 1:
         print output_filename
       output = open(output_filename, 'wb')
       generate_gradient(output, *parse_args(**m.groupdict()))
       output.close()
   print "done."
Example #2
0
def gradient_hex(request, direction, hex1, hex2, size):
  args = parse_args(direction, hex1, hex2, size)
  return gradient(request, *args)