[Zope] How to get the variable in an URL ?

Pascal Samuzeau samuzeau@oreka.com
Wed, 24 Apr 2002 13:34:35 +0100


Hi,                                                                   
                                                                      
Because you don't believe me here is :                                
                                                                      
1 - When I have <dtml-var "REQUEST['variable']">, I get :             
                                                                      
Type de l'erreur : KeyError                                           
Valeur de l'erreur : variable                                         
                                                                      
Traceback (innermost last):                                           
  File zope/lib/python/ZPublisher/Publish.py, line 223, in            
publish_module                                                        
  File zope/lib/python/ZPublisher/Publish.py, line 187, in publish    
  File zope/lib/python/Zope/__init__.py, line 226, in                 
zpublisher_exception_hook                                             
    (Object: cerf)                                                    
  File zope/lib/python/ZPublisher/Publish.py, line 171, in publish    
  File zope/lib/python/ZPublisher/mapply.py, line 160, in mapply      
    (Object: CasCatalog)                                              
  File zope/lib/python/ZPublisher/Publish.py, line 112, in            
call_object                                                           
    (Object: CasCatalog)                                              
  File zope/lib/python/OFS/DTMLMethod.py, line 199, in __call__       
    (Object: CasCatalog)                                              
  File zope/python/DocumentTemplate/DT_String.py, line 546, in        
__call__                                                              
    (Object: CasCatalog)                                              
  File zope/lib/python/DocumentTemplate/DT_Util.py, line 231, in      
eval                                                                  
    (Object: REQUEST['variable'])                                     
    (Info: REQUEST)                                                   
  File <string>, line 2, in f                                         
    (Object: guarded_getitem)                                         
  File zope/lib/python/AccessControl/DTML.py, line 104, in            
guarded_getitem                                                       
    (Object: CasCatalog)                                              
  File zope/lib/python/AccessControl/ZopeGuards.py, line 151, in      
guarded_getitem                                                       
  File zope/lib/python/ZPublisher/HTTPRequest.py, line 897, in        
__getitem__                                                           
KeyError: (see above)                                                 
                                                                      
2 -  When I have <dtml-var "REQUEST">, I get :                        
                                                                      
form                                                                  
                                                                      
cookies                                                               
                                                                      
__ac_name	'Samuzeau'                                                  
tree-s	'wYAACp-A7U'                                                   
                                                                      
other                                                                 
AUTHENTICATION_PATH	'xxxxx'                                           
__ac_name	'Samuzeau'                                                  
                                                                      
SERVER_URL	'http://www.xxxxx:8080'                                    
tree-s	'p-A7U'                                                        
URL	'http://www.xxxxx:8080/cerf/CasCatalog'                           
AUTHENTICATED_USER	Samuzeau                                           
PUBLISHED	<DTMLMethod instance at 00000>                              
TraversalRequestNameStack	[]                                          
URL0	http://www.xxxxx:8080/cerf/CasCatalog                            
URL1	http://www.xxxxx:8080/cerf                                       
URL2	http://www.xxxxx.fr:8080                                         
BASE0	http://www.xxxxx.fr:8080                                        
BASE1	http://www.xxxxx.fr:8080                                        
BASE2	http://www.xxxxx:8080/cerf                                      
BASE3	http://www.xxxxx:8080/cerf/CasCatalog                           
                                                                      
environ                                                               
GATEWAY_INTERFACE	'CGI/1.1'                                           
SERVER_PORT	'8080'                                                    
PATH_TRANSLATED	'/cerf/CasCatalog'                                    
HTTP_VIA	'1.0 xxxx'                                                   
HTTP_ACCEPT_LANGUAGE	'fr'                                             
REMOTE_ADDR	'xxxxx'                                                   
SERVER_NAME	'xxxxx'                                                   
HTTP_USER_AGENT	'xxx(xxx;xxx; xxx)'                                   
HTTP_ACCEPT	'*/*'                                                     
channel.creation_time	1019651567                                      
HTTP_UA_CPU	'PPC'                                                     
HTTP_EXTENSION	'Security/Remote-Passphrase'                           
SERVER_PROTOCOL	'HTTP/1.0'                                            
PATH_INFO	'/cerf/CasCatalog'                                          
HTTP_HOST	'www.....'                                                  
REQUEST_METHOD	'GET'                                                  
HTTP_IF_MODIFIED_SINCE	'Wed, 24 Apr 2002 12:00:48 GMT'                
SCRIPT_NAME	''                                                        
SERVER_SOFTWARE	'Zope/(Zope 2.4.3 (binary release, python             
2.1, x), python 2.1.0, os) ZServer/1.1b1'                             
HTTP_COOKIE	'__ac_name=Samuzeau;                                      
count.999552017.318.counter=1; tree-s=-A7U'                           
HTTP_UA_OS	'MacOS'                                                    
                                                                      
As you can see, there is nothing in the form paragraph. So            
nothing I am able to catch...                                         
                                                                      
Have you any idea ?                                                   
                                                                      
                                                                      
Sincerily                                                             
PS                                                                    
                                                                      
-------------------                                                   
> Pascal Samuzeau wrote:                                              
>                                                                     
> > When I try <dtml-var "REQUEST.form['try-it']> I have the          
following                                                             
> > error :                                                           
> >                                                                   
> > Type de l'erreur : KeyError                                       
> > Valeur de l'erreur : keyword                                      
> >                                                                   
> > Traceback (innermost last):                                       
>                                                                     
> of course. try-it was the value, not the key                        
>                                                                     
> > When I try <dtml-var "REQUEST"> I have the URL , URL0,            
BASE3                                                                 
> > as:                                                               
> >                                                                   
> > http://website/folder/document,                                   
> >                                                                   
> > but never I see my parameter "variable"                           
>                                                                     
> can't believe this                                                  
>                                                                     
> > > Pascal Samuzeau wrote:                                          
> > > > Hello,                                                        
> > > > I have a link as :                                            
> > > > <a                                                            
href="http://website/folder/document?variable=try-it">Try</a>         
> >                                                                   
> > > > I want to get the variable in my document.                    
> > > >                                                               
> > > > I did REQUEST.form['varibale']. But it doesn't work, of       
cource,                                                               
>                                                                     
> maybe variable?                                                     
>                                                                     
> > I                                                                 
> > > > haven't a form.                                               
> > > >                                                               
> > > > What i the syntax to get this variable???                     
> > >                                                                 
> > > maybe REQUEST['variable']?                                      
> > > whats in your REQUEST (is "variable" present?)?                 
> > >                                                                 
>                                                                     
> i wrote this just to assert whats in the request.                   
> i still dont believe.                                               
> whats in the request?                                               
> --                                                                  
> Who's got only a hammer sees the world as a nail                    
> hans augustin  (software developer)           hans@beehive.de       
> beehive elektronische medien GmbH                                   
http://www.beehive.de                                                 
> phone: +49 30 847-82 0                  fax: +49 30 847-82 299      
>                                                                     
>                                                                     
>                                                                     
                                                                      
--------------------------------------------------                    
Oreka ! Nous sommes l'internet moins cher !                           
Surfez 25% moins cher avec http://www.oreka.com