From: blizzard <blizzard@ae879524-a8bd-4c4c-a5ea-74d2e5fc5a2c>
Date: Tue, 30 Sep 2008 23:47:06 +0000 (+0000)
Subject: 2008-09-30  Christopher Blizzard  <blizzard@0xdeadbeef.com>
X-Git-Url: http://git.etc.gen.nz/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=700edc5a0d5b5ec227838e48b1d292962361804c;p=whoisi.git

2008-09-30  Christopher Blizzard  <blizzard@0xdeadbeef.com>

        * tests/nose/test_newsite.py (TestNewSite.test_delicious): Add
        test cases for new style delicious urls.

        * services/command/delicious.py (Delicious.isDelicious): Add
        support for new-style delicious urls.



git-svn-id: svn://trac.whoisi.com/whoisi/trunk@2 ae879524-a8bd-4c4c-a5ea-74d2e5fc5a2c
---

diff --git a/ChangeLog b/ChangeLog
index 204eabf..c4dd978 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,11 @@
+2008-09-30  Christopher Blizzard  <blizzard@0xdeadbeef.com>
+
+	* tests/nose/test_newsite.py (TestNewSite.test_delicious): Add
+	test cases for new style delicious urls.
+
+	* services/command/delicious.py (Delicious.isDelicious): Add
+	support for new-style delicious urls.
+
 2008-09-19  Christopher Blizzard  <blizzard@0xdeadbeef.com>
 
 	* utils/utils.cfg: New file for utils that includes database
diff --git a/services/command/delicious.py b/services/command/delicious.py
index bec2057..8c0ade4 100644
--- a/services/command/delicious.py
+++ b/services/command/delicious.py
@@ -32,15 +32,20 @@ class Delicious:
         path = u[2]
 
         # site url
-        # http://del.icio.us/chrisfralic - base
+        # http://del.icio.us/chrisfralic - base (old style)
+        # http://delicious.com/chrisfralic - base (new style)
 
         # feeds
         # http://del.icio.us/rss/danicomar - bookmarks
         # http://feeds.delicious.com/rss/danicomar - bookmars after redirect
+        # http://feeds.delicious.com/v2/rss/chrisfralic?count=15 (new form)
         # http://del.icio.us/rss/tags/danicomar - tags (do not want)
         # http://feeds.delicious.com/rss/tags/danicomar - tags after redirect (do not want)
 
-        if host == "del.icio.us" and re.match('^/([^/]+$)', path):
+        if (host == "del.icio.us" or host == "delicio.us" or host == "delicious.com") and re.match('^/([^/]+$)', path):
+            return True
+
+        if host == "feeds.delicious.com" and re.match('^/v2/rss/([^/]+$)', path):
             return True
 
         return False
diff --git a/tests/nose/test_newsite.py b/tests/nose/test_newsite.py
index 5637e8e..d6da11c 100644
--- a/tests/nose/test_newsite.py
+++ b/tests/nose/test_newsite.py
@@ -77,11 +77,15 @@ class TestNewSite(unittest.TestCase):
         Test to make sure we can detect del.icio.us urls
         """
         good_urls = ['http://del.icio.us/something',
-                     'http://del.icio.us/foo']
+                     'http://del.icio.us/foo',
+                     'http://delicious.com/foo',
+                     'http://delicio.us/foo',
+                     'http://feeds.delicious.com/v2/rss/chrisfralic?count=15']
 
         bad_urls = ['http://del.icio.us/',
                     'http://del.icio.us/something/rss',
-                    'http://something.else']
+                    'http://something.else',
+                    'http://feeds.delicious.com/v2/rss/tags/chrisfralic?count=15']
 
         for i in good_urls:
             x = Delicious()