Ticket #7835: trac_7835-preparsing-unicode_v2.patch

File trac_7835-preparsing-unicode_v2.patch, 2.1 KB (added by mpatel, 11 years ago)

Add short-term workaround for History/Log?. Replaces previous.

  • sagenb/notebook/twist.py

    # HG changeset patch
    # User Mitesh Patel <qed777@gmail.com>
    # Date 1262827514 28800
    # Node ID 6480bc96a2da7bc6e4995209721feb9bd14068a3
    # Parent  2429838ea9a207341233645277917eb4597bd885
    [mq]: trac_7835-preparsing-unicode.patch
    
    diff --git a/sagenb/notebook/twist.py b/sagenb/notebook/twist.py
    a b class Worksheet_cell_update(WorksheetRes 
    12001200        if status == 'd':
    12011201            new_input = cell.changed_input_text()
    12021202            out_html = cell.output_html()
    1203             H = "Worksheet '%s' (%s)\n"%(worksheet.name(), time.strftime("%Y-%m-%d at %H:%M",time.localtime(time.time())))
    1204             H += cell.edit_text(ncols=HISTORY_NCOLS, prompts=False,
    1205                                 max_out=HISTORY_MAX_OUTPUT)
    1206             notebook.add_to_user_history(H, self.username)
     1203            try:
     1204                H = "Worksheet '%s' (%s)\n"%(worksheet.name(), time.strftime("%Y-%m-%d at %H:%M",time.localtime(time.time())))
     1205                H += cell.edit_text(ncols=HISTORY_NCOLS, prompts=False,
     1206                                    max_out=HISTORY_MAX_OUTPUT)
     1207                notebook.add_to_user_history(H, self.username)
     1208            except UnicodeDecodeError:
     1209                pass
    12071210        else:
    12081211            new_input = ''
    12091212            out_html = ''
  • sagenb/notebook/worksheet.py

    diff --git a/sagenb/notebook/worksheet.py b/sagenb/notebook/worksheet.py
    a b from sagenb.notebook.all import * 
    34393439        """
    34403440        # The extra newline below is necessary, since otherwise source
    34413441        # code introspection doesn't include the last line.
    3442         return 'open("%s","w").write(_support_.preparse_worksheet_cell(base64.b64decode("%s"),globals())+"\\n"); execfile(os.path.abspath("%s"))'%(CODE_PY, base64.b64encode(s), CODE_PY)
     3442        return 'open("%s","w").write("# -*- coding: utf-8 -*-\\n" + _support_.preparse_worksheet_cell(base64.b64decode("%s"),globals())+"\\n"); execfile(os.path.abspath("%s"))'%(CODE_PY, base64.b64encode(s), CODE_PY)
    34433443
    34443444    ##########################################################
    34453445    # Loading and attaching files