Hello.

Please don't use SecureController, that functionality is available in the 
BaseController itself as of the second beta. SecureController in b1 is 
outdated (it uses repoze.what the old way; hence the exception) and since it's 
no longer necessary, you may want to remove it and use BaseController instead.

More info:
http://trac.turbogears.org/wiki/2.0/changelog#a1.9.7b2October29th2008:

Cheers.

On Tuesday December 9, 2008 03:35:47 Radityo wrote:
> In TG2b1 with tg.authorize I can do this:
>
>     class SomeSecureController(SecureController):
>         require = authorize.has_permission('onePermission')
>
>         @expose('my_package.template.index')
>         def index(self):
>             # do something here
>
>         @expose('my_package.template.add')
>         @authorize.require(authorize.has_permission('specialPerm'))
>         def do_things(self, **kw):
>             # do other things here
>
> But since TG2b2 with repoze.what it will throw an error:
>     >>  @require(predicates.has_permission('specialPerm'))
>
>     TypeError: 'has_permission' object is not callable
>
> To implement the same permission checking, since TG2b2 I have to write
> it like this:
>
>     class SomeSecureController(BaseController):
>
>         @expose('my_package.template.index')
>         @require(predicates.has_permission('onePermission'))
>         def index(self):
>             # do something here
>
>         @expose('my_package.template.add')
>         @require(predicates.has_all_permission('onePermission',
> 'specialPerm'))
>         def do_things(self, **kw):
>             # do other things here
>
> I kinda like the behavior of the first code, where you can define a
> default permission requirement and then define additional permissions
> as necessary.Is there a way to define a default permission requirement
> with repoze.what?
> 
-- 
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