Exemple #1
0
    def render(self, context):
        try:
            file = self.file.resolve(context)
        except template.VariableDoesNotExist:
            return u''

        # normalize the extension
        ext = file.get_extension()
        if preview_aliases.get(ext, None):
            ext = preview_aliases[ext]

        # load up the preview template
        if ext in preview_extensions:
            context[self.context_name] = True
        else:
            context[self.context_name] = False

        return u''
Exemple #2
0
 def render(self, context):
     try:
         file = self.file.resolve(context)
     except template.VariableDoesNotExist:
         return u''
     
     # normalize the extension
     ext = file.get_extension()
     if preview_aliases.get(ext, None):
         ext = preview_aliases[ext]
 
     # load up the preview template
     if ext in preview_extensions:
         context[self.context_name] = True
     else:
         context[self.context_name] = False
         
     return u''
Exemple #3
0
    def render(self, context):
        try:
            file = self.file.resolve(context)
        except template.VariableDoesNotExist:
            return u''

        # normalize the extension
        ext = file.get_extension()
        if preview_aliases.get(ext, None):
            ext = preview_aliases[ext]

        if ext in preview_extensions:
            try:
                # dynamically load the preview renderer
                m = __import__('workspace.previews.%s' % ext, globals(),
                               locals(), ['render'], -1)
                return m.render(file)
            except:
                pass

        return u''
Exemple #4
0
 def render(self, context):
     try:
         file = self.file.resolve(context)
     except template.VariableDoesNotExist:
         return u''
     
     # normalize the extension
     ext = file.get_extension()
     if preview_aliases.get(ext, None):
         ext = preview_aliases[ext]
 
     if ext in preview_extensions:
         try:
             # dynamically load the preview renderer
             m = __import__('workspace.previews.%s' % ext,
                            globals(), locals(), ['render'], -1)
             return m.render(file)
         except:
             pass
 
     return u''