Re: [Zope-dev] Fun with vocabularies
Am 07.10.2010, 14:50 Uhr, schrieb Charlie Clark : > Thanks for the tip. For a vocabulary it has to provide IBaseVocabulary as > well, although I guess I can just define a source. Unfortunately I'm > getting now getting an AssertionError when the widgets are setup but I > now > know where to look. Just for the archives def my_source(context): ... return SimpleVocabulary() directlyProvides(my_source, IContextSourceBinder) works fine with class IMySchema(Interface): choices=Choice( source=my_source ) NB. that you must use "source" and not "vocabulary" for this to work. Charlie -- Charlie Clark Managing Director Clark Consulting & Research German Office Helmholtzstr. 20 Düsseldorf D- 40215 Tel: +49-211-600-3657 Mobile: +49-178-782-6226 ___ Zope-Dev maillist - Zope-Dev@zope.org https://mail.zope.org/mailman/listinfo/zope-dev ** No cross posts or HTML encoding! ** (Related lists - https://mail.zope.org/mailman/listinfo/zope-announce https://mail.zope.org/mailman/listinfo/zope )
Re: [Zope-dev] Fun with vocabularies
Am 07.10.2010, 14:58 Uhr, schrieb Fred Drake : > Interestingly, I can't find anything that suggests "consolidation" by > searching that page for "mail" or "list". Was that what > "IRC/mailinglist rationalisation" means? Yes, that's the one. Charlie -- Charlie Clark Managing Director Clark Consulting & Research German Office Helmholtzstr. 20 Düsseldorf D- 40215 Tel: +49-211-600-3657 Mobile: +49-178-782-6226 ___ Zope-Dev maillist - Zope-Dev@zope.org https://mail.zope.org/mailman/listinfo/zope-dev ** No cross posts or HTML encoding! ** (Related lists - https://mail.zope.org/mailman/listinfo/zope-announce https://mail.zope.org/mailman/listinfo/zope )
Re: [Zope-dev] Fun with vocabularies
On Thu, Oct 7, 2010 at 8:45 AM, Charlie Clark wrote: > This was the suggestion at the summit: > http://wiki.zope.org/ztk/ZopeSummit2010Summary Interestingly, I can't find anything that suggests "consolidation" by searching that page for "mail" or "list". Was that what "IRC/mailinglist rationalisation" means? -Fred -- Fred L. Drake, Jr. "A storm broke loose in my mind." --Albert Einstein ___ Zope-Dev maillist - Zope-Dev@zope.org https://mail.zope.org/mailman/listinfo/zope-dev ** No cross posts or HTML encoding! ** (Related lists - https://mail.zope.org/mailman/listinfo/zope-announce https://mail.zope.org/mailman/listinfo/zope )
Re: [Zope-dev] Fun with vocabularies
Am 07.10.2010, 14:34 Uhr, schrieb Fred Drake : > Have you tried using a callable that provides > zope.schema.interfaces.IContextSourceBinder? > Looking at the code in 3.7.0 (the newest zope.schema in my egg cache), > that should work out of the box. Thanks for the tip. For a vocabulary it has to provide IBaseVocabulary as well, although I guess I can just define a source. Unfortunately I'm getting now getting an AssertionError when the widgets are setup but I now know where to look. Charlie -- Charlie Clark Managing Director Clark Consulting & Research German Office Helmholtzstr. 20 Düsseldorf D- 40215 Tel: +49-211-600-3657 Mobile: +49-178-782-6226 ___ Zope-Dev maillist - Zope-Dev@zope.org https://mail.zope.org/mailman/listinfo/zope-dev ** No cross posts or HTML encoding! ** (Related lists - https://mail.zope.org/mailman/listinfo/zope-announce https://mail.zope.org/mailman/listinfo/zope )
Re: [Zope-dev] Fun with vocabularies
Am 07.10.2010, 14:38 Uhr, schrieb Fred Drake : > Another consolidation? We already tossed the zope3-dev list. This was the suggestion at the summit: http://wiki.zope.org/ztk/ZopeSummit2010Summary Charlie -- Charlie Clark Managing Director Clark Consulting & Research German Office Helmholtzstr. 20 Düsseldorf D- 40215 Tel: +49-211-600-3657 Mobile: +49-178-782-6226 ___ Zope-Dev maillist - Zope-Dev@zope.org https://mail.zope.org/mailman/listinfo/zope-dev ** No cross posts or HTML encoding! ** (Related lists - https://mail.zope.org/mailman/listinfo/zope-announce https://mail.zope.org/mailman/listinfo/zope )
Re: [Zope-dev] Fun with vocabularies
On Thu, Oct 7, 2010 at 8:35 AM, Charlie Clark wrote: > I thought we were consolidating the mailing lists? It is a developer's > rather than a user's question but I would agree not related to ZTK > development. Another consolidation? We already tossed the zope3-dev list. -Fred -- Fred L. Drake, Jr. "A storm broke loose in my mind." --Albert Einstein ___ Zope-Dev maillist - Zope-Dev@zope.org https://mail.zope.org/mailman/listinfo/zope-dev ** No cross posts or HTML encoding! ** (Related lists - https://mail.zope.org/mailman/listinfo/zope-announce https://mail.zope.org/mailman/listinfo/zope )
Re: [Zope-dev] Fun with vocabularies
Am 07.10.2010, 14:31 Uhr, schrieb Hanno Schlichting : > No offense, None taken. > but isn't this a question for a users mailing list? It's > not really about developing Zope itself, but developing with Zope > isn't it? I thought we were consolidating the mailing lists? It is a developer's rather than a user's question but I would agree not related to ZTK development. Charlie -- Charlie Clark Managing Director Clark Consulting & Research German Office Helmholtzstr. 20 Düsseldorf D- 40215 Tel: +49-211-600-3657 Mobile: +49-178-782-6226 ___ Zope-Dev maillist - Zope-Dev@zope.org https://mail.zope.org/mailman/listinfo/zope-dev ** No cross posts or HTML encoding! ** (Related lists - https://mail.zope.org/mailman/listinfo/zope-announce https://mail.zope.org/mailman/listinfo/zope )
Re: [Zope-dev] Fun with vocabularies
On Thu, Oct 7, 2010 at 8:21 AM, Charlie Clark wrote: > I was wondering whether it's possible to use callables for schema > vocabularies without registering them first? ... > I'm sure it should be possible but my weak and feeble brain has somehow > failed to solve the puzzle! Have you tried using a callable that provides zope.schema.interfaces.IContextSourceBinder? Looking at the code in 3.7.0 (the newest zope.schema in my egg cache), that should work out of the box. -Fred -- Fred L. Drake, Jr. "A storm broke loose in my mind." --Albert Einstein ___ Zope-Dev maillist - Zope-Dev@zope.org https://mail.zope.org/mailman/listinfo/zope-dev ** No cross posts or HTML encoding! ** (Related lists - https://mail.zope.org/mailman/listinfo/zope-announce https://mail.zope.org/mailman/listinfo/zope )
Re: [Zope-dev] Fun with vocabularies
Hi. On Thu, Oct 7, 2010 at 2:21 PM, Charlie Clark wrote: > I was wondering whether it's possible to use callables for schema > vocabularies without registering them first? No offense, but isn't this a question for a users mailing list? It's not really about developing Zope itself, but developing with Zope isn't it? Hanno ___ Zope-Dev maillist - Zope-Dev@zope.org https://mail.zope.org/mailman/listinfo/zope-dev ** No cross posts or HTML encoding! ** (Related lists - https://mail.zope.org/mailman/listinfo/zope-announce https://mail.zope.org/mailman/listinfo/zope )
[Zope-dev] Fun with vocabularies
Hi, I was wondering whether it's possible to use callables for schema vocabularies without registering them first? ie. def my_vocab(context): while some_constraint: yield zope.schema.SimpleTerm() alsoProvides(my_vocab, zope.schema.interfacesIBaseVocabulary) class IMySchema(Interface): value = Choice( vocabulary=my_vocab ) I'm sure it should be possible but my weak and feeble brain has somehow failed to solve the puzzle! On a similar note: how should I handle i18n message objects that are the title of a SimpleTerm? At least in zope.formlib this leads to a rendering error because: "AttributeError: 'MessageFactory' object has no attribute 'replace'" Thanks for any pointers. Charlie -- Charlie Clark Managing Director Clark Consulting & Research German Office Helmholtzstr. 20 Düsseldorf D- 40215 Tel: +49-211-600-3657 Mobile: +49-178-782-6226 ___ Zope-Dev maillist - Zope-Dev@zope.org https://mail.zope.org/mailman/listinfo/zope-dev ** No cross posts or HTML encoding! ** (Related lists - https://mail.zope.org/mailman/listinfo/zope-announce https://mail.zope.org/mailman/listinfo/zope )