***************
*** 5,12 ****
  import types
  from turbogears.identity.exceptions import *
  from turbogears.identity import *
  
- 
  class Predicate(object):
      '''
      Generic base class for testing true or false for a condition.
--- 5,13 ----
  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,249 ****
      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 ):
              try:
                  errors= []
                  if predicate is None or \
                     predicate.eval_with_object( current, errors ):
-                    return fn( self, *args, **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
  
  
  
--- 224,242 ----
      Function decorator that checks whether the current user is a member of the
      groups specified and has the permissions required.
      '''
+     def entangle( fn ):
+         def require( func, self, **kwargs ):
              try:
                  errors= []
                  if predicate is None or \
                     predicate.eval_with_object( current, errors ):
+                    return fn( self, **kwargs )
              except IdentityException, e:
                  errors= [str(e)]
+ 
              raise IdentityFailure( errors )
+         return decorator( require )( fn )
+     return entangle
  
  
  
