[Grok-dev] Adding indexes with the same field names
Dirceu Pereira Tiegs
dirceutiegs at gmail.com
Sun Jul 29 13:46:25 EDT 2007
Hello guys,
I have two classes implementing these two interfaces:
class IBook(interface.Interface):
title = schema.TextLine(title=u"Title", required=True)
# more attributes here
class IArticle(interface.Interface):
title = schema.TextLine(title=u"Title", required=True)
# more attributes here
And these two indexes:
class BookIndexes(grok.Indexes):
grok.site(BookShelf)
grok.context(Book)
book_title = index.Text('title') # should use title of IBook
class ArticleIndexes(grok.Indexes):
grok.site(BookShelf)
grok.context(Article)
article_title = index.Text('title') # should use title of IArticle
Well, when I test the application I get the following error:
Exception raised:
Traceback (most recent call last):
File "/Users/dirceu/devel/buildout-eggs/tmpteHm0u/
zope.testing-3.5.0-py2.4.egg/zope/testing/doctest.py", line 1356, in
__run
if out is None:
File "<doctest bookshelf.ftests.xmlrpc[3]>", line 1, in ?
root['bookshelf'] = BookShelf()
File "/Library/Frameworks/Python.framework/Versions/2.4/lib/
python2.4/site-packages/zope.app.folder-3.4.0a1-py2.4.egg/zope/app/
folder/folder.py", line 94, in __setitem__
setitem(self, self.data.__setitem__, name, object)
File "/Users/dirceu/devel/buildout-eggs/tmps0gZ_z/
zope.app.container-3.5.0a1-py2.4-macosx-10.4-fat.egg/zope/app/
container/contained.py", line 591, in setitem
File "/Users/dirceu/devel/buildout-eggs/tmpBcivAN/
zope.event-3.4.0-py2.4.egg/zope/event/__init__.py", line 23, in notify
File "/Users/dirceu/devel/buildout-eggs/tmpZWfrhm/
zope.component-3.4.0a1-py2.4.egg/zope/component/event.py", line 26,
in dispatch
File "/Users/dirceu/devel/buildout-eggs/tmpZWfrhm/
zope.component-3.4.0a1-py2.4.egg/zope/component/_api.py", line 130,
in subscribers
File "/Users/dirceu/devel/buildout-eggs/tmpZWfrhm/
zope.component-3.4.0a1-py2.4.egg/zope/component/registry.py", line
290, in subscribers
File "/Users/dirceu/devel/buildout-eggs/tmpl14lFh/
zope.interface-3.4.0-py2.4-macosx-10.4-fat.egg/zope/interface/
adapter.py", line 535, in subscribers
File "/Users/dirceu/devel/buildout-eggs/tmpZWfrhm/
zope.component-3.4.0a1-py2.4.egg/zope/component/event.py", line 33,
in objectEventNotify
File "/Users/dirceu/devel/buildout-eggs/tmpZWfrhm/
zope.component-3.4.0a1-py2.4.egg/zope/component/_api.py", line 130,
in subscribers
File "/Users/dirceu/devel/buildout-eggs/tmpZWfrhm/
zope.component-3.4.0a1-py2.4.egg/zope/component/registry.py", line
290, in subscribers
File "/Users/dirceu/devel/buildout-eggs/tmpl14lFh/
zope.interface-3.4.0-py2.4-macosx-10.4-fat.egg/zope/interface/
adapter.py", line 535, in subscribers
File "/Library/Frameworks/Python.framework/Versions/2.4/lib/
python2.4/site-packages/grok-0.9dev_r77767-py2.4.egg/grok/meta.py",
line 564, in __call__
index.setup(catalog, name, self.context, self.module_info)
File "/Library/Frameworks/Python.framework/Versions/2.4/lib/
python2.4/site-packages/grok-0.9dev_r77767-py2.4.egg/grok/index.py",
line 50, in setup
field_callable=call,
TypeError: __init__() got multiple values for keyword argument
'field_name'
My question is: how can I add these two indexes with the same
attribute name?
Thanks in advance,
--
Dirceu Pereira Tiegs - http://dirceu.info/
Weimar Consultoria
Hospedagem Plone, Zope e Python
http://www.pytown.com
More information about the Grok-dev
mailing list