def render(self, context):
     try:
         formatname = self.format.resolve(context)
         image = self.image.resolve(context)
     except template.VariableDoesNotExist:
         return ''
     try:
         format_cls = formats.get(formatname)
     except formats.FormatDoesNotExist:
         return ''
     try:
         imagequery = get_imagequery(image)
     except IOError: # handle missing files
         return ''
     format = format_cls(imagequery)
     if self.allow_lazy and not self.name and not format._execute()._exists():
         from imagequery.models import LazyFormat
         lazy_format = LazyFormat(format=formatname)
         lazy_format.query = imagequery
         lazy_format.save()
         return lazy_format.get_absolute_url()
     if self.name:
         context[self.name] = format
         return ''
     else:
         try:
             return format.url()
         except:
             return ''
Esempio n. 2
0
    def render(self, context):
        try:
            formatname = self.format.resolve(context)
            image = self.image.resolve(context)
        except template.VariableDoesNotExist:
            return ''
        try:
            format_cls = formats.get(formatname)
        except formats.FormatDoesNotExist:
            return ''
        try:
            imagequery = get_imagequery(image)
        except IOError:  # handle missing files
            return ''
        format = format_cls(imagequery)
        if self.allow_lazy and not self.name and not format._execute()._exists(
        ):
            from imagequery.models import LazyFormat

            lazy_format = LazyFormat(format=formatname)
            lazy_format.query = imagequery
            lazy_format.save()
            return lazy_format.get_absolute_url()
        if self.name:
            context[self.name] = format
            return ''
        else:
            try:
                return format.url()
            except:
                return ''
def imagequerify_filter(value):
    return get_imagequery(value)
 def newfunc(image, attr):
     try:
         image = get_imagequery(image)
     except IOError:
         return ''
     return func(image, attr)
Esempio n. 5
0
def imagequerify_filter(value):
    return get_imagequery(value)
Esempio n. 6
0
 def newfunc(image, attr):
     try:
         image = get_imagequery(image)
     except IOError:
         return ''
     return func(image, attr)