Author: whit
Date: 2007-06-29 18:57:31 -0400 (Fri, 29 Jun 2007)
New Revision: 6868
Modified:
TaggerStore/trunk/taggerstore/utils.py
Log:
add a convenience function for getting the atom entry btree
Modified: TaggerStore/trunk/taggerstore/utils.py
===================================================================
--- TaggerStore/trunk/taggerstore/utils.py 2007-06-29 22:50:29 UTC (rev
6867)
+++ TaggerStore/trunk/taggerstore/utils.py 2007-06-29 22:57:31 UTC (rev
6868)
@@ -15,28 +15,28 @@
#root[ATOM]=IdStorage()
root[ATOM]=OOBTree()
-def get_tagger(cxn=None, graph=None):
+def get_atom_entries(cxn):
+ root = cxn.root()
+ return root[ATOM]
+
+def get_graph(cxn=None, graph=Graph):
"""
Returns a tagging object:
For testing::
>>> from dtopt import ELLIPSIS
- >>> get_tagger(graph=Graph())
- <tagger.tag.Tagger object at ...>
- With ZODB::
-
>>> from ZODB import DemoStorage, DB
>>> storage = DemoStorage.DemoStorage()
>>> cxn = DB(storage).open()
- >>> get_tagger(cxn)
+ >>> get_graph(cxn)
Traceback (most recent call last):
...
AssertionError: You need to run taggerstore.utils.init_zodb
>>> init_zodb(cxn)
- >>> get_tagger(cxn)
- <tagger.tag.Tagger object at ...>
+ >>> get_graph(cxn)
+ <Graph identifier=... (<class 'rdflib.Graph.Graph'>)>
"""
if cxn:
root = cxn.root()
@@ -44,7 +44,7 @@
store = root[STORE]
graph = Graph(store)
- if not graph:
+ if not cxn:
graph = Graph()
return graph
--
Archive:
http://www.openplans.org/projects/opencore/lists/openplans-svn/archive/2007/06/1183157851789
To unsubscribe send an email with subject unsubscribe to [EMAIL PROTECTED]
Please contact [EMAIL PROTECTED] for questions.