[Zope] php header() equivalent in zope, translation please

Chris Withers chris at simplistix.co.uk
Wed Sep 7 03:59:38 EDT 2005


Ed Colmar wrote:
> if (!(strpos($HTTP_USER_AGENT,"EVE-minibrowser")===false))
> {
> if ($HTTP_SERVER_VARS["HTTP_EVE_TRUSTED"]=="no")
> {
> header("|eve.trustme:|http://www.mywebsite.net/::please| allow me to 
> access your pilot information.|");
> }
> else
> {
> ?>
> <b>Pilot:</b>
> <? echo |$HTTP_SERVER_VARS[“|HTTP_EVE_CHARNAME”]; ?>
> <b>Location:</b>
> <? echo |$HTTP_SERVER_VARS[“|HTTP_EVE_REGIONNAME”]; ?>/<?
> echo $|HTTP_SERVER_VARS[“|HTTP_EVE_CONSTELLATIONNAME”]; ?>/<?
> echo |$HTTP_SERVER_VARS[“|HTTP_EVE_SOLARSYSTEMNAME”]; ?><BR>
> <?
> if (|$HTTP_SERVER_VARS[“|HTTP_EVE_STATIONNAME”] != "None")
> {
> ?>
> <b>Station:</b> <? echo |$HTTP_SERVER_VARS[“|HTTP_EVE_STATIONNAME”]; ?><br>

Don't speak PHP (puh! ;-) but here's a guess from a python script:

r = context.REQUEST
if r.get('HTTP_USER_AGENT')=="EVE-minibrowser":
     if r.get('HTTP_EVE_TRUSTED')=='no':
        r.RESPONSE.setHeader(
           'eve.trustme',
           'http://www.mywebsite.net/::please| allow me to access your
pilot information.'
           )
else:
     character_name = r.get('HTTP_EVE_CHARNAME')
     # etc
print character_name
# etc
return printed

cheers,

Chris

-- 
Simplistix - Content Management, Zope & Python Consulting
            - http://www.simplistix.co.uk



More information about the Zope mailing list