Would you mind trying without identity.require() and if it does the trick, try applying attached patch to identity/conditions.py.

Thanks,
Simon

Jorge Godoy wrote:
Simon Belak <[EMAIL PROTECTED]> writes:

Hi,

I think I have found the (hope it's the bug, not a bug ;)).

Would you mind trying attached pathches (newcontroller.py.diff and
decorator.py.diff).

Thanks.

Simon

I've tested Kevin's new commit (SVN r.622), sorry, I was out for the whole 
morning.

The problem is still there:

Traceback (most recent call last):
  File 
"/usr/lib/python2.4/site-packages/CherryPy-2.2.0beta-py2.4.egg/cherrypy/_cphttptools.py",
 line 99, in _run
    self.main()
  File 
"/usr/lib/python2.4/site-packages/CherryPy-2.2.0beta-py2.4.egg/cherrypy/_cphttptools.py",
 line 247, in main
    body = page_handler(*virtual_path, **self.params)
  File "<string>", line 3, in index
  File 
"/home/godoy/desenvolvimento/python/TurboGears/trunk/turbogears/controllers.py",
 line 215, in expose
    func, tg_format, html, fragment, **kw)
  File 
"/home/godoy/desenvolvimento/python/TurboGears/trunk/turbogears/database.py", 
line 193, in run_with_transaction
    retval = func(*args, **kw)
  File 
"/home/godoy/desenvolvimento/python/TurboGears/trunk/turbogears/controllers.py",
 line 243, in _execute_func
    output = dispatch_error(func, self, **kw)
  File "<string>", line 5, in dispatch_error
  File 
"/home/godoy/desenvolvimento/python/TurboGears/trunk/turbogears/controllers.py",
 line 295, in _default_error_handler
    return getattr(self, error_source.__name__ )(**kw)
  File "<string>", line 3, in index
  File 
"/home/godoy/desenvolvimento/python/TurboGears/trunk/turbogears/controllers.py",
 line 211, in expose
    output = _execute_func(self, func, tg_format, html, fragment, **kw)
  File 
"/home/godoy/desenvolvimento/python/TurboGears/trunk/turbogears/controllers.py",
 line 240, in _execute_func
    raise error
TypeError: expose() got multiple values for keyword argument 'self'


Index: conditions.py
===================================================================
--- conditions.py       (revision 618)
+++ conditions.py       (working copy)
@@ -5,8 +5,9 @@
 import types
 from turbogears.identity.exceptions import *
 from turbogears.identity import *
+from turbogears.decorator import decorator

-
+
 class Predicate(object):
     '''
     Generic base class for testing true or false for a condition.
@@ -223,27 +224,19 @@
     Function decorator that checks whether the current user is a member of the
     groups specified and has the permissions required.
     '''
-    def decorator( fn ):
-        def _wrapper( self, *args, **kwargs ):
+    def entangle( fn ):
+        def require( func, self, **kwargs ):
             try:
                 errors= []
                 if predicate is None or \
                    predicate.eval_with_object( current, errors ):
-                   return fn( self, *args, **kwargs )
+                   return fn( self, **kwargs )
             except IdentityException, e:
                 errors= [str(e)]
-
+
             raise IdentityFailure( errors )
-
-        try:
-            _wrapper.func_name= fn.func_name
-        except TypeError:
-            pass
-        if hasattr( fn, "exposed" ):
-            _wrapper.exposed= fn.exposed
-        return _wrapper
-
-    return decorator
+        return decorator( require )( fn )
+    return entangle

Reply via email to