Mercurial > hg > smartopen
diff smartopen/handlers.py @ 1:10fc4904c10f
now can pass data
author | k0s <k0scist@gmail.com> |
---|---|
date | Sat, 21 Nov 2009 17:29:39 -0500 |
parents | d6fa501af82f |
children | f084e152dd47 |
line wrap: on
line diff
--- a/smartopen/handlers.py Sat Nov 21 15:46:01 2009 -0500 +++ b/smartopen/handlers.py Sat Nov 21 17:29:39 2009 -0500 @@ -19,12 +19,6 @@ def test(self, query): return True - def open(self, query): - if not self.test(query): - return False - url = self.url(query) - os.system("firefox '%s'" % url) - return True class URL(Location): """a straight URL""" @@ -46,7 +40,7 @@ return False return True -class GoogleMap(Location): +class GoogleMaps(Location): """try to google-maps the address""" def __init__(self): @@ -62,37 +56,41 @@ def test(self, query): return bool(self.process(query)) -class Revision(Location): - def __init__(self): - revision_url = 'http://trac.openplans.org/openplans/changeset/' - Location.__init__(self, revision_url) - - def process(self, query): - return query[1:] - - def test(self, query): - if query[0] != 'r': - return False - return query[1:].isdigit() - +class Trac(Location): + def __init__(self, url): + self.url = url -class TracTicket(Location): - def __init__(self): - # url for # data - number_url = 'http://trac.openplans.org/openplans/ticket/' - Location.__init__(self, number_url) +# TODO: need configuration +# class Revision(Location): +# def __init__(self): +# revision_url = 'http://trac.openplans.org/openplans/changeset/' +# Location.__init__(self, revision_url) + +# def process(self, query): +# return query[1:] - def process(self, query): - if query.startswith('#'): - return query[1:] - return query +# def test(self, query): +# if query[0] != 'r': +# return False +# return query[1:].isdigit() + +# class TracTicket(Location): +# def __init__(self): +# # url for # data +# number_url = 'http://trac.openplans.org/openplans/ticket/' +# Location.__init__(self, number_url) - def test(self, query): - query = self.process(query) - if len(query.split()) != 1: - return False - return query.isdigit() +# def process(self, query): +# if query.startswith('#'): +# return query[1:] +# return query + +# def test(self, query): +# query = self.process(query) +# if len(query.split()) != 1: +# return False +# return query.isdigit() class Wikipedia(Location): """try to open the query in wikipedia"""