Re: can call script via url but not from script

Georges Racinet <[email protected]>
Newsgroups gmane.comp.web.zope.cps.devel
Message-ID <[email protected]>
Le 9 nov. 2006, à 22:10, Joachim Schmitz a écrit :

> In the port_root I have a ProxyFolder campus of portal_type University.
> In the University-Class I defined a routine to get a certain value.
>
> when I call this via the browser-url like so:
>
> http://www.test.de/srp/campus/getHallTitle?hall=xxx
>
> the correct title is returned.
>
> but when I call it in a script:
>
> context.portal_url.getPortalObject().campus.getHallTitle("xxx")
>
> I get an attribute error "getHallTitle"
>
> this works also in a script:
>
> context.restrictedTraverse("%s/campus/getHallTitle" % 
> (context.portal_url.getPortalPath()))("xxx")
>
> I consider this a little bit weird

If I remember correctly, proxies have indeed a bit of traversal magic 
that performs the (necessary) getContent.
I guess this is because we'd otherwise need to write a script for each 
method of the underlying object that has to be reachable through the 
web (cumbersome, bad for performance), although it's probably less used 
now than in early CPS3 days.

I agree that this blurs the lines between proxies and their content and 
surely doesn't help understanding them.

>
> -- 
> Gruß Joachim
>
>
>
> _______________________________________________
> cps-devel mailing list
> http://lists.nuxeo.com/mailman/listinfo/cps-devel
>

_______________________________________________
cps-devel mailing list
http://lists.nuxeo.com/mailman/listinfo/cps-devel
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.