Karl O. Pinc <kop@karlpinc.com>
This template uses the following variables in it's context:
+ errors A list of UploadError exceptions.
+ e_cnt (Optional) Number of errors to display.
+ lines (Optional) Number of lines in an uploaded file.
+ db_changed (Optional) Boolean. Whether the db was changed.
csrf_token Token for detecting CSRF.
last_key Token to detect duplicate uploads.
% endif
</%block>
+<%block name="error_report">
+ % if e_cnt:
+ <p><em class="error">${e_cnt} errors</em>
+ % if lines == UNDEFINED or lines == 0:
+ found.
+ % else:
+ found in a file of ${lines} lines. (Including column headings.)
+ % endif
+ </p>
+ % endif
+
+ % for error in errors:
+
+ ## Get error attributes
+ <%
+ if hasattr(error, 'lineno'):
+ lineno = error.lineno
+ else:
+ lineno = False
+
+ if hasattr(error, 'descr') and error.descr:
+ # We really do want to do this formatting here instead of in
+ # the error handler.
+ if error.e[-1] == ':':
+ descr = ' ' + error.descr
+ else:
+ descr = ': ' + error.descr
+ else:
+ descr = ''
+ %>
+
+ % if lineno:
+ % if loop.first:
+ <hr class="errorsep"></hr>
+ % endif
+ % endif
+
+ <p>
+
+ % if lineno:
+ % if not loop.first:
+ CAUTION -- This error may not be real; prior row(s) of the
+ uploaded file were rejected:
+ <br />
+ % endif
+
+ Line ${lineno}:
+ % endif
+
+ <em class="error">${error.e}</em>${descr}
+ </p>
+
+ ## Messages delivered here are all generated. Allow markup.
+ % if hasattr(error, 'detail'):
+ ${error.detail | n}
+ % endif
+ % if hasattr(error, 'data') and error.data:
+ <p>Line is:</p>
+ <blockquote><p>${error.data}</p></blockquote>
+ % endif
+
+ % if not loop.last and lineno:
+ <hr class="errorsep"></hr>
+ % endif
+
+ % endfor
+</%block>
<%def name="upload_form(extra_rows=[], upload_nulls=True)">
<form action="" enctype="multipart/form-data" method="post">
Karl O. Pinc <kop@meme.com>
- This template uses the following variables in it's context:
-
- errors A list of UploadError exceptions.
- e_cnt (Optional) Number of errors to display.
- lines (Optional) Number of lines in an uploaded file.
- db_changed (Optional) Boolean. Whether the db was changed.
+ This template uses no variables in it's context.
</%doc>
<%block name="summary_info" />
- % if e_cnt:
- <p><em class="error">${e_cnt} errors</em>
- % if lines == UNDEFINED or lines == 0:
- found.
- % else:
- found in a file of ${lines} lines. (Including column headings.)
- % endif
- </p>
- % endif
-
- % for error in errors:
-
- ## Get error attributes
- <%
- if hasattr(error, 'lineno'):
- lineno = error.lineno
- else:
- lineno = False
-
- if hasattr(error, 'descr') and error.descr:
- # We really do want to do this formatting here instead of in
- # the error handler.
- if error.e[-1] == ':':
- descr = ' ' + error.descr
- else:
- descr = ': ' + error.descr
- else:
- descr = ''
- %>
-
- % if lineno:
- % if loop.first:
- <hr class="errorsep"></hr>
- % endif
- % endif
-
- <p>
-
- % if lineno:
- % if not loop.first:
- CAUTION -- This error may not be real; prior row(s) of the
- uploaded file were rejected:
- <br />
- % endif
-
- Line ${lineno}:
- % endif
-
- <em class="error">${error.e}</em>${descr}
- </p>
-
- ## Messages delivered here are all generated. Allow markup.
- % if hasattr(error, 'detail'):
- ${error.detail | n}
- % endif
- % if hasattr(error, 'data') and error.data:
- <p>Line is:</p>
- <blockquote><p>${error.data}</p></blockquote>
- % endif
-
- % if not loop.last and lineno:
- <hr class="errorsep"></hr>
- % endif
-
- % endfor
+ <%block name="error_report" />
% if db_changed:
<%block name="action_success" />