Add maxtextlenth option to SQLFORM.grid HTML exporter
This commit is contained in:
+5
-4
@@ -2476,7 +2476,8 @@ class SQLFORM(FORM):
|
|||||||
response.headers['Content-Type'] = oExp.content_type
|
response.headers['Content-Type'] = oExp.content_type
|
||||||
response.headers['Content-Disposition'] = \
|
response.headers['Content-Disposition'] = \
|
||||||
'attachment;filename=' + filename + ';'
|
'attachment;filename=' + filename + ';'
|
||||||
raise HTTP(200, oExp.export(), **response.headers)
|
document = oExp.export(maxtextlength) if oExp.__class__.__name__== 'ExporterHTML' else oExp.export()
|
||||||
|
raise HTTP(200, document, **response.headers)
|
||||||
|
|
||||||
elif request.vars.records and not isinstance(
|
elif request.vars.records and not isinstance(
|
||||||
request.vars.records, list):
|
request.vars.records, list):
|
||||||
@@ -3549,9 +3550,9 @@ class ExporterHTML(ExportClass):
|
|||||||
def __init__(self, rows):
|
def __init__(self, rows):
|
||||||
ExportClass.__init__(self, rows)
|
ExportClass.__init__(self, rows)
|
||||||
|
|
||||||
def export(self):
|
def export(self, truncate=16):
|
||||||
xml = self.rows.xml() if self.rows else ''
|
table = SQLTABLE(self.rows, truncate=truncate) if self.rows else ''
|
||||||
return '<html>\n<head>\n<meta http-equiv="content-type" content="text/html; charset=UTF-8" />\n</head>\n<body>\n%s\n</body>\n</html>' % (xml or '')
|
return '<html>\n<head>\n<meta http-equiv="content-type" content="text/html; charset=UTF-8" />\n</head>\n<body>\n%s\n</body>\n</html>' % (table or '')
|
||||||
|
|
||||||
|
|
||||||
class ExporterXML(ExportClass):
|
class ExporterXML(ExportClass):
|
||||||
|
|||||||
Reference in New Issue
Block a user