trigger done with better info if upload fails, dont fail if screen/window are not defined in init
This commit is contained in:
parent
c753688f41
commit
71fdb6f8aa
3 changed files with 5 additions and 4 deletions
|
@ -77,6 +77,7 @@ MIDDLEWARE_CLASSES = (
|
||||||
'django.middleware.common.CommonMiddleware',
|
'django.middleware.common.CommonMiddleware',
|
||||||
'django.contrib.sessions.middleware.SessionMiddleware',
|
'django.contrib.sessions.middleware.SessionMiddleware',
|
||||||
'django.contrib.auth.middleware.AuthenticationMiddleware',
|
'django.contrib.auth.middleware.AuthenticationMiddleware',
|
||||||
|
'django.contrib.messages.middleware.MessageMiddleware',
|
||||||
'ox.django.middleware.ExceptionMiddleware',
|
'ox.django.middleware.ExceptionMiddleware',
|
||||||
'ox.django.middleware.ChromeFrameMiddleware',
|
'ox.django.middleware.ChromeFrameMiddleware',
|
||||||
)
|
)
|
||||||
|
|
|
@ -107,10 +107,10 @@ class SessionData(models.Model):
|
||||||
data.useragent = request.META['HTTP_USER_AGENT']
|
data.useragent = request.META['HTTP_USER_AGENT']
|
||||||
data.info = json.loads(request.POST.get('data', '{}'))
|
data.info = json.loads(request.POST.get('data', '{}'))
|
||||||
screen = data.info.get('screen', {})
|
screen = data.info.get('screen', {})
|
||||||
if 'height' in screen and 'width' in screen:
|
if screen and 'height' in screen and 'width' in screen:
|
||||||
data.screensize = '%sx%s' % (screen['width'], screen['height'])
|
data.screensize = '%sx%s' % (screen['width'], screen['height'])
|
||||||
window = data.info.get('window', {})
|
window = data.info.get('window', {})
|
||||||
if 'outerHeight' in window and 'outerWidth' in window:
|
if window 'outerHeight' in window and 'outerWidth' in window:
|
||||||
data.windowsize = '%sx%s' % (window['outerWidth'], window['outerHeight'])
|
data.windowsize = '%sx%s' % (window['outerWidth'], window['outerHeight'])
|
||||||
if not data.timesseen:
|
if not data.timesseen:
|
||||||
data.timesseen = 0
|
data.timesseen = 0
|
||||||
|
|
|
@ -61,12 +61,12 @@ pandora.ui.upload = function(oshash, file) {
|
||||||
that.status = 'uplaod failed';
|
that.status = 'uplaod failed';
|
||||||
that.progress = -1;
|
that.progress = -1;
|
||||||
that.responseText = evt.target.responseText;
|
that.responseText = evt.target.responseText;
|
||||||
that.triggerEvent('done', tat);
|
done();
|
||||||
}, false);
|
}, false);
|
||||||
self.req.addEventListener('abort', function (evt) {
|
self.req.addEventListener('abort', function (evt) {
|
||||||
that.status = 'aborted';
|
that.status = 'aborted';
|
||||||
that.progress = -1;
|
that.progress = -1;
|
||||||
that.triggerEvent('done', tat);
|
done();
|
||||||
}, false);
|
}, false);
|
||||||
var formData = new FormData();
|
var formData = new FormData();
|
||||||
Ox.forEach(uploadData, function(value, key) {
|
Ox.forEach(uploadData, function(value, key) {
|
||||||
|
|
Loading…
Reference in a new issue