diff smartopen/handlers.py @ 10:a963acb1713d

add a new handler: MercurialRevision
author Jeff Hammel <jhammel@mozilla.com>
date Tue, 21 Sep 2010 12:01:34 -0700
parents 44950f376e98
children ba9058605c5a
line wrap: on
line diff
--- a/smartopen/handlers.py	Tue May 04 08:49:39 2010 -0700
+++ b/smartopen/handlers.py	Tue Sep 21 12:01:34 2010 -0700
@@ -1,4 +1,5 @@
 import address
+import string
 import urllib
 import urllib2
 
@@ -138,3 +139,14 @@
         except ValueError:
             return False
         return True
+
+class MercurialRevision(Location):
+    def __init__(self):
+        baseurl = 'http://hg.mozilla.org/mozilla-central/rev/'
+        Location.__init__(self, baseurl)
+
+    def test(self, query):
+        query = set(query)
+        if query.issubset(string.digits + 'abcdef'):
+            return True
+        return False