hi, i use Mochikit to write a simple update code. but strangely it
works on Firefox. and works on IE first time. if I call the function
sencond time. it won't work on IE. but if i delete the temporary files
of IE. then it works again. but just ones. unless u delete the
temporary files again. I tried to debug it for a long time but still
have no idea. any help? thanks.
# JS code:
delete_reply = function (id) {
if (confirm("${_('Do you really want to delete this
answer?')}")) {
d = loadJSONDoc('../../processing/del_qna_a', {'id':
id})
d.addCallback(deleteAnswerResult)
}
}
deleteAnswerResult = function (result) {
if (result['report']) {
cancel_reply(result['id'], '')
replaceChildNodes("date_" + result['id'], "")
replaceChildNodes("re_" + result['id'], "")
}
else {
window.location = "../../../login"
}
}
# Python code
@expose(allow_json=True)
def del_qna_a(self, *args, **kw):
if 'root' in identity.current.groups:
try:
q = Question.get(kw['id'])
except:
report = False
else:
try:
q.answer = ""
q.replied = None
except:
report = False
else:
report = True
else:
report = False
return dict(report=report, id=kw['id'])
BTW, is there any good way to use @identity for AJAX? if i use
@identity it doessn't work for AJAX.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"TurboGears" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/turbogears
-~----------~----~----~----~------~----~------~--~---