witten
/
luminotes
Archived
1
0
Fork 0

More defensive programming.

This commit is contained in:
Dan Helfman 2008-02-25 07:19:15 +00:00
parent e6ff9203f3
commit fb7655707e
1 changed files with 2 additions and 2 deletions

View File

@ -74,7 +74,7 @@ def stream_progress( uploading_file, filename, fraction_reported ):
yield \
u"""
<script type="text/javascript">
withDocument( window.parent.document, function () { getElement( "upload_frame" ).pulldown.upload_complete(); } );
withDocument( window.parent.document, function () { var frame = getElement( 'upload_frame' ); if ( frame && frame.pulldown ) frame.pulldown.upload_complete(); } );
</script>
</body>
</html>
@ -83,7 +83,7 @@ def stream_progress( uploading_file, filename, fraction_reported ):
general_error_script = \
"""
withDocument( window.parent.document, function () { getElement( 'upload_frame' ).pulldown.cancel_due_to_error( "%s" ); } );
withDocument( window.parent.document, function () { var frame = getElement( 'upload_frame' ); if ( frame && frame.pulldown ) frame.pulldown.cancel_due_to_error( "%s" ); } );
"""