Re: [Zope3-Users] Trouble with Skins
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Hi Herman, thank you very much for your answer. > However, this case shows me that I'm not the only one with such problems. > These ComponentLookupErrors and cryptic tracebacks (at least for newbies) > drove me mad and costed me hours to resolve. In the end it was always "my > fault", e.g.: > > - Forgot to add the appropriate layer to the request > - Forgot to omit __parent__ in my formlib class > - Forgot to register something or registered it for the wrong interface You were completely right. The problem was an absent comma in standardmacros.py and an incorrect closed -tag. [1] > I'm curious how others deal with this problem because I'm often paralyzed by > this ComponentLookupError. The traceback also does not show which interface > my objects provide - for example it cannot be seen if a BrowserRequest > provides a specific layer or not. To solve this problem, I had to insert > something like "print IMyLayer.providedBy(request)" into the Zope source to > find out what happens. Phillip von Weitershausen had a great talk at the DZUG conference this year about "Zope on a Paste"[2]. He demonstrated some kind of middleware that does what you asked for - giving you the possibility to look into every object in the moment the error occurred. I wonder if a tool like this will find it's way to the ordinary Zope3 user. Phillip? > Maybe a Zope3 "newbie-debug"-mode would help a lot that throws a traceback > like this (regarding to the original problem)? > > > ... Original Traceback ... > --- Verbose Traceback --- > ... I'm completely with you at this point. When I came to the point to solve a problem based on a traceback for the first time, I was stuck. Even when I solved those problems in the past, I often couldn't find a hint in the traceback retroactively, even with knowing the actual problem. I often thought about something like you suggested - a kinda comfort traceback. One of the advantages of a CMS-like system like Zope is, that you don't have to care about the entire machine that is working in the background behind your application. But from the moment on you get the error, you are forced to deal with the traceback that gives you lots of information on parts of this machine you don't really want to deal with. As I mentioned, I'm loosely thinking about this kinda comfort traceback for months, but I don't really think that my understanding of the Zope3 machine is deep enough to do this on my own. Perhaps there should be a draft or some kind of feature request thrown to the Zope3-dev list to exchange opinions with the developers. Regards, Arne - - [1] For those, who deal with the same error: - - I forgot to type the comma in the value of the attribute 'macro_pages' of zope.app.basicskin.standardmacros.StandardMacros (see example 10.3.2 in Phillip's book "Web Component Development With Zope3", 2nd Edition) - - I falsely closed a -tag with instead of in my custom page macro. [2] http://www.zope.de/redaktion/dzug/tagung/potsdam-2007/folien/zope-on-a-paste.pdf -BEGIN PGP SIGNATURE- Version: GnuPG v1.4.6 (GNU/Linux) iD8DBQFGgj+5RawDj1XqbtwRAg1nAJ4sru+DtJXqF+r+hw3ESJpPslMYlACbBFnd 49eUvBiLeIj7sAMvdGJpwVw= =c7AO -END PGP SIGNATURE- ___ Zope3-users mailing list Zope3-users@zope.org http://mail.zope.org/mailman/listinfo/zope3-users
Re: [Zope3-Users] Trouble with Skins
Am Dienstag, 26. Juni 2007 12:43 schrieb Arne Nordmann: > Hi, > > I tried to create my own skin for a website of mine. I used Phillip's > book (2nd version) and tried to do everything analog (just different > names and a slightly different file structure). > > If I call a test view (registered for IRootFolder) with the skin I get > the following error: > > ComponentLookupError: (( 0x886916c>, URL=http://localhost:9673/++skin++norro/test>), zope.interface.Interface>, 'h') > > (Full traceback attached) > > I don't know what this traceback wants to say. I'm wondering about the > value of the name-parameter that seems to be 'h' in this case. Where > does this 'h' come from? I really don't know where to look at. Looking at the traceback, it seems that the lookup error is happening here: File "/usr/lib/python2.4/site-packages/zope/app/basicskin/standardmacros.py", line 41, in __getitem__ page = getMultiAdapter((context, request), name=name) And above there's this: - Warning: Macro expansion failed - Warning: zope.component.interfaces.ComponentLookupError: ((, http://localhost:9673/++skin++norro/test>), , 'h') So it seems it's some macro-related problem, perhaps you check the metal:define-macro/metal:use-macro definitions. However, this case shows me that I'm not the only one with such problems. These ComponentLookupErrors and cryptic tracebacks (at least for newbies) drove me mad and costed me hours to resolve. In the end it was always "my fault", e.g.: - Forgot to add the appropriate layer to the request - Forgot to omit __parent__ in my formlib class - Forgot to register something or registered it for the wrong interface I'm curious how others deal with this problem because I'm often paralyzed by this ComponentLookupError. The traceback also does not show which interface my objects provide - for example it cannot be seen if a BrowserRequest provides a specific layer or not. To solve this problem, I had to insert something like "print IMyLayer.providedBy(request)" into the Zope source to find out what happens. Maybe a Zope3 "newbie-debug"-mode would help a lot that throws a traceback like this (regarding to the original problem)? ... Original Traceback ... --- Verbose Traceback --- A query for a named adapter adapting from the object(s): - (providing IFolder) - http://localhost:9673/++skin++norro/test> (providing IBrowserRequest) to the interface: - With the adapter name 'h' could not be found. Helpful tips how to resolve this are given at http://zope3faq.org/123 Best Regards, Hermann -- [EMAIL PROTECTED] GPG key ID: 299893C7 (on keyservers) FP: 0124 2584 8809 EF2A DBF9 4902 64B4 D16B 2998 93C7 ___ Zope3-users mailing list Zope3-users@zope.org http://mail.zope.org/mailman/listinfo/zope3-users
[Zope3-Users] Trouble with Skins
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Hi, I tried to create my own skin for a website of mine. I used Phillip's book (2nd version) and tried to do everything analog (just different names and a slightly different file structure). If I call a test view (registered for IRootFolder) with the skin I get the following error: ComponentLookupError: ((, http://localhost:9673/++skin++norro/test>), , 'h') (Full traceback attached) I don't know what this traceback wants to say. I'm wondering about the value of the name-parameter that seems to be 'h' in this case. Where does this 'h' come from? I really don't know where to look at. I would appreciate every hint on what's going on here or where to look for the error. Thanks in advance, Arne PS: Using Zope 3.4 and Python 2.4 -BEGIN PGP SIGNATURE- Version: GnuPG v1.4.6 (GNU/Linux) iD8DBQFGgO3kRawDj1XqbtwRAgx2AJ4/xyFR/mB4KIcfEfVHQANj3HE96gCeNUyW cOdTYjKurokuileJgE5gpf0= =qtZD -END PGP SIGNATURE- -- 2007-06-26T12:30:33 ERROR SiteError http://localhost:9673/++skin++norro/test Traceback (most recent call last): File "/usr/lib/python2.4/site-packages/zope/publisher/publish.py", line 133, in publish result = publication.callObject(request, obj) File "/usr/lib/python2.4/site-packages/zope/app/publication/zopepublication.py", line 161, in callObject return mapply(ob, request.getPositionalArguments(), request) File "/usr/lib/python2.4/site-packages/zope/publisher/publish.py", line 108, in mapply return debug_call(obj, args) - __traceback_info__: File "/usr/lib/python2.4/site-packages/zope/publisher/publish.py", line 114, in debug_call return obj(*args) File "/usr/lib/python2.4/site-packages/zope/app/pagetemplate/viewpagetemplatefile.py", line 83, in __call__ return self.im_func(im_self, *args, **kw) File "/usr/lib/python2.4/site-packages/zope/app/pagetemplate/viewpagetemplatefile.py", line 51, in __call__ sourceAnnotations=getattr(debug_flags, 'sourceAnnotations', 0), File "/usr/lib/python2.4/site-packages/zope/pagetemplate/pagetemplate.py", line 117, in pt_render strictinsert=0, sourceAnnotations=sourceAnnotations)() - Warning: Macro expansion failed - Warning: zope.component.interfaces.ComponentLookupError: ((, http://localhost:9673/++skin++norro/test>), , 'h') File "/usr/lib/python2.4/site-packages/zope/tal/talinterpreter.py", line 271, in __call__ self.interpret(self.program) File "/usr/lib/python2.4/site-packages/zope/tal/talinterpreter.py", line 346, in interpret handlers[opcode](self, args) File "/usr/lib/python2.4/site-packages/zope/tal/talinterpreter.py", line 870, in do_useMacro macro = self.engine.evaluateMacro(macroExpr) File "/usr/lib/python2.4/site-packages/zope/tales/tales.py", line 696, in evaluate return expression(self) - /var/www/zope_hp/lib/python/hp/browser/test.pt - Line 1, Column 0 - Expression: - Names: {'args': (), 'context': , 'default': , 'loop': {}, 'nothing': None, 'options': {}, 'repeat': {}, 'request': http://localhost:9673/++skin++norro/test>, 'template': , 'usage': , 'view': , 'views': } File "/usr/lib/python2.4/site-packages/zope/tales/expressions.py", line 217, in __call__ return self._eval(econtext) File "/usr/lib/python2.4/site-packages/zope/tales/expressions.py", line 194, in _eval ob = self._subexprs[-1](econtext) File "/usr/lib/python2.4/site-packages/zope/tales/expressions.py", line 124, in _eval ob = self._traverser(ob, element, econtext) File "/usr/lib/python2.4/site-packages/zope/app/pagetemplate/engine.py", line 68, in __call__ request=request) File "/usr/lib/python2.4/site-packages/zope/traversing/adapters.py", line 164, in traversePathElement return traversable.traverse(nm, further_path) - __traceback_info__: (, 'page') File "/usr/lib/python2.4/site-packages/zope/traversing/adapters.py", line 49, in traverse return subject[name] - __traceback_info__: (, 'page', []) File "/usr/lib/python2.4/site-packages/zope/app/basicskin/standardmacros.py", line 41, in __getitem__ page = getMultiAdapter((context, request), name=name) File "/usr/lib/python2.4/site-packages/zope/component/_api.py", line 103, in getMultiAdapter raise ComponentLookupError(objects, interface, name) ComponentLookupError: ((, http://localhost:9673/++skin++norro/test>), , 'h') ___ Zope3-users mailing list Zope3-users@zope.org http://mail.zope.org/mailman/listinfo/zope3-users