#2063: Can't use @require decorator and require property in the same controller.
------------------------+---------------------------------------------------
Reporter: radityo | Owner: Gustavo
Type: defect | Status: closed
Priority: normal | Milestone: 2.0b1
Component: TurboGears | Version: trunk
Severity: minor | Resolution: fixed
Keywords: |
------------------------+---------------------------------------------------
Changes (by Gustavo):
* status: assigned => closed
* resolution: => fixed
Comment:
Fixed in [5868].
This is a pretty old bug and has been discovered recently thanks to
radityo. It's caused by a namespace collision: "require" inside the
controller refers to its "require" attribute, not the @require decorator.
Hence, the solution has been to rename that attribute to "_require":
{{{
class SomeSecureController(BaseController):
_require = predicates.has_permission('onePermission')
@expose('my_package.template.index')
def index(self):
# do something here
@expose('my_package.template.add')
@authorize.require(predicates.has_permission('specialPerm'))
def do_things(self, **kw):
# do other things here
}}}
--
Ticket URL: <http://trac.turbogears.org/ticket/2063#comment:4>
TurboGears <http://www.turbogears.org/>
TurboGears front-to-back web development
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google
Groups "TurboGears Tickets" group.
This group is read-only. No posting by normal members allowed.
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/turbogears-tickets?hl=en?hl=en
-~----------~----~----~----~------~----~------~--~---