diff taginthemiddle/model.py @ 19:57ca873ed9bf default tip

make this a pluggable system and start reorging infrastructure for that
author Jeff Hammel <jhammel@mozilla.com>
date Tue, 25 May 2010 07:48:53 -0700
parents c85d42296c06
children
line wrap: on
line diff
--- a/taginthemiddle/model.py	Mon May 24 07:48:48 2010 -0700
+++ b/taginthemiddle/model.py	Tue May 25 07:48:53 2010 -0700
@@ -7,6 +7,9 @@
 
 import os
 import time
+from pkg_resources import iter_entry_points
+
+### interface
 
 class Tags(object):
   """
@@ -31,6 +34,21 @@
     get the URLs for a set of tags
     """
 
+def make_tags(string):
+  """
+  Instantiate and return a tag engine from a setuptools entry point
+  - string: "URL" of tagger (e.g. 'file:///path/to/file?author=whoami')
+  """
+
+  # have to split out the schema ourselves or urlparse is too smart for
+  # its own good
+  assert '://' in string # XXX could also not have this for no parameters
+  name, value = string.split('://', 1)
+
+  import pdb; pdb.set_trace()
+
+### implementation
+
 class FileTags(Tags):
   """
   file (e.g. .ini) based tagging scheme
@@ -128,3 +146,8 @@
     """
     select * from tags where tag=''
     """
+
+### command line
+
+if __name__ == '__main__':
+  foo = make_tags('file:///tmp/foo.tags?author=bar')