Hey,<br><br>I think that you are looking for a Factory. <br><br>an example from `Web Component Development with Zope 3` book:<br><br>&nbsp;from zope.component.interfaces import IFactory<br>&nbsp;from zope.interface import implementedBy<br>
&nbsp;<br>&nbsp;class RecipeFactory:<br>&nbsp;&nbsp;&nbsp;&nbsp; implements(IFactory)<br>&nbsp;<br>&nbsp;&nbsp;&nbsp;&nbsp; title = u&quot;Create a new recipe&quot;<br>&nbsp;&nbsp;&nbsp;&nbsp; description = u&quot;This factory instantiates new recipes.&quot;<br><br>&nbsp;&nbsp;&nbsp;&nbsp; def __call__(self):<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; return Recipe()<br>
<br>&nbsp;&nbsp;&nbsp;&nbsp; def getInterfaces(self):<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; return implementedBy(Recipe)<br><br><br>&lt;utility<br>&nbsp;&nbsp;&nbsp; factory=&quot;.recipe.RecipeFactory&quot;<br>&nbsp;&nbsp;&nbsp; name=&quot;worldcookery.Recipe&quot;<br>&nbsp;&nbsp;&nbsp; permission=&quot;zope.Public&quot;<br>
/&gt;<br><br><br>$ bin/debugzope<br>&gt;&gt;&gt; from zope.component import getUtility<br>&gt;&gt;&gt; from zope.component.interfaces import IFactory<br>&gt;&gt;&gt; recipe_factory = getUtility(IFactory, u&quot;worldcookery.Recipe&quot;)<br>
&gt;&gt;&gt; weisswurst = recipe_factory()<br>&gt;&gt;&gt; weisswurst<br>&lt;worldcookery.recipe.Recipe object at 0x30469c30&gt;<br><br><br>I try this myself on grok using grok.GlobalUtility to define the Factory class and avoid the zcml, and works like a charm.<br>
<br>hope it helps<br><br>Regards<br><br><br><div class="gmail_quote">On Fri, Feb 6, 2009 at 12:38 PM, Sebastian Ware <span dir="ltr">&lt;<a href="mailto:sebastian@urbantalk.se">sebastian@urbantalk.se</a>&gt;</span> wrote:<br>
<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">If I have a string:<br>
<br>
 &nbsp; &quot;&lt;class &#39;trigger.promotion.Promotion&#39;&gt;&quot;<br>
<br>
can I create an object of the type [trigger.promotion.Promotion]?<br>
<br>
Mvh Sebastian<br>
<br>
<br>
<br>
_______________________________________________<br>
Grok-dev mailing list<br>
<a href="mailto:Grok-dev@zope.org">Grok-dev@zope.org</a><br>
<a href="http://mail.zope.org/mailman/listinfo/grok-dev" target="_blank">http://mail.zope.org/mailman/listinfo/grok-dev</a><br>
</blockquote></div><br><br clear="all"><br>-- <br>Santiago Videla<br><a href="http://www.revolucionesweb.com.ar">www.revolucionesweb.com.ar</a><br><a href="http://www.linkedin.com/in/svidela">http://www.linkedin.com/in/svidela</a><br>
<br>Sigue la mata dando de que hablar siempre abajo y a la izquierda donde el pensamiento que se hace corazón resplandece con la palabra sencilla y humilde que l@s tod@s somos.<br>