[Zope3-dev] Re: ++etc++process doesn't work? [1/2 solved]

Markus Leist ml_zope3_dev at ikom-online.de
Sun Feb 27 01:43:25 EST 2005


Am Samstag, 26. Februar 2005 19:39 schrieb Derrick Hudson:
> On Sat, Feb 26, 2005 at 05:04:46PM +0100, Markus Leist wrote:
> | Am Freitag, 25. Februar 2005 15:54 schrieb Markus Leist:
> | > Ok, let's try to help by myself.
> | >
> | > What are good Tools to find such an error? Is there an Mini-FAQ of
> | > developing Zope3-Core?
> |
> | Ok, i've found doc/DEBUG.txt and "The Python Debugger"-chapter from
> | python.org.
> |
> | Is there any "Remote-Debug-API" and Client-Gui-Debugger or other
> | techniques for debugging Zope3 a bit more "comfortably" -
> | at the present moment i'm working with "printf"-debugging.
> |
> | Is there any "best-practice" example in debugging Zope3?
>
> I liberally sprinkle 'print's where I think they might be useful.
> If I want to interactively watch what's going on I put
> 'import pdb ; pdb.set_trace()' where I want to start watching.
>
> I don't know how well it would work with zope (I haven't tried) but
> there are one or two eclipse plugins that claim to have a python
> debugger :
>     http://pydev.sourceforge.net/
>     http://www.xored.com/trustudio
>
> -D

Ok, problem is solved,
but solution is "dirty":

in src/zope/app/traversing/browser/absoluteurl.py:

class AbsoluteURL(BrowserView):
    implements(IAbsoluteURL)
[...]
    def __str__(self):
        context = self.context
        request = self.request
[...]
(1)     if sameProxiedObjects(context, request.getVirtualHostRoot()):
            return request.getApplicationURL()

(2)    container = getattr(context, '__parent__', None)
        if container is None:
            raise TypeError, _insufficientContext

in our /etc/apache/ssl.conf:
[...]
RewriteRule ^(/?.*) http://localhost:8080/++vh++https:%{SERVER_ADDR}:443/++$1 [L,P]
[...]

there is no .../site/...-directory like the book-example, because 1 localsocket matches 1 https-socket -
(works well)

in case of normal use (http:...:8080) context is None and request.getVirtualHostRoot() is None, too.

in case of our https context is None and
request.getVirtualHostRoot(): <security proxied zope.app.location.location.Location instance at 0x408790ac>

in (2) there isn't a __parent__ -> raise TypeError

here my "dirty" hack:
Index: src/zope/app/traversing/browser/absoluteurl.py
===================================================================
--- src/zope/app/traversing/browser/absoluteurl.py      (revision 29319)
+++ src/zope/app/traversing/browser/absoluteurl.py      (working copy)
@@ -52,7 +52,8 @@
 
         container = getattr(context, '__parent__', None)
         if container is None:
-            raise TypeError, _insufficientContext
+            return request.getApplicationURL()    ## dirty hack by markus leist
+            #raise TypeError, _insufficientContext
 
         url = str(capi.getMultiAdapter((container, request),
                                        name='absolute_url'))


It would be better to change getVirtualHostRoot() if there is no parent?

hope this helps - Markus

p.s. I've checked out Komodo from ActiveState and used it with the remote-debugging-api;
nice tools.


More information about the Zope3-dev mailing list