[Zope] Session Variable Error

Dennis Allison allison at shasta.stanford.edu
Thu Apr 28 14:03:28 EDT 2005


On Thu, 28 Apr 2005, Asad Habib wrote:

> I have a session variable called 'undergraduateProjectsDirected' that I
> declare using the following syntax:
> 
> <dtml-call "REQUEST.SESSION.set('undergradProjectsDirected', [ ])">
> 
> When I try to append items to this list variable, I get the following
> error:
> 
> AttributeError: 'NoneType' object has no attribute 'append'
> 
> I know for a fact that this variable exists since flushing the SESSION
> attribute of the REQUEST variable using <dtml-var "REQUEST.SESSION">
> yields its name and shows that it is initially empty.
> 
> I am using the following statement to append items:
> 
> <dtml-call "(REQUEST.SESSION.get('undergraduateProjectsDirected')).append([student_name, description])">
> 
> The strange thing is that when I change the name of this variable to
> 'undergradProjectsDirected', the error does not occur anymore.

Once you get beyond this problem, you may want to think about persistence 
issues.  See The Zope Book for details.   The list probably should be an 
instance of a PersistentList and you should use the copy-out/copy-in 
technique described in the API and in the Developers Guide.




More information about the Zope mailing list