예제 #1
0
파일: resources.py 프로젝트: mcdonc/memphis
def static(name, path, layer=''):
    """ Register new static assets directory

    :param name: Resource name
    :param path: Filesystem path
    """
    abspath, pkg = tmpl.path(path)
    data = registry[name] = [abspath, pkg]

    if not abspath:
        raise ValueError("Can't find path to static resource")

    if not os.path.isdir(abspath):
        raise ValueError("path is not directory")

    discriminator = ('memphis.view:static', name, layer)

    info = config.DirectiveInfo()
    info.attach(
        config.Action(
            LayerWrapper(lambda a1,a2,a3: registry.update({a1: (a2, a3)}),
                         discriminator),
            (name, abspath, pkg),
            discriminator = discriminator))
예제 #2
0
파일: customize.py 프로젝트: mcdonc/memphis
 def layer(self, pkg, path):
     abspath, pkgname = tmpl.path(path)
     layer = self.layers.setdefault(pkg, [])
     layer.insert(0, (pkgname, abspath, path))