Roger Demetrescu a écrit :
> Hi remi, thanks for the answer... :)
>
> I've used your idea:
>
> [...]
>
> It worked... but it doesn't solve my problem, because of a requirement
> I haven't described in my previous email:
>
> * The system must allow me to know the original identity
>
You could save it in your decorator and pass the value to the function
as a supplementary parameter
# DECORATOR
def protect(group=None):
def entangle(fn):
def protect(func, self, *args, **kwargs):
# some internal validation
original_user = identity.current.user
if not_validated:
original_user
identity.current.logout()
return fn(self, original_user=original_user, *args, **kwargs)
return protect
return weak_signature_decorator(entangle)
You could even restore the original user after your fn call...
> * The system must allow me to retrieve a page using an identity X, and
> inside this page make some AJAX calls using an identity Y (but the X
> identity must be preserved when submitting the form).
>
>
> I guess I'll have to use a mix of your solution with a subclass of
> SqlAlchemyIdentify / SqlAlchemyIdentifyProvider plus a refactoring in
> visit_identity table (to allow having multiple identities with the
> same visitor_key).
>
>
Yes, it seems far from what the current identity can do...
> I'm doing some experiments here...
>
>
> Thanks again for your answer. :)
>
>
> Roger
>
>
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"TurboGears" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/turbogears?hl=en
-~----------~----~----~----~------~----~------~--~---