[web2py] Re: dynamic session variables

2011-02-01 Thread Francisco Costa
I've manage to use this solution: firstcheck=datetime.fromtimestamp(float(request.args(1))) session.id=session.id or {} if not post_id in session.id: session.id[post_id]=firstcheck lastcheck=str(session.id[post_id]) if str(firstcheck) firstcheck if returns any results:

[web2py] Re: dynamic session variables

2011-02-01 Thread Francisco Costa
I'm trying to do a realtime commenting system. I have this place for comments in posts, and I want the new comments to display automatically in the comments area, with reloading the page. I have this that check if there are new posts after the page is loaded every ten seconds: setInterval("aja

Re: [web2py] Re: dynamic session variables

2011-02-01 Thread Jonathan Lundell
On Feb 1, 2011, at 11:54 AM, Francisco Costa wrote: > > the problem is when i open a second tab, it copies the session.id and > doesn't recognize the new page_id > > basically what i want is a diferrent session.id[page_id] for each tab > i open where is page_id coming from? Perhaps the intended

[web2py] Re: dynamic session variables

2011-02-01 Thread Francisco Costa
the problem is when i open a second tab, it copies the session.id and doesn't recognize the new page_id basically what i want is a diferrent session.id[page_id] for each tab i open On Feb 1, 5:19 pm, Massimo Di Pierro wrote: > session.id = session.id or {} > session.id[page_id]=session.id.get(pa

[web2py] Re: dynamic session variables

2011-02-01 Thread Massimo Di Pierro
session.id = session.id or {} session.id[page_id]=session.id.get(page_id,str(request.now)) On Feb 1, 9:59 am, Francisco Costa wrote: > I want something like this: > >     if not session.id[page_id]: >         session.id[page_id]=str(request.now) > > but i get this error: KeyError: '74' > > I wan

[web2py] Re: dynamic session variables

2011-02-01 Thread Francisco Costa
I want something like this: if not session.id[page_id]: session.id[page_id]=str(request.now) but i get this error: KeyError: '74' I want to validate if a dynamic variable exists.. if not I want to create it and to get the time On Feb 1, 4:17 am, Jason Brower wrote: > You can do

[web2py] Re: dynamic session variables

2011-01-31 Thread villas
Try it in the shell, something like this? >>> session.id = {} >>> session.id['page1'] = 'one' >>> session.id['page2'] = 2 >>> session.id['page3'] = 'three' >>> session.id {'page2': 2, 'page3': 'three', 'page1': 'one'} On Jan 31, 9:23 pm, Francisco Costa wrote: > Hello, > I want to have dinamic