From 0dc578fc9c976e56ac361209fcb107d6463e875f Mon Sep 17 00:00:00 2001 From: Mohammed Shekha Date: Tue, 21 May 2013 16:22:06 +0530 Subject: [PATCH] [FIX]Fixed the issue of session storage directory created with wrong username when someone restart the server using sudo. bzr revid: msh@openerp.com-20130521105206-8oka7n7t9z13uiwo --- addons/web/http.py | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/addons/web/http.py b/addons/web/http.py index f618e9828a5..19996783b4b 100644 --- a/addons/web/http.py +++ b/addons/web/http.py @@ -488,9 +488,13 @@ class DisableCacheMiddleware(object): def session_path(): try: - username = getpass.getuser() - except Exception: - username = "unknown" + import pwd + username = pwd.getpwuid(os.getuid()).pw_name + except ImportError: + try: + username = getpass.getuser() + except Exception: + username = "unknown" path = os.path.join(tempfile.gettempdir(), "oe-sessions-" + username) try: os.mkdir(path, 0700)