def __init__(self): XHTMLPage.__init__(self) self.javascriptFiles = ['/yui3.js', '/rollup.js'] self.stylesheets = ['/yui3.css', '/rollup.css', '/styles-ie6.css', '/styles-ie7.css', '/rollup-product.css'] self.css = ''' #licenseMessage { width: 500px; } ''' self.titleText = '%s Login' % OSUtils.hostname()
self.mgmt.action('/stats/actions/export', *params) # hack ported from the old web ui that waits up to 30 seconds for the file to # finish being exported. if tField == 'false': i = 0 while i < 30: if os.path.exists(filename) == True: break time.sleep(1) i += 1 # Put together a nice filename for the user in this format: # hostname-date-time-report.csv browserFilename = '%s-%s-%s.csv' % \ (OSUtils.hostname(), time.strftime('%Y%m%d-%H%M%S'), rField) response.setHeader('Content-Type', 'application/octet-stream') response.setHeader('Content-Disposition', 'attachment; filename=%s' % browserFilename) response.setHeader('Content-Length', os.stat(filename).st_size) self.sendExportFile(filename) os.unlink(filename) else: # This servlet doesn't inherit from PagePresentation, so we # can't use the handy setActionMessage() function to set an # action message. Alas, we'll have to set the session value # and URL parameter manually. msg = cgi.escape('Report data emailed to %s.' % eField) msgid = str(self.request().requestID()) self.session().setValue('msg_' + msgid, ([], [msg])) response.sendRedirect('/mgmt/gui?p=reportExports&_msg=%s' % msgid)