diff --git a/expert/README.txt b/expert/README.txt new file mode 100644 index 0000000..0c26af1 --- /dev/null +++ b/expert/README.txt @@ -0,0 +1,81 @@ +=============================================================== +loops - Linked Objects for Organization and Processing Services +=============================================================== + +The loops expert - knows what is in a loops site and how to make +use of it. + + ($Id$) + +The query stuff depends on hurry.query, see +http://cheeseshop.python.org/pypi/hurry.query + + +Setting up a loops Site and Utilities +===================================== + +Let's do some basic set up + + >>> from zope.app.testing.setup import placefulSetUp, placefulTearDown + >>> site = placefulSetUp(True) + + >>> from zope import component, interface + +and build a simple loops site with a concept manager and some concepts +(with a relation registry, a catalog, and all the type machinery - what +in real life is done via standard ZCML setup): + + >>> from cybertools.relation.tests import IntIdsStub + >>> component.provideUtility(IntIdsStub()) + >>> from cybertools.relation.registry import RelationRegistry + >>> from cybertools.relation.interfaces import IRelationRegistry + >>> relations = RelationRegistry() + >>> relations.setupIndexes() + >>> component.provideUtility(relations, IRelationRegistry) + + >>> from loops.type import ConceptType, TypeConcept + >>> component.provideAdapter(ConceptType) + >>> component.provideAdapter(TypeConcept) + + >>> from zope.app.catalog.catalog import Catalog + >>> catalog = Catalog() + >>> from zope.app.catalog.interfaces import ICatalog + >>> component.provideUtility(catalog, ICatalog) + + >>> from zope.app.catalog.field import FieldIndex + >>> from zope.app.catalog.text import TextIndex + >>> from loops.interfaces import IIndexAttributes + >>> catalog['loops_title'] = TextIndex('title', IIndexAttributes) + >>> catalog['loops_text'] = TextIndex('text', IIndexAttributes) + >>> catalog['loops_type'] = TextIndex('type', IIndexAttributes) + + >>> from loops import Loops + >>> loopsRoot = site['loops'] = Loops() + + >>> from loops.knowledge.setup import SetupManager + >>> component.provideAdapter(SetupManager, name='knowledge') + >>> from loops.setup import SetupManager + >>> setup = SetupManager(loopsRoot) + >>> concepts, resources, views = setup.setup() + + >>> from loops import util + >>> from loops.concept import IndexAttributes + >>> component.provideAdapter(IndexAttributes) + + >>> from loops.concept import Concept + + >>> for c in concepts: + ... catalog.index_doc(util.getUidForObject(c), c) + + >>> #sorted(concepts) + + +Text Queries +============ + + +Fin de partie +============= + + >>> placefulTearDown() + diff --git a/expert/__init__.py b/expert/__init__.py new file mode 100644 index 0000000..4bc90fb --- /dev/null +++ b/expert/__init__.py @@ -0,0 +1,4 @@ +""" +$Id$ +""" + diff --git a/expert/query.py b/expert/query.py new file mode 100644 index 0000000..65a79c7 --- /dev/null +++ b/expert/query.py @@ -0,0 +1,30 @@ +# +# Copyright (c) 2006 Helmut Merz helmutm@cy55.de +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +# + +""" +Generic query functionality for retrieving stuff from a loops database + +$Id$ +""" + +from zope import interface, component +from zope.app import zapi +from zope.component import adapts +from zope.interface import implements +from zope.cachedescriptors.property import Lazy + diff --git a/expert/tests.py b/expert/tests.py new file mode 100755 index 0000000..b5b06a8 --- /dev/null +++ b/expert/tests.py @@ -0,0 +1,23 @@ +# $Id$ + +import unittest, doctest +from zope.testing.doctestunit import DocFileSuite +from zope.interface.verify import verifyClass +from loops.expert import query + +class Test(unittest.TestCase): + "Basic tests for the expert sub-package." + + def testSomething(self): + pass + + +def test_suite(): + flags = doctest.NORMALIZE_WHITESPACE | doctest.ELLIPSIS + return unittest.TestSuite(( + unittest.makeSuite(Test), + DocFileSuite('README.txt', optionflags=flags), + )) + +if __name__ == '__main__': + unittest.main(defaultTest='test_suite')