[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
This commit is contained in:
+7
-3
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user