[Checkins] SVN: grokcore.catalog/trunk/ Added and fixed tests
Souheil Chelfouh
cvs-admin at zope.org
Sat Apr 28 15:27:06 UTC 2012
Log message for revision 125365:
Added and fixed tests
Changed:
U grokcore.catalog/trunk/buildout.cfg
U grokcore.catalog/trunk/src/grokcore/catalog/__init__.py
A grokcore.catalog/trunk/src/grokcore/catalog/ftests/catalog/
D grokcore.catalog/trunk/src/grokcore/catalog/ftests/catalog/addform.py
U grokcore.catalog/trunk/src/grokcore/catalog/ftests/catalog/indexes.py
U grokcore.catalog/trunk/src/grokcore/catalog/ftests/catalog/indexes_app_interface.py
U grokcore.catalog/trunk/src/grokcore/catalog/ftests/catalog/indexes_class.py
U grokcore.catalog/trunk/src/grokcore/catalog/ftests/catalog/indexes_multiple.py
U grokcore.catalog/trunk/src/grokcore/catalog/ftests/catalog/indexes_multiple_conflict.py
U grokcore.catalog/trunk/src/grokcore/catalog/ftests/catalog/indexes_name.py
U grokcore.catalog/trunk/src/grokcore/catalog/ftests/catalog/indexes_nonexistent.py
U grokcore.catalog/trunk/src/grokcore/catalog/ftests/catalog/indexes_set.py
U grokcore.catalog/trunk/src/grokcore/catalog/ftests/catalog/indexes_site.py
U grokcore.catalog/trunk/src/grokcore/catalog/ftests/catalog/indexes_valueindex.py
U grokcore.catalog/trunk/src/grokcore/catalog/ftests/catalog/setuporder.py
U grokcore.catalog/trunk/src/grokcore/catalog/ftests/test_grok_functional.py
A grokcore.catalog/trunk/src/grokcore/catalog/tests/catalog/
U grokcore.catalog/trunk/src/grokcore/catalog/tests/catalog/indexes_module.py
U grokcore.catalog/trunk/src/grokcore/catalog/tests/catalog/indexes_no_app.py
U grokcore.catalog/trunk/src/grokcore/catalog/tests/test_grok.py
-=-
Modified: grokcore.catalog/trunk/buildout.cfg
===================================================================
--- grokcore.catalog/trunk/buildout.cfg 2012-04-28 13:19:59 UTC (rev 125364)
+++ grokcore.catalog/trunk/buildout.cfg 2012-04-28 15:27:01 UTC (rev 125365)
@@ -3,10 +3,14 @@
parts = interpreter test
extends = http://svn.zope.org/repos/main/groktoolkit/trunk/grok.cfg
versions = versions
-extensions = buildout.dumppickedversions
+extensions = buildout.dumppickedversions mr.developer
+[sources]
+grokcore.site = svn http://svn.zope.org/repos/main/grokcore.site/trunk
+
[versions]
grokcore.catalog =
+grokcore.site =
[interpreter]
recipe = zc.recipe.egg
Modified: grokcore.catalog/trunk/src/grokcore/catalog/__init__.py
===================================================================
--- grokcore.catalog/trunk/src/grokcore/catalog/__init__.py 2012-04-28 13:19:59 UTC (rev 125364)
+++ grokcore.catalog/trunk/src/grokcore/catalog/__init__.py 2012-04-28 15:27:01 UTC (rev 125365)
@@ -1,3 +1,4 @@
+from grokcore.component import *
from grokcore.catalog.interfaces import IIndexDefinition
from grokcore.catalog.index import IndexDefinition, Field, Text, Set, Value
from grokcore.catalog.components import IndexesClass
Deleted: grokcore.catalog/trunk/src/grokcore/catalog/ftests/catalog/addform.py
===================================================================
--- grok/trunk/src/grok/ftests/catalog/addform.py 2012-04-28 13:19:59 UTC (rev 125364)
+++ grokcore.catalog/trunk/src/grokcore/catalog/ftests/catalog/addform.py 2012-04-28 15:27:01 UTC (rev 125365)
@@ -1,86 +0,0 @@
-"""
-Thanks to Zope's event system, newly added objects are automatically
-catalogued, should a catalog be present.
-
- >>> getRootFolder()["zoo"] = Zoo()
-
- >>> from zope.app.wsgi.testlayer import Browser
- >>> browser = Browser()
- >>> browser.handleErrors = False
-
-Let's demonstrate that an object that has not been added to a
-container yet can still be modified using a form's applyData method.
-Event though this method triggers an IObjectModifiedEvent, the catalog
-won't be bothered by this. It will start the indexation when the
-object has been *added* to a container, not before.
-
- >>> browser.open("http://localhost/zoo/@@addmammoth")
- >>> browser.getControl(name="form.name").value = "Ellie the Mammoth"
- >>> browser.getControl(name="form.size").value = "Really small"
- >>> browser.getControl("Add entry").click()
-
- >>> browser.open("http://localhost/zoo/ellie")
- >>> print browser.contents
- Hi, my name is Ellie the Mammoth, and I\'m "Really small"
-
-Let's ensure the catalog has actually indexed the object with the
-right value:
-
- >>> browser.open("http://localhost/zoo/search")
- >>> print browser.contents
- We found Ellie!
-
-"""
-import grok
-from zope import schema, interface, component
-from zope.intid import IntIds
-from zope.intid.interfaces import IIntIds
-from zope.catalog.catalog import Catalog
-from zope.catalog.interfaces import ICatalog
-from zope.catalog.field import FieldIndex
-
-def setup_catalog(catalog):
- catalog['name'] = FieldIndex('name', IMammoth)
-
-class Zoo(grok.Site, grok.Container):
- grok.local_utility(IntIds, provides=IIntIds)
- grok.local_utility(Catalog, provides=ICatalog, setup=setup_catalog)
-
-class IMammoth(interface.Interface):
- name = schema.TextLine(title=u"Name")
- size = schema.TextLine(title=u"Size")
-
-class Mammoth(grok.Model):
- grok.implements(IMammoth)
-
-class Index(grok.View):
- grok.context(Mammoth)
-
- def render(self):
- return 'Hi, my name is %s, and I\'m "%s"' % (self.context.name,
- self.context.size)
-
-class Search(grok.View):
- grok.context(Zoo)
-
- def render(self):
- catalog = component.getUtility(ICatalog)
- query = ('Ellie the Mammoth', 'Ellie the Mammoth')
- results = catalog.searchResults(name=query)
- if len(list(results)) == 1:
- return 'We found Ellie!'
- return "Couldn't find Ellie."
-
-class AddMammoth(grok.AddForm):
- grok.context(Zoo)
-
- form_fields = grok.AutoFields(IMammoth)
-
- @grok.action('Add entry')
- def add(self, **data):
- # First apply the form data, thus triggering an
- # IObjectModifiedEvent. This test case demonstrates that this
- # isn't a problem.
- ellie = Mammoth()
- self.applyData(ellie, **data)
- self.context['ellie'] = ellie
Modified: grokcore.catalog/trunk/src/grokcore/catalog/ftests/catalog/indexes.py
===================================================================
--- grok/trunk/src/grok/ftests/catalog/indexes.py 2012-04-28 13:19:59 UTC (rev 125364)
+++ grokcore.catalog/trunk/src/grokcore/catalog/ftests/catalog/indexes.py 2012-04-28 15:27:01 UTC (rev 125365)
@@ -62,40 +62,45 @@
Unfortunately ftests don't have good isolation from each other yet.
"""
-from zope.interface import Interface
-from zope import schema
+import grokcore.catalog
+import grokcore.site
+from grokcore.content import Container, Application
+from zope.interface import Interface, Attribute, implements
-import grok
-from grok import index
-class Herd(grok.Container, grok.Application):
+class Herd(Container, Application):
pass
-class Herd2(grok.Container, grok.Application):
+
+class Herd2(Container, Application):
pass
+
class IMammoth(Interface):
- name = schema.TextLine(title=u'Name')
- age = schema.Int(title=u'Age')
+ age = Attribute('Age')
+ name = Attribute('Name')
+
def message():
- """Message the mammoth has for the world."""
+ """Message the mammoth has for the world.
+ """
-class MammothIndexes(grok.Indexes):
- grok.site(Herd)
- grok.context(IMammoth)
- name = index.Field()
- age = index.Field()
- message = index.Text()
+class MammothIndexes(grokcore.catalog.Indexes):
+ grokcore.catalog.site(Herd)
+ grokcore.catalog.context(IMammoth)
-class Mammoth(grok.Model):
- grok.implements(IMammoth)
+ name = grokcore.catalog.Field()
+ age = grokcore.catalog.Field()
+ message = grokcore.catalog.Text()
+
+class Mammoth(Model):
+ implements(IMammoth)
+
def __init__(self, name, age, message):
+ self.age = age
self.name = name
- self.age = age
self._message = message
def message(self):
return self._message
-
Modified: grokcore.catalog/trunk/src/grokcore/catalog/ftests/catalog/indexes_app_interface.py
===================================================================
--- grok/trunk/src/grok/ftests/catalog/indexes_app_interface.py 2012-04-28 13:19:59 UTC (rev 125364)
+++ grokcore.catalog/trunk/src/grokcore/catalog/ftests/catalog/indexes_app_interface.py 2012-04-28 15:27:01 UTC (rev 125365)
@@ -55,30 +55,31 @@
True
"""
-from zope.interface import Interface
+import grokcore.catalog
+from grokcore.content import Container, Application
+from zope.interface import Interface, implements
from zope import schema
-import grok
-from grok import index
-
class IHerd(Interface):
pass
-class Herd(grok.Container, grok.Application):
- grok.implements(IHerd)
+class Herd(Container, Application):
+ implements(IHerd)
-class Herd2(grok.Container, grok.Application):
- grok.implements(IHerd)
+class Herd2(Container, Application):
+ implements(IHerd)
class IMammoth(Interface):
- name = schema.TextLine(title=u'Name')
- age = schema.Int(title=u'Age')
+ name = Attribute("")
+ age = Attribute("")
+
def message():
- """Message the mammoth has for the world."""
+ """Message the mammoth has for the world.
+ """
class MammothIndexes(grok.Indexes):
@@ -88,15 +89,3 @@
name = index.Field()
age = index.Field()
message = index.Text()
-
-
-class Mammoth(grok.Model):
- grok.implements(IMammoth)
-
- def __init__(self, name, age, message):
- self.name = name
- self.age = age
- self._message = message
-
- def message(self):
- return self._message
Modified: grokcore.catalog/trunk/src/grokcore/catalog/ftests/catalog/indexes_class.py
===================================================================
--- grok/trunk/src/grok/ftests/catalog/indexes_class.py 2012-04-28 13:19:59 UTC (rev 125364)
+++ grokcore.catalog/trunk/src/grokcore/catalog/ftests/catalog/indexes_class.py 2012-04-28 15:27:01 UTC (rev 125365)
@@ -52,13 +52,17 @@
Unfortunately ftests don't have good isolation from each other yet.
"""
-import grok
-from grok import index
-class Herd(grok.Container, grok.Application):
+import grokcore.catalog
+from grokcore.content import Container, Application, Model
+
+
+class Herd(Container, Application):
pass
-class Mammoth(grok.Model):
+
+class Mammoth(Model):
+
def __init__(self, name, age, message):
self.name = name
self.age = age
@@ -67,11 +71,11 @@
def message(self):
return self._message
-class MammothIndexes(grok.Indexes):
- grok.context(Mammoth)
- grok.site(Herd)
+
+class MammothIndexes(Indexes):
+ grokcore.catalog.context(Mammoth)
+ grokcore.catalog.site(Herd)
- name = index.Field()
- age = index.Field()
- message = index.Text()
-
+ name = grokcore.catalog.Field()
+ age = grokcore.catalog.Field()
+ message = grokcore.catalog.Text()
Modified: grokcore.catalog/trunk/src/grokcore/catalog/ftests/catalog/indexes_multiple.py
===================================================================
--- grok/trunk/src/grok/ftests/catalog/indexes_multiple.py 2012-04-28 13:19:59 UTC (rev 125364)
+++ grokcore.catalog/trunk/src/grokcore/catalog/ftests/catalog/indexes_multiple.py 2012-04-28 15:27:01 UTC (rev 125365)
@@ -34,39 +34,48 @@
Unfortunately ftests don't have good isolation from each other yet.
"""
+import grokcore.catalog
+import grokcore.site
+from grokcore.content import Container, Application
from zope.interface import Interface
from zope import schema
-import grok
-from grok import index
-class Herd(grok.Container, grok.Application):
+class Herd(Container, Application):
pass
+
class IMammoth(Interface):
- name = schema.TextLine(title=u'Name')
- age = schema.Int(title=u'Age')
+ name = Attribute('Name')
+ age = Attribute('Age')
+
def message():
- """Message the mammoth has for the world."""
+ """Message the mammoth has for the world.
+ """
+
class IMammoth2(Interface):
- name2 = schema.TextLine(title=u'Name')
- age2 = schema.Int(title=u'Age')
+ name2 = Attribute('Name')
+ age2 = Attribute('Age')
+
def message2():
- """Message the mammoth has for the world."""
+ """Message the mammoth has for the world.
+ """
-class MammothIndexes(grok.Indexes):
- grok.site(Herd)
- grok.context(IMammoth)
- name = index.Field()
- age = index.Field()
- message = index.Text()
+class MammothIndexes(grokcore.catalog.Indexes):
+ grokcore.site.site(Herd)
+ grokcore.catalog.context(IMammoth)
-class MammothIndexes2(grok.Indexes):
+ name = grokcore.catalog.Field()
+ age = grokcore.catalog.Field()
+ message = grokcore.catalog.Text()
+
+
+class MammothIndexes2(grokcore.catalog.Indexes):
grok.site(Herd)
grok.context(IMammoth2)
- name2 = index.Field()
- age2 = index.Field()
- message2 = index.Text()
+ name2 = grokcore.catalog.Field()
+ age2 = grokcore.catalog.Field()
+ message2 = grokcore.catalog.Text()
Modified: grokcore.catalog/trunk/src/grokcore/catalog/ftests/catalog/indexes_multiple_conflict.py
===================================================================
--- grok/trunk/src/grok/ftests/catalog/indexes_multiple_conflict.py 2012-04-28 13:19:59 UTC (rev 125364)
+++ grokcore.catalog/trunk/src/grokcore/catalog/ftests/catalog/indexes_multiple_conflict.py 2012-04-28 15:27:01 UTC (rev 125365)
@@ -34,29 +34,30 @@
Unfortunately ftests don't have good isolation from each other yet.
"""
+import grokcore.catalog
+from grokcore.content import Container, Application, Model
from zope.interface import Interface
-from zope import schema
-import grok
-from grok import index
-class Herd(grok.Container, grok.Application):
+class Herd(Container, Application):
pass
+
class IMammoth(Interface):
- name = schema.TextLine(title=u'Name')
+ name = Attribute('')
+
class IMammoth2(Interface):
- name = schema.TextLine(title=u'Name')
+ name = Attribute('')
-class MammothIndexes(grok.Indexes):
- grok.site(Herd)
- grok.context(IMammoth)
- name = index.Field()
+class MammothIndexes(grokcore.catalog.Indexes):
+ grokcore.catalog.site(Herd)
+ grokcore.catalog.context(IMammoth)
+ name = grokcore.catalog.Field()
-class MammothIndexes2(grok.Indexes):
- grok.site(Herd)
- grok.context(IMammoth2)
- name = index.Field()
+class MammothIndexes2(grokcore.catalog.Indexes):
+ grokcore.catalog.site(Herd)
+ grokcore.catalog.context(IMammoth2)
+ name = grokcore.catalog.Field()
Modified: grokcore.catalog/trunk/src/grokcore/catalog/ftests/catalog/indexes_name.py
===================================================================
--- grok/trunk/src/grok/ftests/catalog/indexes_name.py 2012-04-28 13:19:59 UTC (rev 125364)
+++ grokcore.catalog/trunk/src/grokcore/catalog/ftests/catalog/indexes_name.py 2012-04-28 15:27:01 UTC (rev 125365)
@@ -34,13 +34,17 @@
Unfortunately ftests don't have good isolation from each other yet.
"""
-import grok
-from grok import index
+import grokcore.site
+import grokcore.catalog
+from grokcore.content import Container, Application, Model
-class Herd(grok.Container, grok.Application):
+
+class Herd(Container, Application):
pass
-class Mammoth(grok.Model):
+
+class Mammoth(Model):
+
def __init__(self, name, age, message):
self.name = name
self.age = age
@@ -49,11 +53,12 @@
def message(self):
return self._message
-class MammothIndexes(grok.Indexes):
- grok.context(Mammoth)
- grok.name('foo_catalog')
- grok.site(Herd)
-
- name = index.Field()
- age = index.Field()
- message = index.Text()
+
+class MammothIndexes(grokcore.catalog.Indexes):
+ grokcore.catalog.context(Mammoth)
+ grokcore.catalog.name('foo_catalog')
+ grokcore.site.site(Herd)
+
+ name = grokcore.catalog.Field()
+ age = grokcore.catalog.Field()
+ message = grokcore.catalog.Text()
Modified: grokcore.catalog/trunk/src/grokcore/catalog/ftests/catalog/indexes_nonexistent.py
===================================================================
--- grok/trunk/src/grok/ftests/catalog/indexes_nonexistent.py 2012-04-28 13:19:59 UTC (rev 125364)
+++ grokcore.catalog/trunk/src/grokcore/catalog/ftests/catalog/indexes_nonexistent.py 2012-04-28 15:27:01 UTC (rev 125365)
@@ -9,11 +9,11 @@
>>> getRootFolder()['herd'] = herd
Traceback (most recent call last):
...
- GrokError: grok.Indexes in <module
- 'grok.ftests.catalog.indexes_nonexistent' from ...>
+ GrokError: grokcore.catalog.Indexes in <module
+ 'grokcore.catalog.ftests.catalog.indexes_nonexistent' from ...>
refers to an attribute or method 'foo' on interface <InterfaceClass
- grok.ftests.catalog.indexes_nonexistent.IMammoth>, but this does not
- exist.
+ grokcore.catalog.ftests.catalog.indexes_nonexistent.IMammoth>,
+ but this does not exist.
Nuke the catalog and intids in the end, so as not to confuse
other tests::
@@ -24,7 +24,6 @@
>>> from zope.component import getUtility
>>> catalog = getUtility(ICatalog)
-
>>> sm = herd.getSiteManager()
>>> from zope.catalog.interfaces import ICatalog
>>> sm.unregisterUtility(catalog, provided=ICatalog)
@@ -36,26 +35,26 @@
True
"""
+import grokcore.site
+import grokcore.catalog
from zope.interface import Interface
-from zope import schema
+from grokcore.content import Container, Application
-import grok
-from grok import index
-class Herd(grok.Container, grok.Application):
+class Herd(Container, Application):
pass
+
class IMammoth(Interface):
- name = schema.TextLine(title=u'Name')
- age = schema.Int(title=u'Age')
+ name = Attribute('')
+ age = Attribute('')
+
def message():
- """Message the mammoth has for the world."""
+ """Message the mammoth has for the world.
+ """
-class MammothIndexes(grok.Indexes):
- grok.site(Herd)
- grok.context(IMammoth)
- foo = index.Field()
-
-
-
+class MammothIndexes(grokcore.catalog.Indexes):
+ grokcore.site.site(Herd)
+ grokcore.catalog.context(IMammoth)
+ foo = grokcore.catalog.Field()
Modified: grokcore.catalog/trunk/src/grokcore/catalog/ftests/catalog/indexes_set.py
===================================================================
--- grok/trunk/src/grok/ftests/catalog/indexes_set.py 2012-04-28 13:19:59 UTC (rev 125364)
+++ grokcore.catalog/trunk/src/grokcore/catalog/ftests/catalog/indexes_set.py 2012-04-28 15:27:01 UTC (rev 125365)
@@ -46,27 +46,30 @@
Unfortunately ftests don't have good isolation from each other yet.
"""
+import grokcore.site
+import grokcore.catalog
+from grokcore.content import Container, Application, Model
from zope.interface import Interface, Attribute
-import grok
-from grok import index
-class Herd(grok.Container, grok.Application):
+class Herd(Container, Application):
pass
+
class IMammoth(Interface):
features = Attribute('Features')
-class MammothIndexes(grok.Indexes):
- grok.site(Herd)
- grok.context(IMammoth)
- features = index.Set()
+class MammothIndexes(grokcore.catalog.Indexes):
+ grokcore.site.site(Herd)
+ grokcore.catalog.context(IMammoth)
-class Mammoth(grok.Model):
- grok.implements(IMammoth)
+ features = grokcore.catalog.Set()
+
+class Mammoth(Model):
+ implements(IMammoth)
+
def __init__(self, name, features):
self.name = name
self.features = features
-
Modified: grokcore.catalog/trunk/src/grokcore/catalog/ftests/catalog/indexes_site.py
===================================================================
--- grok/trunk/src/grok/ftests/catalog/indexes_site.py 2012-04-28 13:19:59 UTC (rev 125364)
+++ grokcore.catalog/trunk/src/grokcore/catalog/ftests/catalog/indexes_site.py 2012-04-28 15:27:01 UTC (rev 125365)
@@ -32,25 +32,29 @@
True
"""
+import grokcore.site
+import grokcore.catalog
+from grokcore.content import Container, Site
from zope.interface import Interface
-from zope import schema
-import grok
-from grok import index
-class Herd(grok.Container, grok.Site):
+class Herd(Container, Site):
pass
+
class IMammoth(Interface):
- name = schema.TextLine(title=u'Name')
- age = schema.Int(title=u'Age')
+ name = Attribute('Name')
+ age = Attribute('Age')
+
def message():
- """Message the mammoth has for the world."""
+ """Message the mammoth has for the world.
+ """
-class MammothIndexes(grok.Indexes):
- grok.site(Herd)
- grok.context(IMammoth)
- name = index.Field()
- age = index.Field()
- message = index.Text()
+class MammothIndexes(grokcore.catalog.Indexes):
+ grokcore.catalog.site(Herd)
+ grokcore.catalog.context(IMammoth)
+
+ name = grokcore.catalog.Field()
+ age = grokcore.catalog.Field()
+ message = grokcore.catalog.Text()
Modified: grokcore.catalog/trunk/src/grokcore/catalog/ftests/catalog/indexes_valueindex.py
===================================================================
--- grok/trunk/src/grok/ftests/catalog/indexes_valueindex.py 2012-04-28 13:19:59 UTC (rev 125364)
+++ grokcore.catalog/trunk/src/grokcore/catalog/ftests/catalog/indexes_valueindex.py 2012-04-28 15:27:01 UTC (rev 125365)
@@ -48,26 +48,30 @@
Unfortunately ftests don't have good isolation from each other yet.
"""
+import grokcore.site
+import grokcore.catalog
+from grokcore.content import Container, Model
from zope.interface import Interface, Attribute
-import grok
-from grok import index
-class Herd(grok.Container, grok.Application):
+class Herd(Container, grokcore.site.Application):
pass
+
class ISabreTooth(Interface):
feature = Attribute('Feature')
-class SabreToothIndexes(grok.Indexes):
- grok.site(Herd)
- grok.context(ISabreTooth)
- feature = index.Value()
+class SabreToothIndexes(grokcore.site.Indexes):
+ grokcore.site.site(Herd)
+ grokcore.catalog.context(ISabreTooth)
-class SabreTooth(grok.Model):
- grok.implements(ISabreTooth)
+ feature = grokcore.catalog.Value()
+
+class SabreTooth(Model):
+ implements(ISabreTooth)
+
def __init__(self, name, features):
self.name = name
self.feature = features
Modified: grokcore.catalog/trunk/src/grokcore/catalog/ftests/catalog/setuporder.py
===================================================================
--- grok/trunk/src/grok/ftests/catalog/setuporder.py 2012-04-28 13:19:59 UTC (rev 125364)
+++ grokcore.catalog/trunk/src/grokcore/catalog/ftests/catalog/setuporder.py 2012-04-28 15:27:01 UTC (rev 125365)
@@ -36,29 +36,34 @@
"""
-import grok
from zope import schema, interface
from zope.intid import IntIds
from zope.intid.interfaces import IIntIds
from zope.catalog.catalog import Catalog
from zope.catalog.interfaces import ICatalog
from zope.catalog.field import FieldIndex
+from grokcore.content import Model, Container, Site
+from grokcore.site import local_utility
+
def setup_catalog(catalog):
catalog['name'] = FieldIndex('name', IMammoth)
-class IMammoth(interface.Interface):
- name = schema.TextLine()
+class IMammoth(Interface):
+ name = Attribute('Name')
-class Mammoth(grok.Model):
+
+class Mammoth(Model):
grok.implements(IMammoth)
def __init__(self, name):
self.name = name
-class BaseHerd(grok.Container, grok.Site):
- grok.local_utility(IntIds, provides=IIntIds)
+class BaseHerd(Container, Site):
+ local_utility(IntIds, provides=IIntIds)
+
+
class Herd(BaseHerd):
grok.local_utility(Catalog, provides=ICatalog, setup=setup_catalog)
Modified: grokcore.catalog/trunk/src/grokcore/catalog/ftests/test_grok_functional.py
===================================================================
--- grokcore.catalog/trunk/src/grokcore/catalog/ftests/test_grok_functional.py 2012-04-28 13:19:59 UTC (rev 125364)
+++ grokcore.catalog/trunk/src/grokcore/catalog/ftests/test_grok_functional.py 2012-04-28 15:27:01 UTC (rev 125365)
@@ -35,7 +35,7 @@
def test_suite():
suite = unittest.TestSuite()
- for name in []:
+ for name in ["catalog"]:
suite.addTest(suiteFromPackage(name))
return suite
Modified: grokcore.catalog/trunk/src/grokcore/catalog/tests/catalog/indexes_module.py
===================================================================
--- grok/trunk/src/grok/tests/catalog/indexes_module.py 2012-04-28 13:19:59 UTC (rev 125364)
+++ grokcore.catalog/trunk/src/grokcore/catalog/tests/catalog/indexes_module.py 2012-04-28 15:27:01 UTC (rev 125365)
@@ -7,8 +7,7 @@
GrokImportError: <class 'grokcore.catalog.index.Field'> can only be instantiated on
class level.
"""
-from grok import index
+from grokcore.catalog import index
def func():
foo = index.Field()
-
Modified: grokcore.catalog/trunk/src/grokcore/catalog/tests/catalog/indexes_no_app.py
===================================================================
--- grok/trunk/src/grok/tests/catalog/indexes_no_app.py 2012-04-28 13:19:59 UTC (rev 125364)
+++ grokcore.catalog/trunk/src/grokcore/catalog/tests/catalog/indexes_no_app.py 2012-04-28 15:27:01 UTC (rev 125365)
@@ -3,27 +3,32 @@
special indexes declaration. We do need to specify a site (such as
the application) for the Indexes however, otherwise we get a GrokError:
- >>> grok.testing.grok(__name__)
+ >>> grokcore.catalog.testing.grok(__name__)
Traceback (most recent call last):
...
GrokError: No site specified for grok.Indexes subclass in module
- <module 'grok.tests.catalog.indexes_no_app' from ...>.
+ <module 'grokcore.catalog.tests.catalog.indexes_no_app' from ...>.
Use grokcore.site.site() to specify.
"""
-import grok
-from grok import index
+import grokcore.catalog
+import grokcore.component
+from grokcore.site import Application
+from grokcore.content import Model, Container
-class Herd(grok.Container, grok.Application):
+
+class Herd(Container, Application):
pass
-class Mammoth(grok.Model):
+
+class Mammoth(Model):
pass
-class MammothIndexes(grok.Indexes):
- grok.context(Mammoth)
- grok.name('foo_catalog')
+
+class MammothIndexes(grokcore.catalog.Indexes):
+ grokcore.catalog.context(Mammoth)
+ grokcore.catalog.name('foo_catalog')
- name = index.Field()
- age = index.Field()
- message = index.Text()
+ name = grokcore.catalog.Field()
+ age = grokcore.catalog.Field()
+ message = grokcore.catalog.Text()
Modified: grokcore.catalog/trunk/src/grokcore/catalog/tests/test_grok.py
===================================================================
--- grokcore.catalog/trunk/src/grokcore/catalog/tests/test_grok.py 2012-04-28 13:19:59 UTC (rev 125364)
+++ grokcore.catalog/trunk/src/grokcore/catalog/tests/test_grok.py 2012-04-28 15:27:01 UTC (rev 125365)
@@ -49,7 +49,7 @@
def test_suite():
suite = unittest.TestSuite()
- for name in []:
+ for name in ['catalog']:
suite.addTest(suiteFromPackage(name))
return suite
More information about the checkins
mailing list