From d73b40b06603fa3525b1cc6bf42e091272a60208 Mon Sep 17 00:00:00 2001 From: Michael Ziegler Date: Thu, 12 Aug 2010 10:50:22 +0200 Subject: [PATCH] move general errors from errors[''] to errors['__all__'] --- pyweb/djextdirect.py | 10 +++++----- pyweb/mumble/tests.py | 4 ++-- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/pyweb/djextdirect.py b/pyweb/djextdirect.py index 0a2351a..c4b650d 100644 --- a/pyweb/djextdirect.py +++ b/pyweb/djextdirect.py @@ -75,8 +75,8 @@ Ext.extend( Ext.ux.%(clsname)s, Ext.form.FormPanel, { params: Ext.applyIf( {pk: this.pk}, this.baseParams ), failure: function( form, action ){ if( action.failureType == Ext.form.Action.SERVER_INVALID && - typeof action.result.errors[''] != 'undefined' ){ - Ext.Msg.alert( "Error", action.result.errors[''] ); + typeof action.result.errors['__all__'] != 'undefined' ){ + Ext.Msg.alert( "Error", action.result.errors['__all__'] ); } } }); @@ -517,7 +517,7 @@ class Provider( object ): if hasattr( forminst, "EXT_authorize" ) and \ forminst.EXT_authorize( request, "get" ) is False: - return { 'success': False, 'errors': {'': 'access denied'} } + return { 'success': False, 'errors': {'__all__': 'access denied'} } data = {} for fld in forminst.fields: @@ -541,12 +541,12 @@ class Provider( object ): if hasattr( forminst, "EXT_authorize" ) and \ forminst.EXT_authorize( request, "update" ) is False: - return { 'success': False, 'errors': {'': 'access denied'} } + return { 'success': False, 'errors': {'__all__': 'access denied'} } # save if either no usable validation method available or validation passes; and form.is_valid if ( hasattr( forminst, "EXT_validate" ) and callable( forminst.EXT_validate ) and not forminst.EXT_validate( request ) ): - return { 'success': False, 'errors': {'': 'pre-validation failed'} } + return { 'success': False, 'errors': {'__all__': 'pre-validation failed'} } if forminst.is_valid(): forminst.save() diff --git a/pyweb/mumble/tests.py b/pyweb/mumble/tests.py index f6234eb..b494a24 100644 --- a/pyweb/mumble/tests.py +++ b/pyweb/mumble/tests.py @@ -165,8 +165,8 @@ def generateTestCase( name, formname, data, login=None ): return type( name, (ExtDirectFormTestMixin, TestCase), attrs ) RES_SUCCESS = {'success': True} -RES_ACCESSDENIED = {'success': False, 'errors': {'': 'access denied'}} -RES_PREVALFAIL = {'success': False, 'errors': {'': 'pre-validation failed'}} +RES_ACCESSDENIED = {'success': False, 'errors': {'__all__': 'access denied'}} +RES_PREVALFAIL = {'success': False, 'errors': {'__all__': 'pre-validation failed'}} LOGIN_SUPERADMIN = {'username': 'svedrin', 'password': 'passwort'} LOGIN_UNREGUSER = {'username': 'unreg', 'password': 'passwort'}