Re: How to set a global variable?

2007-10-09 Thread James Bennett
On 10/9/07, Greg <[EMAIL PROTECTED]> wrote: > I want to create a list that can be updated from within a part of a > view and retreived from another part of a view. Here is my view.py To access a global variable you need to use the 'global' keyword. A better option, however, is to store the resu

Re: How to set a global variable?

2007-10-09 Thread Greg
Kenneth, I've tried that. It will not work because everytime the view gets accessed then mysearchlist gets cleared. Once mysearchlist is created from within the post. I want the values to stay the same no matter how many times the GET gets accessed. On Oct 9, 10:02 pm, Kenneth Gonsalves <[EMAI

Re: How to set a global variable?

2007-10-09 Thread Kenneth Gonsalves
On 10-Oct-07, at 8:27 AM, Greg wrote: > def searchresult(request): mysearchlist = [] > if request.method == 'POST': > mysearchlist = [1,2,3,4,5] > if request.method == 'GET': > assert False, mysearchlist -- regards kg http://lawgon.livejournal.com http://nrcfo

How to set a global variable?

2007-10-09 Thread Greg
Hello, I want to create a list that can be updated from within a part of a view and retreived from another part of a view. Here is my view.py file from django.shortcuts import render_to_response, get_object_or_404 mysearchlist = [] def searchresult(request): if request.method == 'POST':