Example #1
0
def get_template_sources(template_name, template_dirs=None):
    """
    
    """
    request = get_current_request()
    if request:
        # Loop through the request.META mapping attributes
        for key, val in TEMPLATE_MAP.items():
            # Get the value from the request for that key
            req_val = request.META.get(key, None)
            if req_val is not None:
                # The request value exists, 
                for key, val in val.items():
                    if key.search(req_val):
                        for filepath in val:
                            yield safe_join(filepath, template_name)
Example #2
0
 def get_template_sources(self, template_name, template_dirs=None):
     """
     Looks in the saved request object from the middleware for
     directories and passes back the path. Doesn't verify that the
     path is valid, though.
     """
     request = get_current_request()
     if request:
         # Loop through the request.META mapping attributes
         for key, val in TEMPLATE_MAP.items():
             # Get the value from the request for that key
             req_val = request.META.get(key, None)
             if req_val is not None:
                 # The request value exists, 
                 for key, val in val.items():
                     if key.search(req_val):
                         for filepath in val:
                             yield safe_join(filepath, template_name)