equal
deleted
inserted
replaced
15 # |
15 # |
16 # You should have received a copy of the GNU Lesser General Public License along |
16 # You should have received a copy of the GNU Lesser General Public License along |
17 # with CubicWeb. If not, see <http://www.gnu.org/licenses/>. |
17 # with CubicWeb. If not, see <http://www.gnu.org/licenses/>. |
18 """web session component: by dfault the session is actually the db connection |
18 """web session component: by dfault the session is actually the db connection |
19 object :/ |
19 object :/ |
|
20 """ |
20 |
21 |
21 """ |
|
22 __docformat__ = "restructuredtext en" |
22 __docformat__ = "restructuredtext en" |
23 |
23 |
24 from cubicweb.web import InvalidSession |
24 from cubicweb.web import InvalidSession |
25 from cubicweb.web.application import AbstractSessionManager |
25 from cubicweb.web.application import AbstractSessionManager |
26 from cubicweb.dbapi import DBAPISession |
26 from cubicweb.dbapi import DBAPISession |
49 def get_session(self, req, sessionid): |
49 def get_session(self, req, sessionid): |
50 """return existing session for the given session identifier""" |
50 """return existing session for the given session identifier""" |
51 if not sessionid in self._sessions: |
51 if not sessionid in self._sessions: |
52 raise InvalidSession() |
52 raise InvalidSession() |
53 session = self._sessions[sessionid] |
53 session = self._sessions[sessionid] |
54 if self.has_expired(session): |
|
55 self.close_session(session) |
|
56 raise InvalidSession() |
|
57 try: |
54 try: |
58 user = self.authmanager.validate_session(req, session) |
55 user = self.authmanager.validate_session(req, session) |
59 except InvalidSession: |
56 except InvalidSession: |
60 # invalid session |
57 # invalid session |
61 self.close_session(session) |
58 self.close_session(session) |