From 6f3b6cc07f746bb3166ba72f507344710598e148 Mon Sep 17 00:00:00 2001 From: Michael Ziegler Date: Sun, 22 Aug 2010 01:46:51 +0200 Subject: [PATCH] restore backwards compatibility to python 2.5. fixes #104 --- pyweb/djextdirect.py | 2 +- pyweb/mumble/forms.py | 15 +++++++++++---- 2 files changed, 12 insertions(+), 5 deletions(-) diff --git a/pyweb/djextdirect.py b/pyweb/djextdirect.py index c4b650d..29fc42f 100644 --- a/pyweb/djextdirect.py +++ b/pyweb/djextdirect.py @@ -157,7 +157,7 @@ class Provider( object ): if clsname not in self.classes: self.classes[clsname] = {} self.classes[ clsname ][ method.__name__ ] = method - method.EXT_argnames = inspect.getargspec( method ).args[1:] + method.EXT_argnames = inspect.getargspec( method )[0][1:] method.EXT_len = len( method.EXT_argnames ) method.EXT_flags = flags return method diff --git a/pyweb/mumble/forms.py b/pyweb/mumble/forms.py index c43603f..7bf18bb 100644 --- a/pyweb/mumble/forms.py +++ b/pyweb/mumble/forms.py @@ -97,7 +97,6 @@ class PropertyModelForm( ModelForm ): if fldname not in instfields: setattr( inst, fldname, self.cleaned_data[fldname] ) -@EXT_FORMS_PROVIDER.register_form class MumbleForm( PropertyModelForm ): """ The Mumble Server admin form that allows to configure settings which do not necessarily have to be reserved to the server hoster. @@ -147,6 +146,9 @@ class MumbleForm( PropertyModelForm ): def EXT_authorize( self, request, action ): return self.instance.isUserAdmin( request.user ) +EXT_FORMS_PROVIDER.register_form( MumbleForm ) + + class MumbleAdminForm( MumbleForm ): """ A Mumble Server admin form intended to be used by the server hoster. """ @@ -200,7 +202,6 @@ class MumbleServerForm( ModelForm ): class Meta: model = MumbleServer -@EXT_FORMS_PROVIDER.register_form class MumbleUserForm( ModelForm ): """ The user registration form used to register an account. """ @@ -263,7 +264,9 @@ class MumbleUserForm( ModelForm ): model = MumbleUser fields = ( 'name', 'password' ) -@EXT_FORMS_PROVIDER.register_form +EXT_FORMS_PROVIDER.register_form( MumbleUserForm ) + + class MumbleUserPasswordForm( MumbleUserForm ): """ The user registration form used to register an account on a private server in protected mode. """ @@ -295,7 +298,9 @@ class MumbleUserPasswordForm( MumbleUserForm ): del( self.cleaned_data['serverpw'] ) return self.cleaned_data -@EXT_FORMS_PROVIDER.register_form +EXT_FORMS_PROVIDER.register_form( MumbleUserPasswordForm ) + + class MumbleUserLinkForm( MumbleUserForm ): """ Special registration form to either register or link an account. """ @@ -369,6 +374,8 @@ class MumbleUserLinkForm( MumbleUserForm ): return self.cleaned_data +EXT_FORMS_PROVIDER.register_form( MumbleUserLinkForm ) + class MumbleUserAdminForm( PropertyModelForm ): aclAdmin = forms.BooleanField( required=False )