changeset 10:a963acb1713d

add a new handler: MercurialRevision
author Jeff Hammel <jhammel@mozilla.com>
date Tue, 21 Sep 2010 12:01:34 -0700
parents 4dd12cf64c0e
children ba9058605c5a
files setup.py smartopen/handlers.py
diffstat 2 files changed, 13 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/setup.py	Tue May 04 08:49:39 2010 -0700
+++ b/setup.py	Tue Sep 21 12:01:34 2010 -0700
@@ -37,5 +37,6 @@
       Trac = smartopen.handlers:Trac
       Bugzilla = smartopen.handlers:Bugzilla
       FedEx = smartopen.handlers:FedEx
+      MercurialRevision = smartopen.handlers:MercurialRevision
       """,
       )
--- 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