def live_history(): W = g.notebook.create_new_worksheet_from_history(gettext('Log'), g.username, 100) from flask_server.worksheet import url_for_worksheet return redirect(url_for_worksheet(W))
if linked_sws: # just grab 1st URL; perhaps later add interface for # downloading multiple linked .sws try: filename = my_urlretrieve(linked_sws[0]['url'], backlinks=backlinks)[0] print 'Importing {0}, linked to from {1}'.format(linked_sws[0]['url'], url) except RetrieveError as err: return current_app.message(str(err)) W = g.notebook.import_worksheet(filename, g.username) except Exception, msg: print 'error uploading worksheet', msg s = _('There was an error uploading the worksheet. It could be an old unsupported format or worse. If you desperately need its contents contact the <a href="http://groups.google.com/group/sage-support">sage-support group</a> and post a link to your worksheet. Alternatively, an sws file is just a bzip2 tarball; take a look inside!\n%(backlinks)s', backlinks=backlinks) return current_app.message(s, url_for('home', username=g.username)) finally: # Clean up the temporarily uploaded filename. os.unlink(filename) # if a temp directory was created, we delete it now. if dir: import shutil shutil.rmtree(dir) except ValueError, msg: s = _("Error uploading worksheet '%(msg)s'.%(backlinks)s", msg=msg, backlinks=backlinks) return current_app.message(s, url_for('home', username=g.username)) if new_name: W.set_name(new_name) from flask_server.worksheet import url_for_worksheet return redirect(url_for_worksheet(W))