It is possible to pop up django's traceback as a separate window when
making XMLHttpRequests.

I have found an example of placing the error content from the response
into a separate window. This is a bit easier to read than scanning
through the raw html in firebug. This appears to work for me on IE 6. A
slight modification allows it to work in firefox as well.

The source url is
http://www.onlamp.com/pub/a/onlamp/2005/05/19/xmlhttprequest.html

To adapt this to MochiKit, you just need to know that the original
XMLHttpRequest object is stored in the error object as this.req. I pass
this to the handleErrFullPage function as resp.req.responseText.  I've
pasted in my code below for my error callback function as well as for
the handleErrFullPage function.

Thanks for everyone's help.
-----------------------------------------
function errorcallback(resp) {

    switch (resp.number) {
    case 500:

      handleErrFullPage(resp.req.responseText);
    }


function handleErrFullPage(strIn) {

  var errorWin;
// Create new window and display error
  try {
    errorWin = window.open('', 'errorWin');
    // errorWin.document.body.innerHTML = strIn; // works in IE 6
    errorWin.document.write(strIn); // works in firefox and IE6

  }
  // If pop-up gets blocked, inform user
  catch(e) {
    alert('An error occurred, but the error message cannot be' +
                        ' displayed because of your browser\'s pop-up
blocker.\n' +
          'Please allow pop-ups from this Web site.');
  }
}


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users
-~----------~----~----~----~------~----~------~--~---

Reply via email to