From 7f0b42ad709adc09302f7701d5aaacc8d0b66543 Mon Sep 17 00:00:00 2001 From: Nabin Hait Date: Mon, 27 Feb 2012 12:40:35 +0530 Subject: [PATCH 1/4] Made width of button flexible as per label --- js/legacy/widgets/form/fields.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/js/legacy/widgets/form/fields.js b/js/legacy/widgets/form/fields.js index 78c2827db9..64cf6b85dc 100644 --- a/js/legacy/widgets/form/fields.js +++ b/js/legacy/widgets/form/fields.js @@ -1207,8 +1207,8 @@ _f.ButtonField.prototype.make_input = function() { var me = this; // make the input this.input = $btn(this.button_area, - me.df.label.substr(0,20) + ((me.df.label.length>20) ? '..' : ''), null, - {maxWidth:'170px', fontWeight:'bold'}, null, 1) + me.df.label, null, + {fontWeight:'bold'}, null, 1) this.input.onclick = function() { if(me.not_in_form) return; From f8d37fceacb4885bc37dcdf674c0e9affb5cd294 Mon Sep 17 00:00:00 2001 From: Nabin Hait Date: Mon, 27 Feb 2012 12:42:45 +0530 Subject: [PATCH 2/4] assigned a class-name to every column in grid : to change label dynamically --- js/legacy/widgets/form/grid.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/js/legacy/widgets/form/grid.js b/js/legacy/widgets/form/grid.js index 4cb279b4dc..315b57e11d 100644 --- a/js/legacy/widgets/form/grid.js +++ b/js/legacy/widgets/form/grid.js @@ -84,7 +84,7 @@ _f.Grid.prototype.insert_column = function(doctype, fieldname, fieldtype, label, col.doctype = doctype; // for report (fields may be from diff doctypes) col.fieldname = fieldname; col.fieldtype = fieldtype; - col.innerHTML = '
'+label+'
'; + col.innerHTML = '
'+label+'
'; col.label = label; if(reqd) col.childNodes[0].style.color = "#D22"; From 21d5b2485dd4b512a61ec74bea770d6033ef2f06 Mon Sep 17 00:00:00 2001 From: Anand Doshi Date: Tue, 28 Feb 2012 11:33:06 +0530 Subject: [PATCH 3/4] fix in scheduler related import issues --- py/webnotes/utils/scheduler.py | 21 +++++++++++++-------- 1 file changed, 13 insertions(+), 8 deletions(-) diff --git a/py/webnotes/utils/scheduler.py b/py/webnotes/utils/scheduler.py index 50a18cec25..9a6e274de1 100644 --- a/py/webnotes/utils/scheduler.py +++ b/py/webnotes/utils/scheduler.py @@ -67,6 +67,9 @@ def execute(): if now.weekday()==0: out.append('weekly:' + trigger('execute_weekly')) + if now.hour != last.hour: + out.append('hourly:' + trigger('execute_hourly')) + out.append('all:' + trigger('execute_all')) webnotes.conn.set_global('scheduler_last_event', nowtime.strftime(format)) @@ -85,16 +88,18 @@ def trigger(method): return 'ok' except Exception, e: - webnotes.conn.rollback() - traceback = webnotes.getTraceback() - log(method, traceback) - return traceback - -def log(method, error): + return log(method) + +def log(method): """log error in patch_log""" + webnotes.conn.rollback() + traceback = webnotes.getTraceback() + import webnotes.utils webnotes.conn.sql("""insert into __SchedulerLog (`timestamp`, method, error) - values (%s, %s, %s)""", (webnotes.utils.now_datetime(), method, error)) - + values (%s, %s, %s)""", (webnotes.utils.now_datetime(), method, traceback)) + + return traceback + if __name__=='__main__': execute() From fe327620e090d5a47a431a3ed8cc8e9aa0345672 Mon Sep 17 00:00:00 2001 From: Rushabh Mehta Date: Tue, 28 Feb 2012 12:17:37 +0100 Subject: [PATCH 4/4] Fix in session stopped message display --- py/webnotes/__init__.py | 6 ++++++ py/webnotes/auth.py | 11 ++++++----- 2 files changed, 12 insertions(+), 5 deletions(-) diff --git a/py/webnotes/__init__.py b/py/webnotes/__init__.py index f12ac251e3..6e8af3d410 100644 --- a/py/webnotes/__init__.py +++ b/py/webnotes/__init__.py @@ -64,6 +64,12 @@ class UnknownDomainError(Exception): self.value = value def __str__(self): return repr(self.value) + +class SessionStopped(Exception): + def __init__(self, value): + self.value = value + def __str__(self): + return repr(self.value) def getTraceback(): import utils diff --git a/py/webnotes/auth.py b/py/webnotes/auth.py index 3410fe4ad9..e4fa6dac59 100644 --- a/py/webnotes/auth.py +++ b/py/webnotes/auth.py @@ -46,11 +46,6 @@ class HTTPRequest: # set db self.set_db() - # check status - if webnotes.conn.get_global("__session_status")=='stop': - webnotes.msgprint(webnotes.conn.get_global("__session_status_message")) - raise Exception - # ----------------------------- # start transaction webnotes.conn.begin() @@ -62,6 +57,12 @@ class HTTPRequest: webnotes.session_obj = Session() webnotes.session = webnotes.session_obj.data + # check status + if webnotes.conn.get_global("__session_status")=='stop': + webnotes.msgprint(webnotes.conn.get_global("__session_status_message")) + raise webnotes.SessionStopped('Session Stopped') + #raise webnotes.ValidationError(webnotes.conn.get_global("__session_status_message")) + # write out cookies if sid is supplied (this is a pre-logged in redirect) if webnotes.form_dict.get('sid'): webnotes.cookie_manager.set_cookies()