root/calcium/trunk/coralcache.py

Revision 158, 359 bytes (checked in by dsandler, 2 years ago)

Move Coral stuff to a separate file.

Line 
1 import urlparse
2
3 """coralcache.py - a simple library to convert a URL to the CoralCDN version
4 (see http://coralcdn.org)
5 """
6
7 def coralize(url):
8     parts = list(urlparse.urlsplit(url))
9     if parts[0] != 'http':
10         raise Exception('CoralCDN only works with http: urls')
11     parts[1] = '%s.nyud.net:8090' % parts[1]
12     return urlparse.urlunsplit(parts)
13
Note: See TracBrowser for help on using the browser.