This is the summary for test reports received on the zope-tests list between 2014-05-23 00:00:00 UTC and 2014-05-24 00:00:00 UTC: See the footnotes for test reports of unsuccessful builds. An up-to date view of the builders is also available in our buildbot documentation: http://docs.zope.org/zopetoolkit/process/buildbots.html#the-nightly-builds Reports received ---------------- Successful - zopetoolkit_trunk - Build # 648 winbot / ZODB_dev py_265_win32 winbot / ZODB_dev py_265_win64 winbot / ZODB_dev py_270_win32 winbot / ZODB_dev py_270_win64 winbot / ztk_10 py_254_win32 winbot / ztk_10 py_265_win32 winbot / ztk_10 py_265_win64 winbot / ztk_11 py_254_win32 winbot / ztk_11 py_265_win32 winbot / ztk_11 py_265_win64 winbot / ztk_11 py_270_win32 winbot / ztk_11 py_270_win64 Non-OK results --------------
Here is an extract from the principalannotation configure.zcml file. <adapter factory=".utility.annotations" /> <adapter for="zope.security.interfaces.IPrincipal *" factory=".utility.annotations" /> Clearly something is wrong. Two copies, and no "provides" line. So I tried fixing it. <adapter factory=".utility.annotations" provides="zope.annotation.interfaces.IAnnotations" for="zope.principalregistry.principalregistry.Principal" /> No luck. I still get the following error report. Cannot adapt. File "/root/.buildout/eggs/zope.app.container-3.9.2-py2.7.egg/zope/app/container/browser/contents.py", line 462, in getPrincipalClipboard annotations = IAnnotations(user) TypeError: ('Could not adapt', <zope.principalregistry.principalregistry.Principal object at 0x80bae03d0>, <InterfaceClass zope.annotation.interfaces.IAnnotations>) I am running the most recent release of grok, to which I added zope.principalannotation. I am trying to adapt the user object. (Pdb) user <zope.principalregistry.principalregistry.Principal object at 0x80bae03d0> Here is what I have tried so far. Maybe I am not installing it correctly. So I inserted a typo in the principalannotation configuration file, and sure enough I got an error report So let me see if the adapter is loaded. (Pdb) from zope.component import getGlobalSiteManager (Pdb) gsm = getGlobalSiteManager() (Pdb) gsm.adapters._adapters A long list is returned, but searching on zope.annotation.interfaces.IAnnotations gives me <implementedBy zope.principalregistry.principalregistry.Principal>: {<InterfaceClass zope.annotation.interfaces.IAnnotations\
: {u'': <function annotations at 0x80b983230>}},
Okay, so it is in the list of adapters, but getAdapter seems to have a problem. (Pdb) from zope.component import getAdapter (Pdb) from zope.annotation.interfaces import IAnnotations (Pdb) getAdapter(user,IAnnotations) *** ComponentLookupError: (<zope.principalregistry.principalregistry.Principal object at 0x80bae03d0>, <InterfaceClass zope.annotation.interfaces.IAnnotations>, u'') For those interested in the context, I am trying to put up a Zope 2 style ZMI on top of grok. For the cut copy paste interface, it needs to store the objects somewhere, presumably on the principal, but since principals are transient objects, the principal annotation package stores the data persistently. I am not sure what to try next. Any advice would be most appreciated. Christopher Lozinski
Hi Christopher, On 9 June 2014 16:29, Christopher Lozinski <lozinski@freerecruiting.com> wrote:
Here is an extract from the principalannotation configure.zcml file.
<adapter factory=".utility.annotations" />
<adapter for="zope.security.interfaces.IPrincipal *" factory=".utility.annotations" />
Clearly something is wrong. Two copies, and no "provides" line.
The <adapter /> element only needs the `for` and `provides` attributes if you want to give different values than the ones already declared on the factory, or if the factory doesn't have them. In the case of `.utility.annotations` those are, respectively: * zope.security.interfaces.IPrincipal * zope.annotation.interfaces.IAnnotations As can be seen here: https://github.com/zopefoundation/zope.principalannotation/blob/master/src/z... The second <adapter /> element creates a multi-adapter from (IPrincipal, Interface) to IAnnotations. So I tried fixing it.
<adapter factory=".utility.annotations" provides="zope.annotation.interfaces.IAnnotations" for="zope.principalregistry.principalregistry.Principal" />
No luck. I still get the following error report. Cannot adapt.
File "/root/.buildout/eggs/zope.app.container-3.9.2-py2.7.egg/ zope/app/container/browser/contents.py", line 462, in getPrincipalClipboard annotations = IAnnotations(user) TypeError: ('Could not adapt', <zope.principalregistry.principalregistry.Principal object at 0x80bae03d0>, <InterfaceClass zope.annotation.interfaces. IAnnotations>)
I am running the most recent release of grok, to which I added
zope.principalannotation.
I am trying to adapt the user object. (Pdb) user <zope.principalregistry.principalregistry.Principal object at 0x80bae03d0>
Here is what I have tried so far.
Maybe I am not installing it correctly. So I inserted a typo in the principalannotation configuration file, and sure enough I got an error report
So let me see if the adapter is loaded.
(Pdb) from zope.component import getGlobalSiteManager (Pdb) gsm = getGlobalSiteManager() (Pdb) gsm.adapters._adapters
A long list is returned, but searching on zope.annotation.interfaces.IAnnotations gives me
<implementedBy zope.principalregistry.principalregistry.Principal>: {<InterfaceClass zope.annotation.interfaces.IAnnotations\
: {u'': <function annotations at 0x80b983230>}},
Okay, so it is in the list of adapters, but getAdapter seems to have a problem.
(Pdb) from zope.component import getAdapter (Pdb) from zope.annotation.interfaces import IAnnotations
(Pdb) getAdapter(user,IAnnotations) *** ComponentLookupError: (<zope.principalregistry.principalregistry.Principal object at 0x80bae03d0>, <InterfaceClass zope.annotation.interfaces.IAnnotations>, u'')
In the code I linked above, the adapter factory tries to look up a `IPrincipalAnnotationUtility` (while ignoring the context parameter, which is bad form, but likely not the cause of your troubles). Maybe you're getting the adaptation error because you don't have an `IPrincipalAnnotationUtilty` utility?
For those interested in the context, I am trying to put up a Zope 2 style ZMI on top of grok. For the cut copy paste interface, it needs to store the objects somewhere, presumably on the principal, but since principals are transient objects, the principal annotation package stores the data persistently.
I am not sure what to try next. Any advice would be most appreciated.
For this immediate problem, perhaps you need to register an `IPrincipalAnnotationUtility`. The file I linked above contains a persistent implementation, suitable registration on a local site manager. "persistent" means it won't be there by default until you actually register it. For the more generic problem of a Zope2 like management interface on top of ZODB storage containing a copy+paste implementation, done on modern libraries (including a zca registry), you could try SubstanceD: http://substanced.readthedocs.org/ Cheers, Leo
Christopher Lozinski
_______________________________________________ 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 )
Thanks for the brilliant answer. I am now able to display a rudimentary zope.container view.
Maybe you're getting the adaptation error because you don't have an `IPrincipalAnnotationUtilty` utility?
That was indeed the problem. I was looking in the wrong place. Of course it still needed the Grok infrastructure to register the utility. And then to do the following adaptation. return IPrincipalClipboard(principalAnnotations) But altogether not that difficult. What is interesting is how much easier Grok makes ZTK development. I highly recommend Grok to all concerned.
For the more generic problem of a Zope2 like management interface on top of ZODB storage containing a copy+paste implementation, done on modern libraries (including a zca registry), you could try SubstanceD:
Thank you for the pointer. Lots of great stuff over there. I will take a much closer look. Although it is not targeted at TTW development, it is more for administrative use. So again thank you for the help. I was quite stuck, and am now back to making progress.
participants (3)
-
Christopher Lozinski -
Leonardo Rochael Almeida -
Zope tests summarizer