[Zope] help with restrictedTraverse
    Ruben Montejano 
    rubemontejano at yahoo.com
       
    Wed Dec 10 17:24:44 EST 2003
    
    
  
Hi everybody,
 
   The task I am trying to accomplish is to be able to call an object(it could
be a dtml method, python script, php document, etc), given its path as a string
parameter.
   Let's say my directory structure looks like this:
/-+-Plone-+-homepage 
          +-reports-+-Site1 
                    +-Site2-+-myObject 
                    +-... 
          +-... 
 
    I need to call myObject, which path is '/Plone/reports/Site2/', from any
other directory within the directory structure, but at this time I'm using
homepage.
 
    Browsing the mailing list I found that I could use restrictedTraverse, so
I created an External Method getObject under the homepage directory with the
following code:
 
def getObject( self ):
    return self.restrictedTraverse('/Plone/reports/Site2/myObject')
myObject in this case is a php document that contains: 
<?php
include "http://2ksvr/ploneSupp/lines.php?wk=2002-06-01";
?>
 
Now using the External Method from the homepage's index_html:
<dtml-var getObject>
 
This is what I get, instead of the chart that this object displays:
<?php include "http://2ksvr/ploneSupp/lines.php?wk=2002-06-01"; ?>
 
I also tried creating a python script with the following code:
return container.restrictedTraverse('/Plone/pig_reports/test_farrowing/crChart')
 
but the script returns this:
<?php
include "http://2ksvr/ploneSupp/lines.php?wk=2002-06-01";
?>
What am I doing wrong? Any ideas or help is more than welcome.
Thanks,
 
       Ruben Montejano.
       email: rubemontejano at yahoo.com
----------------------------------------------------
Ruben Montejano.
phone: (309) 837-2318
email:   rubemontejano at yahoo.com
---------------------------------
Do you Yahoo!?
New Yahoo! Photos - easier uploading and sharing
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.zope.org/pipermail/zope/attachments/20031210/8d61215b/attachment.html
    
    
More information about the Zope
mailing list