Hello,
I have configured my zope site according to this doc:
http://www.zope.org/Members/Mamey/PHP
Which is a doc on how to run cgi’s within the zope site to maintain consistency across my site.
“Serve PHP/Perl within Zope”
I have the scripts running called “DirectToCGIContent” and “ServeCGIContent” similar to what the scripts recommend (my cgi’s are perl). I have installed a siteroot at the local directory ( user home dir) because I am only running Zope on port 80 and apache running on port 8080. My ultimate goal is to be able to run perl/cgi scripts inside zope with one look and feel across the site no matter if I am running cgi’s or zope.
I am running the latest ver of Plone , CMF – 1.3
If it matters I am running zope on Solaris 9.
Here are my scripts:
DirectToCGIContent script:
from string import join
def DirectToCGIContent ( self ):
if self.REQUEST.path:
# Build up a list of what is contained in self.REQUEST.path since
# you are going to redirect the user to /CGIContent/index_html. Start
# by adding the way you can access the CGI tree outside of Zope
originalRequestPath = ['http://24.x.x.x:8080/cgi-bin/']
# is the user asking for a cgi script?
if self.REQUEST.path[0][-5:] == '.cgi':
# pop paths of REQUEST.path until its empty
while self.REQUEST.path:
# Remember the path components before you pop them
originalRequestPath.append( self.REQUEST.path[-1] )
self.REQUEST.path.pop()
# Is there a query string being passed to the script also?
if self.REQUEST.environ['QUERY_STRING']:
originalRequestPath[ -1 ] = originalRequestPath[ -1 ] + '?' \
+ self.REQUEST.environ['QUERY_STRING']
# Create a full url to pass to index_html
cgiScript = join( originalRequestPath, '/' )
# self.REQUEST.path is now empty so the user is going to be
# directed to /CGIContent/index_html. That method needs to
# know what the original request is, so pass it a REQUEST
# variable
self.REQUEST.set('cgiScript', cgiScript)
# you also may want to redirect image requests to the CGI tree
elif self.REQUEST.path[0][-3:] in ['gif', 'png']:
while self.REQUEST.path:
originalRequestPath.append(self.REQUEST.path[-1])
self.REQUEST.path.pop()
# This is an image, so give it to a DTMLMethod that will
# just serve up images
self.REQUEST.path.append('ServeImageInCGITree')
self.REQUEST.set('imagePath', join(originalRequestPath, '/'))
ServeCGIContent script:
def ServeCGIContent(url="http://24.x.x.x:8080/cgi-bin/" , username=None , Passwor
d=None):
return Client.call (url,username,password)[1]
INDEX_HTML
<standard_html_header>
<dtml-if "REQUEST.has.key('cgiScript')">
< dtml-var "ServeCGIContent(REQUEST['cgiScript'])">
</dtml-if>
<standard_html_footer>
TRACEBACK ERROR section:
Traceback (innermost last):
File /usr/local/zope/lib/python/ZPublisher/Publish.py, line 150, in publish_module
File /usr/local/zope/lib/python/ZPublisher/Publish.py, line 114, in publish
File /usr/local/zope/lib/python/Zope/__init__.py, line 159, in zpublisher_exception_hook
(Object: CGIContent)
File /usr/local/zope/lib/python/ZPublisher/Publish.py, line 98, in publish
File /usr/local/zope/lib/python/ZPublisher/mapply.py, line 88, in mapply
(Object: index_html)
File /usr/local/zope/lib/python/ZPublisher/Publish.py, line 39, in call_object
(Object: index_html)
File /usr/local/zope/lib/python/OFS/DTMLDocument.py, line 127, in __call__
(Object: index_html)
File /usr/local/zope/lib/python/DocumentTemplate/DT_String.py, line 473, in __call__
(Object: index_html)
File /usr/local/zope/lib/python/DocumentTemplate/DT_Util.py, line 159, in eval
(Object: REQUEST.has.key('cgiScript'))
(Info: REQUEST)
File <string>, line 2, in f
File /usr/local/zope/lib/python/AccessControl/DTML.py, line 29, in guarded_getattr
(Object: index_html)
File /usr/local/zope/lib/python/AccessControl/ZopeGuards.py, line 47, in guarded_getattr
File /usr/local/zope/lib/python/ZPublisher/HTTPRequest.py, line 853, in __getattr__
AttributeError: (see above)
Z2.log output:
HTTP/1.1" 200 369 "http://24.x.x.x/custb/CGIContent/index_html" "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.0)"
INDEX.HTML-Source-output
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en-US"
lang="en-US">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>U-View - CGIContent</title>
<base href="http://24./custb/CGIContent/standard_error_message" />
<!-- Basic crude style for Netscape4.x - can be removed if you don't want to support
it. Site will still be viewable, but look a bit stripped :) -->
<link rel="Stylesheet" type="text/css"
href="http://24./custb/ploneBasicNS.css" />
<link rel="Stylesheet" type="text/css"
href="http://24./custb/ploneStructureNS.css" />
<link rel="Stylesheet" type="text/css"
href="http://24./custb/ploneWidgetsNS.css" />
<link rel="Stylesheet" type="text/css"
href="http://24./custb/ploneCalendarNS.css" />
<!-- Style sheets for CSS2 capable browsers (Mozilla, Opera, IE, Netscape6+, Konqueror etc. -->
<style type="text/css" media="all">
@import "http://24./custb/ploneBasic.css";
@import "http://24./custb/ploneStructure.css";
@import "http://24./custb/ploneWidgets.css";
@import "http://24./custb/ploneCalendar.css";
</style>
<!-- Style sheet used for printing -->
<link rel="stylesheet" type="text/css" media="print"
href="http://24./custb/plonePrint.css" />
<!-- Style sheet used for presentations (Opera is the only browser supporting this at the moment) -->
<link rel="stylesheet" type="text/css"
media="projection"
href="http://24./custb/plonePresentation.css" />
<meta http-equiv="imagetoolbar" content="no" /> <!-- Disable IE6 image toolbar -->
<!-- Consolidation of all javascript into 1 call -->
<meta http-equiv="pragma" content="no-cache" />
<script type="text/javascript"
src="http://24./custb/plone_javascripts.js"></script>
<script language='javascript' type='text/javascript' >
function formtooltip(el,flag){
elem = document.getElementById(el);
if (flag) {
elem.parentNode.parentNode.style.zIndex=1000;
elem.parentNode.parentNode.style.borderRight='0px solid #000';
// ugly , yes .. but neccesary to avoid a small but very annoying bug in IE6
elem.style.visibility='visible';
}
else {
elem.parentNode.parentNode.style.zIndex=1;
elem.parentNode.parentNode.style.border='none';
elem.style.visibility='hidden' };
}
</script>
</head>
<body>
<div>
<div class="top">
<div class="searchBox">
<form name="searchform"
action="http://24./custb/search">
<input id="searchGadget"
name="SearchableText" type="text"
size="20" />
<input class="context" type="submit" value="Search" />
</form>
</div>
<a href="http://24./custb">
<img src="http://24./custb/logo.png"
class="logo" alt="Plone" border="0" />
</a>
</div>
<hr size="" class="netscape4" />
<div class="tabs">
<a href="http://24./custb"
class="plain">
Welcome
</a>
<span class="netscape4">·</span>
<a href=" http://24./custb/news"
class="plain">
News
</a>
<span class="netscape4">·</span>
<a href=" http://24.2/custb/helpdesk/login"
class="plain">
Helpdesk
</a>
<span class="netscape4">·</span>
<a href=" http://24./custb/CGIContent/scan_results"
class="plain">
Scan Results
</a>
<span class="netscape4">·</span>
<a href=" http://24./custb/CGIContent/netstat"
class="plain">
Network Status
</a>
<span class="netscape4">·</span>
</div>
<div class="personalBar">
<span>you are not logged in</span>
<a href="http://24./custb/login_form">
<img src="http://24./custb/linkOpaque.gif"
alt=">" border="0" />
Login
</a>
<a href=" http://24./custb/join_form">
<img src="http://24./custb/linkOpaque.gif"
alt=">" border="0" />
Join
</a>
</div>
<hr size="" class="netscape4" />
<div class="pathBar">
You are here:
<span>
<a href="http://24.x.x.x/custb">home</a>
<strong> » </strong>
</span>
<span>
<strong>CGIContent</strong>
</span>
</div>
<hr size="" class="netscape4" />
</div>
<table class="columns">
<tbody>
<tr>
<td class="left">
<table class="box" summary="Navigation" cellpadding="0"
cellspacing="0">
<thead>
<tr><th>Navigation</th><th class="empty"> </th></tr>
</thead>
<tbody>
<tr class="odd">
<td colspan="2">
<strong>CGIContent</strong>
</td>
</tr>
<tr class="odd">
<td colspan="2">
<a href="http://24.x.x.x/custb">
<img src="http://24.x.x.x/custb/linkTransparent.gif"
alt=">" border="0" />
Up one level</a>
</td>
</tr>
</tbody>
</table>
</td>
<td class="main">
<div class="document">
<div>
<div>
<div>
<h1 i18n:translate="">Site error</h1>
<p i18n:translate="">
This site encountered an error trying to fulfill your request.
The errors were:
</p>
<div class="group">
<span class="legend" i18n:translate="">Error Details</span>
<div class="row">
<div class="label" i18n:id="error_type">
Error Type
</div>
<div class="field">AttributeError</div>
</div>
<div class="row">
<div class="label" i18n:id="error_message">
Error Message
</div>
<div class="field"></div>
</div>
<div class="row">
<div class="label" i18n:id="error_value">
Error Value
</div>
<div class="field">has</div>
</div>
</div>
</div>
</div>
</div>
</div>
</td>
</tr>
</tbody>
</table>
<hr size="" class="netscape4" />
<div class="footer">
Ltd. Copyright © 2001-2002. All rights reserved.<br />
<hr class="netscape4" />
<strong class="netscape4">
If you can read this text, it means you are not experiencing the U-View Portal design at its best.
</strong>
</div>
</body>
</html>
<PRE>
Traceback (innermost last):
File /usr/local/zope/lib/python/ZPublisher/Publish.py, line 150, in publish_module
File /usr/local/zope/lib/python/ZPublisher/Publish.py, line 114, in publish
File /usr/local/zope/lib/python/Zope/__init__.py, line 159, in zpublisher_exception_hook
(Object: CGIContent)
File /usr/local/zope/lib/python/ZPublisher/Publish.py, line 98, in publish
File /usr/local/zope/lib/python/ZPublisher/mapply.py, line 88, in mapply
(Object: index_html)
File /usr/local/zope/lib/python/ZPublisher/Publish.py, line 39, in call_object
(Object: index_html)
File /usr/local/zope/lib/python/OFS/DTMLDocument.py, line 127, in __call__
(Object: index_html)
File /usr/local/zope/lib/python/DocumentTemplate/DT_String.py, line 473, in __call__
(Object: index_html)
File /usr/local/zope/lib/python/DocumentTemplate/DT_Util.py, line 159, in eval
(Object: REQUEST.has.key('cgiScript'))
(Info: REQUEST)
File <string>, line 2, in f
File /usr/local/zope/lib/python/AccessControl/DTML.py, line 29, in guarded_getattr
(Object: index_html)
File /usr/local/zope/lib/python/AccessControl/ZopeGuards.py, line 47, in guarded_getattr
File /usr/local/zope/lib/python/ZPublisher/HTTPRequest.py, line 853, in __getattr__
AttributeError: (see above)
</PRE>
--0-432207886-1031631482=:16387--
The CGIContent redirects are what I want to happen , but all the scripts are not there yet , only one script is there from the portal menu.
Any help would be greatly appreciated!
Thanks,
Mark