Problem loading images from Blogger in post. (fetch_filter)

Sam Ruby rubys at intertwingly.net
Tue Oct 24 12:32:33 EST 2006


Gabriel Labelle wrote:
> On Mon, 2006-10-23 at 07:30 -0400, Sam Ruby wrote:
> 
>> I'm sorry that I don't know how to make the Coral CDN faster or more 
>> reliable, but if the problem is that it takes longer the first time an 
>> image is ever referenced, perhaps it would make sense for the filter to 
>> fetch the image?  This would make the planet run take longer, but that's 
>> generally a background process.
>>
>> Thoughts?
> 
> I just tried something, but I'm unable to code it correcty. I took the
> current coral_cdn_filter and tried to create a fetch_filter from it in
> order to do the following:
> 
> - Remap some blog engine's image to match my local cache location (i.e)

I was suggesting something simpler.  Something along the lines of:

======================================================
--- filters/coral_cdn_filter.py
+++ filters/coral_cdn_filter.py
@@ -14,4 +14,10 @@
              component[1] += '.nyud.net:8080'
              node.setAttribute('src', urlparse.urlunparse(component))

+            try:
+                import urllib
+                urllib.urlopen(node.getAttribute('src')).read()
+            except:
+                pass
+
  print entry.toxml('utf-8')
======================================================

The idea is to force the CDN network to preload the image.  Yes, 
sometimes it fails, and I can't explain that.  But when it succeeds, the 
image should be ready for you the first time you (the human) load the 
output page.

- Sam Ruby


More information about the devel mailing list