[Debtags-commits] [SCM] Debian Data Export - A tool to publish Debian information branch, flask, updated. ee17c7f48c47e9e64fc37bba781da295021d808e
Enrico Zini
enrico at enricozini.org
Wed Nov 17 23:42:49 UTC 2010
The following commit has been merged in the flask branch:
commit 5e05c12ee28a7e8cc2f3e18c0c3982b9af5aaffa
Author: Enrico Zini <enrico at enricozini.org>
Date: Wed Nov 17 22:43:02 2010 +0000
Create modules with init, to allow autodetection and a chance to turn a module off
diff --git a/dde/__init__.py b/dde/__init__.py
index 3e16aa8..4b5fccc 100644
--- a/dde/__init__.py
+++ b/dde/__init__.py
@@ -38,8 +38,10 @@ def create_app(debug=False, config=None):
continue
try:
basename = p.__name__.rsplit(".", 1)[1]
- app.register_module(p.module, url_prefix="/"+basename)
- dde.root.modules[basename] = p
+ module = p.init()
+ if module is None: continue
+ app.register_module(module, url_prefix="/"+basename)
+ dde.root.modules[basename] = (p, module)
except Exception, e:
print >>sys.stderr, "Exception caught loading plugin %s: skipping plugin" % p
print >>sys.stderr, "Exception details:"
diff --git a/plugins/debtags.py b/plugins/debtags.py
index 23215d7..3e967c6 100644
--- a/plugins/debtags.py
+++ b/plugins/debtags.py
@@ -167,57 +167,7 @@ def complete_tag(name):
res = voc.complete_tag(name)
return dde.make_response(res)
-#class ListComplete(octofuss.Tree):
-# def __init__(self, name, items, doc = None):
-# super(ListComplete, self).__init__(name, doc)
-# self.items = items
-#
-# def lhas(self, path, **kw):
-# if len(path) == 0: return True
-# if len(path) > 1: return False
-# for i in self.items:
-# if i.startswith(path[0]):
-# return True
-# return False
-#
-# def lget(self, path, **kw):
-# if len(path) == 0: return None
-# if len(path) > 1: return None
-# res = []
-# for i in self.items:
-# if i.startswith(path[0]):
-# res.append(i)
-# res.sort()
-# return res
-#
-# def llist(self, path, **kw):
-# if len(path) == 0: return []
-# if len(path) > 1: return []
-# res = []
-# for i in self.items:
-# if i.startswith(path[0]):
-# res.append(i)
-# res.sort()
-# return res
-#
-# def ldoc(self, path, **kw):
-# if len(path) == 0: return super(ListComplete, self).ldoc(path)
-# if len(path) > 1: return None
-# return super(ListComplete, self).ldoc(path) + "\nEvery item that starts with " + path[0]
-#
-#class FacetComplete(ListComplete):
-# def __init__(self, name, voc, doc = None):
-# if doc is None:
-# doc = "Complete facet names"
-# super(FacetComplete, self).__init__(name, voc.facets.keys(), doc)
-#
-#class TagComplete(ListComplete):
-# def __init__(self, name, voc, doc = None):
-# if doc is None:
-# doc = "Complete tag names"
-# super(TagComplete, self).__init__(name, voc.tags.keys(), doc)
-#
-#def init(**kw):
+def init(**kw):
# conf = kw.get("conf", None)
# canMock = False
# forceMock = False
@@ -246,3 +196,4 @@ def complete_tag(name):
# tree = top,
# root = "/"
# )
+ return module
--
Debian Data Export - A tool to publish Debian information
More information about the Debtags-commits
mailing list