|
# This file is part of Buildbot. Buildbot is free software: you can # redistribute it and/or modify it under the terms of the GNU General Public # License as published by the Free Software Foundation, version 2. # # This program is distributed in the hope that it will be useful, but WITHOUT # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS # FOR A PARTICULAR PURPOSE. See the GNU General Public License for more # details. # # You should have received a copy of the GNU General Public License along with # this program; if not, write to the Free Software Foundation, Inc., 51 # Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. # # Copyright Buildbot Team Members # # Insipration, and some code, from: # :copyright: (c) 2011 by the Werkzeug Team, see Werkzeug's AUTHORS for more # details.
except ImportError: from sha import new as sha1 return random()
"""I'm a user's session. Contains information about a user's session a user can have several session a session is associated with a cookie """
# one day expiration. hardcoded for now...
return ('%(fullName)s [<a href="mailto:%(email)s">%(email)s</a>]' % (self.infos))
('Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat', 'Sun')[d.tm_wday], d.tm_mday, delim, ('Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec')[d.tm_mon - 1], delim, str(d.tm_year), d.tm_hour, d.tm_min, d.tm_sec )
"""I'm the session manager. Holding the current sessions managing cookies, and their expiration
KISS version for the moment:
The sessions are stored in RAM so that you have to relogin after buildbot reboot
Old sessions are searched at every connection, which is not very good for scaling
"""
# borg pattern (similar to singleton) not too loose sessions with reconfig
"""remove old cookies""" expired.append(cookie) del self.sessions[cookie]
return None
return self.users.get(user)
|