Esempio n. 1
0
 def lookup_rule(self, rule_name, state=None, match_function=None):
     match_function = lambda x,y:x==y
     for node in self.nodes:
         if isinstance(node, MixlRuleNode) and match_function(node.name, rule_name):
             return (node, self)
     for reference in self.references:
         try:
             reference_template = mixl_import(reference, self.paths)
             (rule, template) = reference_template.lookup_rule(rule_name, match_function)
             return (rule, template)
         except IOError:
             pass
         except NoSuchRule:
             pass
     raise NoSuchRule
Esempio n. 2
0
def mixl_css(request, filename):
    """
        mixl_css view
            - THIS SHOULD NOT BE USED IN PRODUCTION, just for development

            attempts to locate a css file along the MIXL_PATHS and then
            parses and returns the content

            in production, please use the management commands to compile
            your mixl css files into your MEDIA_ROOT.
    """
    paths = getattr(settings, 'MIXL_PATHS', ['./'])
    #try:
    context = {
        'MEDIA_URL':settings.MEDIA_URL
    }
    template = mixl_import(filename, paths, context=context)
    output = template.output(context)
    #if output is None:
    #    raise Http404
    #except IOError:
    #    raise Http404
    return HttpResponse(content=output, mimetype='text/css', status=200)