But can't you argue that getting logged in users (users with active
session) is logic and as such something that should be put into the
model part of MVC?

On 9/25/07, Kevin <[EMAIL PROTECTED]> wrote:
>
> Just to clarify. The second part I suggested (logged in users) will
> most likely not be in model.py. Good luck.
>
> On Sep 24, 7:05 pm, Kevin <[EMAIL PROTECTED]> wrote:
> > Something like this is your model.py User class will give you a user's
> > history:
> >
> > from sqlobject import AND
> >
> > def _get_visit_history(self):
> >         """Returns login history."""
> >         visits = Visit.select(AND(Visit.q.visit_key ==
> > VisitIdentity.q.visit_key,
> >                                VisitIdentity.q.user_id == self.id),
> >                                orderBy='-created')
> >         return visits
> >
> > To get current logged in users (unexpired sessions really):
> >
> > from sqlobject import AND
> >
> > active_users = User.select(AND(Visit.q.visit_key ==
> >                                   VisitIdentity.q.visit_key,
> > Visit.q.expiry
> >                                   > datetime.now(),
> >                                   User.q.id ==
> > VisitIdentity.q.user_id))
> >
> > Put that in a grid widget.
> >
> > Maybe someone has a better way to do the sqlobject, I'm still
> > learning, but
> > this should give you the type of info your looking for.
> >
> > On Sep 24, 6:26 pm, "Halldór" <[EMAIL PROTECTED]> wrote:
> >
> > > Hi,
> >
> > > I was wondering whether someone has expanded the default user system
> > > provided by the identity framework so that you can keep track of which
> > > users are logged in. Or if someone has any pointers about how is best
> > > to do that.
> >
> > > --
> > > kv. Halldór Rúnarsson
>
>
> >
>


-- 
kv. Halldór Rúnarsson

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"TurboGears" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/turbogears?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to