[CPS-devel] can call script via url but not from script

Georges Racinet gracinet at nuxeo.com
Thu Nov 9 22:53:14 CET 2006


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
>




This list archive provided by Nuxeo, the leaders of open source ECM. Check out the Nuxeo 5 open source, standards-based ECM project.