[Grok-dev] Re: zc.sourcefactory

Philipp von Weitershausen philipp at weitershausen.de
Mon Sep 3 04:26:18 EDT 2007


On 3 Sep 2007, at 10:22 , Jan Ulrich Hasecke wrote:
> Am 31.08.2007 um 22:32 schrieb Philipp von Weitershausen:
>
>> A workaround would be to use a source (or vocabulary) where the  
>> value of can be different from the display item and the token used  
>> in forms. Christian already pointed out how to write a simple  
>> source with zc.sourcefactory.
>
> Is zc.sourcefactory a default part of grok?

Nope.

> I get an ImportError.
>     ImportError: No module named sourcefactory.basic
>
> If it is not installed by default, how do I install it? Are there  
> any howtos?

There aren't, but it'd be cool if someone could write one down.


Basically, by importing zc.sourcefactory in your code, you introduce  
a *dependency*. Dependencies are managed in setup.py. So edit  
setup.py and add 'zc.sourcefactory' to the install_requires list.  
Then run bin/buildout again. It will download and install  
zc.sourcefactory now.

This is, by the way, how all of the Zope packages are installed  
automatically. Your package depends on 'grok' and 'grok' depends on  
various 'zope.*' packages. buildout simply makes sure that all the  
dependencies are installed.



More information about the Grok-dev mailing list