diff options
-rw-r--r-- | askbot/doc/source/changelog.rst | 1 | ||||
-rw-r--r-- | askbot/skins/common/media/js/editor.js | 7 | ||||
-rw-r--r-- | askbot/skins/utils.py | 5 | ||||
-rw-r--r-- | askbot/views/writers.py | 11 |
4 files changed, 15 insertions, 9 deletions
diff --git a/askbot/doc/source/changelog.rst b/askbot/doc/source/changelog.rst index 45a6f49b..8f9cf9f2 100644 --- a/askbot/doc/source/changelog.rst +++ b/askbot/doc/source/changelog.rst @@ -18,6 +18,7 @@ Development version (not released yet) * replaced setting `ASKBOT_FILE_UPLOAD_DIR` with django's `MEDIA_ROOT` (Evgeny) * replaced setting `ASKBOT_UPLOADED_FILES_URL` with django's `MEDIA_URL` (Evgeny) * allowed changing file storage backend for file uploads by configuration (Evgeny) +* file uploads to amazon S3 now work with proper configuration (Evgeny) 0.7.36 (Dec 20, 2011) --------------------- diff --git a/askbot/skins/common/media/js/editor.js b/askbot/skins/common/media/js/editor.js index f5b1e2af..e580f9f6 100644 --- a/askbot/skins/common/media/js/editor.js +++ b/askbot/skins/common/media/js/editor.js @@ -42,11 +42,11 @@ function ajaxFileUpload(imageUrl, startUploadHandler) url: askbot['urls']['upload'], secureuri:false, fileElementId:'file-upload', - dataType: 'xml', + dataType: 'json', success: function (data, status) { - var fileURL = $(data).find('file_url').text(); - var error = $(data).find('error').text(); + var fileURL = data['file_url']; + var error = data['error']; if(error != ''){ alert(error); if (startUploadHandler){ @@ -57,7 +57,6 @@ function ajaxFileUpload(imageUrl, startUploadHandler) }else{ imageUrl.attr('value', fileURL); } - }, error: function (data, status, e) { diff --git a/askbot/skins/utils.py b/askbot/skins/utils.py index bf041001..50c0d4fb 100644 --- a/askbot/skins/utils.py +++ b/askbot/skins/utils.py @@ -98,6 +98,11 @@ def get_media_url(url, ignore_missing = False): #before = datetime.datetime.now() url = urllib.unquote(unicode(url)) while url[0] == '/': url = url[1:] + + #a hack allowing urls media stored on external locations to + #just pass through unchanged + if url.startswith('http://') or url.startswith('https://'): + return url #todo: handles case of multiple skin directories #if file is in upfiles directory, then give that diff --git a/askbot/views/writers.py b/askbot/views/writers.py index c4d60de9..916c0e17 100644 --- a/askbot/views/writers.py +++ b/askbot/views/writers.py @@ -103,11 +103,12 @@ def upload(request):#ajax upload file to a question or answer result = '' file_url = '' - #<result><msg><![CDATA[%s]]></msg><error><![CDATA[%s]]></error><file_url>%s</file_url></result> - xml_template = "<result><msg><![CDATA[%s]]></msg><error><![CDATA[%s]]></error><file_url>%s</file_url></result>" - xml = xml_template % (result, error, file_url) - - return HttpResponse(xml, mimetype="application/xml") + data = simplejson.dumps({ + 'result': result, + 'error': error, + 'file_url': file_url + }) + return HttpResponse(data, mimetype = 'application/json') def __import_se_data(dump_file): """non-view function that imports the SE data |