Traceback (most recent call last):
  File "gluon/restricted.py", line 107, in restricted
  File "/Applications/web2py1.64/web2py.app/Contents/Resources/
applications/2busy/views/menu/index.html", line 46, in <module>
NameError: name 'time' is not defined


On 15 Jun., 23:04, mdipierro <mdipie...@cs.depaul.edu> wrote:
> what error?
>
> On Jun 15, 3:46 pm, pk <peter.kirch...@youngdesigners.de> wrote:
>
> > massimo, there is still something wrong, with the syntax.
>
> > On 15 Jun., 22:31, mdipierro <mdipie...@cs.depaul.edu> wrote:
>
> > > {{for user in db((db.online.last_visit>time.time()-dt)
> > > (db.online.user_id==db.auth_user.id).select():}}
> > >   {{=user.auth_user.last_name}}<br />
> > > {{pass}}
>
> > > On Jun 15, 2:17 pm, pk <peter.kirch...@youngdesigners.de> wrote:
>
> > > > i need it like so (logic):
>
> > > > Folgende User sind online:<br /><br />
> > > > {{for onuser in db.auth_user:}}
> > > >      {{if(URL(r=request,c='userstate',f='is_user_online(onuser)')):}}
> > > >           {{=onuser.last_name}}
> > > >      {{pass}}
> > > > {{pass}}
>
> > > > On 15 Jun., 20:48, pk <peter.kirch...@youngdesigners.de> wrote:
>
> > > > > oh i forget to ask,
>
> > > > > and how can i now display on the html page, which user are online?
> > > > > thanks massimo for your time ;)
>
> > > > > On 15 Jun., 20:24, pk <peter.kirch...@youngdesigners.de> wrote:
>
> > > > > > thanks massimo ;)
>
> > > > > > On 15 Jun., 20:07, mdipierro <mdipie...@cs.depaul.edu> wrote:
>
> > > > > > > Put this in your layout.html
>
> > > > > > > <script language="Javascript" type="text/javascript">
> > > > > > > jQuery(document).ready(function(){
> > > > > > >      setTimeout("keepalive('{{=URL
> > > > > > > (r=request,c='default',f='keepalive')}}')",2000);});
>
> > > > > > > </script>
>
> > > > > > > This in your model
>
> > > > > > > db.define_table('online',SQLField('user_id',db.auth_user),SQLField
> > > > > > > ('last_visit','integer'))
>
> > > > > > > This in your default.py controller
>
> > > > > > > @auth.requires_login()
> > > > > > > def keepalive():
> > > > > > >     import time
> > > > > > >     if not db.online[auth.user.id]:
> > > > > > >         
> > > > > > > db.online.insert(user_id=auth.user.id,last_visit=time.time())
> > > > > > >     else:
> > > > > > >         
> > > > > > > db(db.online.user_id==auth.user.id).update(last_visit=time.time
> > > > > > > ())
>
> > > > > > > and use this function to check
>
> > > > > > > def is_user_online(user_id):
> > > > > > >       import time
> > > > > > >       dt = 5000
> > > > > > >       return db(db.online.user_id==user_id)
> > > > > > > (db.online.last_visit>time.time()-dt.count()>0
>
> > > > > > > Massimo
>
> > > > > > > On Jun 15, 12:57 pm, pk <peter.kirch...@youngdesigners.de> wrote:
>
> > > > > > > > hi,
>
> > > > > > > > is there a available command or function to check whether the 
> > > > > > > > user
> > > > > > > > (from auth.user) is online or not?
>
> > > > > > > > thanks
>
>
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"web2py Web Framework" group.
To post to this group, send email to web2py@googlegroups.com
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to