[Grok-dev] Entity Relations and Forms
jmichiel at yahoo.com
Tue Jan 20 10:56:53 EST 2009
Martijn Faassen-2 wrote:
> I think the best library to look at is zc.sourcefactory:
> you can include this as a dependency in your project's setup.py. Perhaps
> you may want to lock it down to a particular version in a [versions]
> list in buildout.cfg as well.
> You'd use it something like this:
> class IFoo(Interface):
> contributor = schema.Choice(
> Off the top of my head, your ContributorSource could be implemented
> something like this:
> class ContributorSource(BasicSourceFactory):
> def getValues(self):
> # assuming 'contributors' is a subfolder in your site...
> return grok.getSite()['contributors'].values()
> def getTitle(self, value):
> return value.name_attributge_of_contributor
I'm trying to get something similar, but as soon as I go to a form using the
schema, I get an error:
ComponentLookupError: ((<zc.sourcefactory.source.FactoredSource object at
0x0259BE10>, <zope.publisher.browser.BrowserRequest instance
Seems like he's looking for a ITerms implementation, but can't find one...
This is my code:
def getTitle(self, value):
target = schema.Choice(source=TargetSource(), title=u'Target',
description=u'The Target file this Candidate can be matched to')
View this message in context: http://www.nabble.com/Entity-Relations-and-Forms-tp19014121p21565938.html
Sent from the Grok mailing list archive at Nabble.com.
More information about the Grok-dev