diff --git a/webnotes/sessions.py b/webnotes/sessions.py index ae619cb187..671a829765 100644 --- a/webnotes/sessions.py +++ b/webnotes/sessions.py @@ -100,6 +100,12 @@ class Session: else: self.start() + # set local session + webnotes.local.session = self.data + + # write out latest cookies + webnotes.local.cookie_manager.set_cookies() + def start(self): """start a new session""" # generate sid @@ -125,14 +131,7 @@ class Session: # update profile webnotes.conn.sql("""UPDATE tabProfile SET last_login = '%s', last_ip = '%s' where name='%s'""" % (webnotes.utils.now(), webnotes.get_request_header('REMOTE_ADDR'), self.data['user'])) - webnotes.conn.commit() - - # set cookies to write - webnotes.local.session = self.data - - # write cookies - webnotes.local.cookie_manager.set_cookies() - + webnotes.conn.commit() def insert_session_record(self): webnotes.conn.sql("""insert into tabSessions diff --git a/webnotes/website/js/website.js b/webnotes/website/js/website.js index 663cee6c05..98e947530d 100644 --- a/webnotes/website/js/website.js +++ b/webnotes/website/js/website.js @@ -21,7 +21,11 @@ $.extend(wn, { async: false, dataType: "text", success: function(data) { - var el = document.createElement('script'); + if(url.split(".").splice(-1) == "js") { + var el = document.createElement('script'); + } else { + var el = document.createElement('style'); + } el.appendChild(document.createTextNode(data)); document.getElementsByTagName('head')[0].appendChild(el); }