[Zope] Zope 2.7: You are not allowed to access 'SESSION' in this context

Alec Munro alec.munro@eoascientific.com
Tue, 29 Jul 2003 13:24:00 -0300


It's not just sessions in particular, I had the same problem with 
accessing template/absolute_url.
Also, I tried your idea, and it doesn't give me errors when I display 
the following document:

<html>
<body>
</body>
</html>

But it also doesn't do any processing(it spits out the full text) when I 
display the following:

<span tal:content="template/id"></span>

If I change the type over to html, it works fine.

So there's something a little funny about the XML handling on my server.
Perhaps I don't the the proper library installed, so it's treating XML 
as plain text, rather than a page template?
I don't see how that explains why it would generate an authentication 
error, but perhaps there are different rules for when it traverses?
Just maybe, if it is treating it as plain text, might it be applying a 
security policy to it that is intended for plain text coming from other 
untrusted servers?
Thanks for your help, hope you can figure this out better than me.

Alec

Chris McDonough wrote:

>I dont know what this would have to do with sessions in particular, but
>it may be possible that you don't have a proper XML parser library
>installed in the Python under which you're running Zope.  You could test
>this by attempting to render the simplest possible ZPT template when its
>content type is text/xml.
>
>On Tue, 2003-07-29 at 11:39, Alec Munro wrote:
>  
>
>>Yep. Actually it was only the primary template that was xml, the rest 
>>were typed as html. Maybe this created some kind of conflict?
>>
>>Alec
>>
>>Chris McDonough wrote:
>>
>>    
>>
>>>So you changed your templates' content types and it began to work?
>>>
>>>On Tue, 2003-07-29 at 10:27, Alec Munro wrote:
>>> 
>>>
>>>      
>>>
>>>>Yes, it worked under 2.5 for a couple of months now. Zope did not seem 
>>>>to care at that point what content type my page templates were.
>>>>But it does seem to work now, even if I don't particularily understand 
>>>>it, so I'm not going to complain.
>>>>Thanks for your interest.
>>>>
>>>>Alec
>>>>
>>>>Chris McDonough wrote:
>>>>
>>>>   
>>>>
>>>>        
>>>>
>>>>>I presume it worked under 2.5? (Just trying to get a sense of when it
>>>>>broke or if it ever worked...)
>>>>>
>>>>>On Tue, 2003-07-29 at 09:25, Alec Munro wrote:
>>>>>
>>>>>
>>>>>     
>>>>>
>>>>>          
>>>>>
>>>>>>I cannot. I'm in the process of upgrading from 2.5.
>>>>>>What I have in my page template is a tal:define="sess request/SESSION", 
>>>>>>which seems to be where the error is occurring.
>>>>>>Hmm, and it seems that the problem was that my page template had 
>>>>>>text/xml as a content type. That seems a bit odd to me, anyone want to 
>>>>>>shed some light?
>>>>>>
>>>>>>Alec Munro
>>>>>>Chris McDonough wrote:
>>>>>>
>>>>>>  
>>>>>>
>>>>>>       
>>>>>>
>>>>>>            
>>>>>>
>>>>>>>Can you confirm that this worked under 2.6.X?
>>>>>>>
>>>>>>>On Mon, 2003-07-28 at 14:16, Alec Munro wrote:
>>>>>>>
>>>>>>>
>>>>>>>    
>>>>>>>
>>>>>>>         
>>>>>>>
>>>>>>>              
>>>>>>>
>>>>>>>>I have a page template that is accessed via restrictedTraverse(), and 
>>>>>>>>gives me an Unauthorized error when I try to access request/SESSION.
>>>>>>>>It  doesn't seem to be directly related to restrictedTraverse(), because 
>>>>>>>>I switched it for unrestrictedTraverse() and had the same problem.
>>>>>>>>Thanks,
>>>>>>>>
>>>>>>>>Alec Munro
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>>_______________________________________________
>>>>>>>>Zope maillist  -  Zope@zope.org
>>>>>>>>http://mail.zope.org/mailman/listinfo/zope
>>>>>>>>**   No cross posts or HTML encoding!  **
>>>>>>>>(Related lists - 
>>>>>>>>http://mail.zope.org/mailman/listinfo/zope-announce
>>>>>>>>http://mail.zope.org/mailman/listinfo/zope-dev )
>>>>>>>> 
>>>>>>>>
>>>>>>>>      
>>>>>>>>
>>>>>>>>           
>>>>>>>>
>>>>>>>>                
>>>>>>>>
>>>>>>_______________________________________________
>>>>>>Zope maillist  -  Zope@zope.org
>>>>>>http://mail.zope.org/mailman/listinfo/zope
>>>>>>**   No cross posts or HTML encoding!  **
>>>>>>(Related lists - 
>>>>>>http://mail.zope.org/mailman/listinfo/zope-announce
>>>>>>http://mail.zope.org/mailman/listinfo/zope-dev )
>>>>>>  
>>>>>>
>>>>>>       
>>>>>>
>>>>>>            
>>>>>>
>>>>_______________________________________________
>>>>Zope maillist  -  Zope@zope.org
>>>>http://mail.zope.org/mailman/listinfo/zope
>>>>**   No cross posts or HTML encoding!  **
>>>>(Related lists - 
>>>>http://mail.zope.org/mailman/listinfo/zope-announce
>>>>http://mail.zope.org/mailman/listinfo/zope-dev )
>>>>   
>>>>
>>>>        
>>>>
>>
>>
>>_______________________________________________
>>Zope maillist  -  Zope@zope.org
>>http://mail.zope.org/mailman/listinfo/zope
>>**   No cross posts or HTML encoding!  **
>>(Related lists - 
>> http://mail.zope.org/mailman/listinfo/zope-announce
>> http://mail.zope.org/mailman/listinfo/zope-dev )
>>    
>>