title: Problem with a local utility used as a dependency in a product
body: <p>Here's the problem. I have <code>mynamespace.mypackage</code> that has as a dependency <code>mynamespace.mydependencypackage</code>, that is a <a href="http://plone.org/documentation/manual/plone-community-developer-documentation/components/utilities" rel="nofollow">local utility</a>. It's registered using <a href="http://plone.org/documentation/manual/developer-manual/generic-setup/reference/component-registry" rel="nofollow">component registry</a>.</p>
  
  <p>In <code>config.py</code> from <code>mynamespace.mypackage</code>, I have </p>
  
  <pre><code>DEPENDENCIES = ['mynamespace.mydependencypackage']
  </code></pre>
  
  <p>And in my <code>mynamespace.mypackage</code>'s <code>setuphandlers.py</code> this dependency is installed if not already installed.</p>
  
  <p>Problem is: if I reinstall <code>mynamespace.mypackage</code> through <code>ZMI</code>, everything seems to perfectly install (since no errors are shown) but I keep getting a <code>ComponentLookupError</code> when using methods in <code>mynamespace.mypackage</code> that gets the utility:</p>
  
  <pre><code>Module zope.component._api, line 207, in getUtility
  ComponentLookupError: (&lt;InterfaceClass MY_UTILITY_INTERFACE, '')
  </code></pre>
  
  <p>I can 'fix' this problem, by reinstalling the <code>mynamespace.mydependencypackage</code> in my <code>setuphandlers.py</code> or through the ZMI as well when reinstalling <code>mynamespace.mypackage</code>, but this doesn't seem the best solution for me.</p>
  
  <p>What am I missing about Generic Setup here? I didn't make this utility persist any value on ZODB whatsoever. I can just forget about all these problems and create a <code>BrowserView</code> with utilities methods, but I want to understand first why am I having these problems.</p>
  
  <p><strong>EDIT</strong>: Now, I have a bigger problem. The <code>TypeError: ('object.__new__(MyClass) is not safe, use Persistence.Persistent.__new__()', &lt;function _reconstructor at 0xb7783e9c&gt;, (&lt;class 'mynamespace.mydependencypackage.package.MyClass'&gt;, &lt;type 'object'&gt;, None))</code> is being shown. Full traceback:</p>
  
  <pre><code>Traceback (innermost last):
    Module ZPublisher.Publish, line 110, in publish
    Module ZPublisher.BaseRequest, line 429, in traverse
    Module ZPublisher.BeforeTraverse, line 99, in __call__
    Module Products.CMFCore.PortalObject, line 94, in __before_publishing_traverse__
    Module zope.event, line 23, in notify
    Module zope.component.event, line 26, in dispatch
    Module zope.component._api, line 130, in subscribers
    Module zope.component.registry, line 290, in subscribers
    Module zope.interface.adapter, line 535, in subscribers
    Module zope.component.event, line 33, in objectEventNotify
    Module zope.component._api, line 130, in subscribers
    Module zope.component.registry, line 290, in subscribers
    Module zope.interface.adapter, line 535, in subscribers
    Module zope.app.component.site, line 375, in threadSiteSubscriber
    Module zope.app.component.hooks, line 61, in setSite
    Module Products.CMFCore.PortalObject, line 75, in getSiteManager
    Module ZODB.Connection, line 761, in setstate
    Module ZODB.Connection, line 819, in _setstate
    Module ZODB.serialize, line 604, in setGhostState
    Module ZODB.serialize, line 597, in getState
    Module copy_reg, line 48, in _reconstructor
  TypeError: ('object.__new__(MyClass) is not safe, use Persistence.Persistent.__new__()', &lt;function _reconstructor at 0xb7783e9c&gt;, (&lt;class 'mynamespace.mydependencypackage.package.MyClass'&gt;, &lt;type 'object'&gt;, None))
  </code></pre>