Hello, Florent.

On Saturday November 22, 2008 17:50:56 Florent Aide wrote:
> Yes we can! :)
>
> But should we?
>
> The whole thing as been thought this way from the beginning (when I
> did not know where we were headed). Mark orientated me in the
> direction of just looking for a check_security callable present on the
> controller.
>
> I don't find easier to write the whole check_security in my
> application. If you remove the SecureController I feel that most
> people will end up with a SecureController in their code sort of...
> What is important is to have the check_security attr on your
> controller class and that this attr is a callable returning True or
> False.

But we have redundant code here.

The _same_ code of the SecureController.check_security in quickstarted 
applications is implemented in the TGController.check_security:
http://trac.turbogears.org/browser/trunk/tg/controllers.py?rev=5743#L514

So, SecureController subclasses that class just to override a method by using 
the original method's code. Why?


> But why remove code that people would need to rewrite if we remove it?
> Anyone who wants for any reason to write a controller that does not
> subclass SecureController can just implement the check_security by
> themselves but this is a bit of code which is not that pretty and that
> you would need to define as a function somewhere and then stuff into
> your controllers to be secured.
>
> I feel subclassing from SC makes your code more explicit and clean but
> as already said you can already do other wise really easily without
> removing the SecureController implementation. It's just that SC will
> fit 99% of the common need and should nearly never need to evolve
> appart from the error reporting that we should stuff in there before
> the final version (tg.flash).

But the point is, SecureController's functionality is available out-of-the-box 
in any controller, so it's unnecessary.

Cheers!
-- 
Gustavo Narea <http://gustavonarea.net/>.

Get rid of unethical constraints! Get freedomware:
http://www.getgnulinux.org/

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"TurboGears Trunk" 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-trunk?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to