Django mediagenerator folder bundler

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
import os

def bundle_builder(bundle_name, folder, **kwargs):

    class file_map(object):
        
        def __init__(self, root):
            self.root = os.path.relpath(root, STATIC_ROOT)

        def __call__(self, file_name, **kwargs):
            if file_name not in kwargs.get('exclude', []):
                return "%s/%s" % (self.root, file_name) 

    file_list = [bundle_name,]
    for root, dirs, files in os.walk(os.path.join(STATIC_ROOT, folder)):
       file_list.extend(map(file_map(root), files))

    return tuple(file_list)

More like this

  1. Coffeescript compilation by delfick 3 months, 3 weeks ago
  2. Template tag to clear cached template fragment by joao.coelho 3 years, 6 months ago
  3. staticview for app by limodou 5 years, 11 months ago
  4. YUI Autocomplete by pigletto 5 years, 9 months ago
  5. Clear Django Cache by girasquid 4 years, 8 months ago

Comments

(Forgotten your password?)