Browse files

Overrides & flickr icon. Closes #2

  • Loading branch information...
1 parent 23bb8f4 commit 59c5e8aa43ea40e162f2bc72d4f4e94b66487ef3 @jasoncartwright jasoncartwright committed Dec 28, 2011
Showing with 31 additions and 14 deletions.
  1. +31 −14 getfvco/__init__.py
  2. BIN overrides/www.flickr.com.ico
View
45 getfvco/__init__.py
@@ -343,7 +343,21 @@ def iconInPage(self):
return True
return False
+
+
+ def iconOverridden(self):
+
+ overridePath = os.path.join(os.path.dirname(__file__), "../overrides/%s.ico" % self.targetURL[1])
+
+ if os.path.exists(overridePath):
+ inf("Found override")
+ self.icon = open(overridePath,'r').read()
+ self.writeIcon()
+ return True
+
+ return False
+
def cacheIcon(self,cacheTo = ["DS","MC"]):
@@ -444,26 +458,29 @@ def get(self):
inf("getFavicon for %s" % (self.targetPath))
# Split path to get domain
- targetURL = urlparse(self.targetPath)
- self.targetDomain = "http://" + targetURL[1]
+ self.targetURL = urlparse(self.targetPath)
+ self.targetDomain = "http://" + self.targetURL[1]
- inf("Domain is %s" % (self.targetDomain))
+ inf("URL is %s" % (self.targetDomain))
- # In MC?
- if not self.iconInMC():
+ # Do we have an override?
+ if not self.iconOverridden():
+
+ # In MC?
+ if not self.iconInMC():
- # In DS?
- if not self.iconInDS():
-
- counter.ChangeCount("cacheNone",1)
+ # In DS?
+ if not self.iconInDS():
+
+ counter.ChangeCount("cacheNone",1)
- # Icon at [domain]/favicon.ico?
- if not self.iconAtRoot():
+ # Icon at [domain]/favicon.ico?
+ if not self.iconAtRoot():
- # Icon specified in page?
- if not self.iconInPage():
+ # Icon specified in page?
+ if not self.iconInPage():
- self.writeDefault()
+ self.writeDefault()
application = webapp2.WSGIApplication(
View
BIN overrides/www.flickr.com.ico
Binary file not shown.

0 comments on commit 59c5e8a

Please sign in to comment.