Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit fd504d9

Browse files
committed
took out forms support (in favor a Grail extension)
1 parent a89b1ba commit fd504d9

1 file changed

Lines changed: 3 additions & 94 deletions

File tree

Lib/htmllib.py

Lines changed: 3 additions & 94 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,9 @@ def save_bgn(self):
4848
def save_end(self):
4949
data = self.savedata
5050
self.savedata = None
51-
return string.join(string.split(data))
51+
if not self.nofill:
52+
data = string.join(string.split(data))
53+
return data
5254

5355
# --- Hooks for anchors; should probably be overridden
5456

@@ -67,36 +69,6 @@ def anchor_end(self):
6769
def handle_image(self, src, alt):
6870
self.handle_data(alt)
6971

70-
# --- Hooks for forms; should probably be overridden
71-
72-
def form_bgn(self, action, method, enctype):
73-
self.do_p([])
74-
self.handle_data("<FORM>")
75-
76-
def form_end(self):
77-
self.handle_data("</FORM>")
78-
self.do_p([])
79-
80-
def handle_input(self, type, options):
81-
self.handle_data("<INPUT>")
82-
83-
def select_bgn(self, name, size, multiple):
84-
self.handle_data("<SELECT>")
85-
86-
def select_end(self):
87-
self.handle_data("</SELECT>")
88-
89-
def handle_option(self, value, selected):
90-
self.handle_data("<OPTION>")
91-
92-
def textarea_bgn(self, name, rows, cols):
93-
self.handle_data("<TEXTAREA>")
94-
self.start_pre([])
95-
96-
def textarea_end(self):
97-
self.end_pre()
98-
self.handle_data("</TEXTAREA>")
99-
10072
# --------- Top level elememts
10173

10274
def start_html(self, attrs): pass
@@ -387,69 +359,6 @@ def do_img(self, attrs):
387359
src = value
388360
self.handle_image(src, alt)
389361

390-
# ------ Forms
391-
392-
def start_form(self, attrs):
393-
action = ''
394-
method = ''
395-
enctype = ''
396-
for a, v in attrs:
397-
if a == 'action': action = v
398-
if a == 'method': method = v
399-
if a == 'enctype': enctype = v
400-
self.form_bgn(action, method, enctype)
401-
402-
def end_form(self):
403-
self.form_end()
404-
405-
def do_input(self, attrs):
406-
type = ''
407-
options = {}
408-
for a, v in attrs:
409-
if a == 'type': type = string.lower(v)
410-
else: options[a] = v
411-
self.handle_input(type, options)
412-
413-
def start_select(self, attrs):
414-
name = ''
415-
size = 0
416-
multiple = 0
417-
for a, v in attrs:
418-
if a == 'multiple': multiple = 1
419-
if a == 'name': name = v
420-
if a == 'size':
421-
try: size = string.atoi(size)
422-
except: pass
423-
self.select_bgn(name, size, multiple)
424-
425-
def end_select(self):
426-
self.select_end()
427-
428-
def do_option(self, attrs):
429-
value = ''
430-
selected = 1
431-
for a, v in attrs:
432-
if a == 'value': value = v
433-
if a == 'selected': selected = 1
434-
self.handle_option(value, selected)
435-
436-
def start_textarea(self, attrs):
437-
name = ''
438-
rows = 0
439-
cols = 0
440-
for a, v in attrs:
441-
if a == 'name': name = v
442-
if a == 'rows':
443-
try: rows = string.atoi(v)
444-
except: pass
445-
if a == 'cols':
446-
try: cols = string.atoi(v)
447-
except: pass
448-
self.textarea_bgn(name, rows, cols)
449-
450-
def end_textarea(self):
451-
self.textarea_end()
452-
453362
# --- Really Old Unofficial Deprecated Stuff
454363

455364
def do_plaintext(self, attrs):

0 commit comments

Comments
 (0)