From 47c8de03d4168cf9e0c840e747cb7de17a5fc4b5 Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Thu, 22 Sep 2011 12:24:47 -0600 Subject: [PATCH] ... --- src/calibre/web/jsbrowser/forms.py | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/src/calibre/web/jsbrowser/forms.py b/src/calibre/web/jsbrowser/forms.py index 64c652716c..91a96aeffa 100644 --- a/src/calibre/web/jsbrowser/forms.py +++ b/src/calibre/web/jsbrowser/forms.py @@ -26,8 +26,12 @@ class Control(object): def fget(self): if self.type in ('checkbox', 'radio'): return unicode(self.qwe.attribute('checked')) == 'checked' - if self.type in ('text', 'password', 'hidden'): + if self.type in ('text', 'password', 'hidden', 'email', 'search'): return unicode(self.qwe.attribute('value')) + if self.type in ('number', 'range'): + return int(unicode(self.qwe.attribute('value'))) + # Unknown type just treat as text + return unicode(self.qwe.attribute('value')) def fset(self, val): if self.type in ('checkbox', 'radio'): @@ -35,7 +39,11 @@ class Control(object): self.qwe.setAttribute('checked', 'checked') else: self.qwe.removeAttribute('checked') - elif self.type in ('text', 'password', 'hidden'): + elif self.type in ('text', 'password', 'hidden', 'email', 'search'): + self.qwe.setAttribute('value', as_unicode(val)) + elif self.type in ('number', 'range'): + self.qwe.setAttribute('value', '%d'%int(val)) + else: # Unknown type treat as text self.qwe.setAttribute('value', as_unicode(val)) return property(fget=fget, fset=fset)