From a000ec95d7cd4f7ce429eceff4dae4ae1f6fdcc3 Mon Sep 17 00:00:00 2001 From: Anand Doshi Date: Wed, 10 Jul 2013 20:48:00 +0530 Subject: [PATCH] [minor] converty types for single doctypes in load_from_db, moved some functions to number_format.js for use in website --- public/js/legacy/datatype.js | 29 -------------------------- public/js/legacy/widgets/form/form.js | 2 +- public/js/wn/app.js | 4 ++-- public/js/wn/misc/number_format.js | 30 +++++++++++++++++++++++++++ webnotes/auth.py | 1 + webnotes/model/bean.py | 20 ++++++++++++++---- webnotes/model/mapper.py | 5 +++-- webnotes/webutils.py | 2 +- 8 files changed, 54 insertions(+), 39 deletions(-) diff --git a/public/js/legacy/datatype.js b/public/js/legacy/datatype.js index c21082b5b1..7b27c64116 100644 --- a/public/js/legacy/datatype.js +++ b/public/js/legacy/datatype.js @@ -68,17 +68,6 @@ function replace_newlines(t) { return t?t.replace(/\n/g, '
'):''; } -function cint(v, def) { - if(v===true) - return 1; - if(v===false) - return 0; - v=v+''; - v=lstrip(v, ['0']); - v=parseInt(v); - if(isNaN(v))v=def===undefined?0:def; - return v; -} function validate_email(txt) { return wn.utils.validate_type(txt, "email"); } @@ -116,17 +105,6 @@ var strip = function(s, chars) { return s; } -var lstrip = function(s, chars) { - if(!chars) chars = ['\n', '\t', ' ']; - // strip left - var first_char = s.substr(0,1); - while(in_list(chars, first_char)) { - var s = s.substr(1); - first_char = s.substr(0,1); - } - return s; -} - var rstrip = function(s, chars) { if(!chars) chars = ['\n', '\t', ' ']; var last_char = s.substr(s.length-1); @@ -160,13 +138,6 @@ function values(obj) { return myvalues; } -function in_list(list, item) { - if(!list) return false; - for(var i=0, j=list.length; i