소스 검색

fixes to session and added dynamic script loading website.js

version-14
Rushabh Mehta 11 년 전
부모
커밋
02ca266c4e
2개의 변경된 파일12개의 추가작업 그리고 9개의 파일을 삭제
  1. +7
    -8
      webnotes/sessions.py
  2. +5
    -1
      webnotes/website/js/website.js

+ 7
- 8
webnotes/sessions.py 파일 보기

@@ -100,6 +100,12 @@ class Session:
else: else:
self.start() self.start()


# set local session
webnotes.local.session = self.data

# write out latest cookies
webnotes.local.cookie_manager.set_cookies()

def start(self): def start(self):
"""start a new session""" """start a new session"""
# generate sid # generate sid
@@ -125,14 +131,7 @@ class Session:
# update profile # update profile
webnotes.conn.sql("""UPDATE tabProfile SET last_login = '%s', last_ip = '%s' 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'])) 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): def insert_session_record(self):
webnotes.conn.sql("""insert into tabSessions webnotes.conn.sql("""insert into tabSessions


+ 5
- 1
webnotes/website/js/website.js 파일 보기

@@ -21,7 +21,11 @@ $.extend(wn, {
async: false, async: false,
dataType: "text", dataType: "text",
success: function(data) { 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)); el.appendChild(document.createTextNode(data));
document.getElementsByTagName('head')[0].appendChild(el); document.getElementsByTagName('head')[0].appendChild(el);
} }


불러오는 중...
취소
저장