In a dtml document, if i use <dtml-var expr="AUTHENTICATED_USER.hasRole('xyz')"> i received a 1 for any value of xyz if i use the syntax <dtml-var expr="AUTHENTICATED_USER.has_role('xyz')"> i will receive 0 if i'm not a member of the group and 1 if i am a member, which is the correct behavior Which syntax is the correct one? Any explanation why the first syntax is not correct? Thanks
In a dtml document, if i use <dtml-var expr="AUTHENTICATED_USER.hasRole('xyz')"> i received a 1 for any value of xyz if i use the syntax <dtml-var expr="AUTHENTICATED_USER.has_role('xyz')"> i will receive 0 if i'm not a member of the group and 1 if i am a member, which is the correct behavior
Which syntax is the correct one? Any explanation why the first syntax is not correct?
To find out whether the user has the given role, you should use has_role(). hasRole is a very very old method that is deprecated, though I just looked and found that the help system (and possibly the documentation) lists it (and omits has_role, has_permission and other things that should be there). I've copied the documentation guys on this. Amos or Mike, can we get this fixed for 2.5? Brian Lloyd brian@zope.com Zope Corporation www.zope.com
"Brian Lloyd" <brian.lloyd@zope.com> wrote: <...snip...>
hasRole is a very very old method that is deprecated, though I just looked and found that the help system (and possibly the documentation) lists it (and omits has_role, has_permission and other things that should be there).
I've copied the documentation guys on this. Amos or Mike, can we get this fixed for 2.5?
*EEEP* Sorry, you win no toaster this time. This is a what Oracle people in the UK classify as a "feature" that needs to be adressed. The correct IMHO, should have been "ca we get this fixed for the *next* release, like 2.4.x?" :-) Now, if you, for whatever reason, ou feel that this will not appear in docs until 2.5, what source file(s) are we supposed to look in to find out the correct syntax? I have a candidate here: lib/python/AccessControl/User.py and the BasicUser class. Are there any more places to look? Sincerely, /dario
I've copied the documentation guys on this. Amos or Mike, can we get this fixed for 2.5?
*EEEP* Sorry, you win no toaster this time. This is a what Oracle people in the UK classify as a "feature" that needs to be adressed.
The correct IMHO, should have been "ca we get this fixed for the *next* release, like 2.4.x?" :-)
I should have said that to be clearer - however the next "planned" release will likely be 2.5. If another 2.4.x release (beyond 2.4.1, which is already frozen) happens before 2.5, I would expect it to be in that too.
Now, if you, for whatever reason, ou feel that this will not appear in docs until 2.5, what source file(s) are we supposed to look in to find out the correct syntax?
I have a candidate here:
lib/python/AccessControl/User.py and the BasicUser class.
That's correct. We also plan to start taking advantage of the new Python warn() framework to start dealing with deprecated methods. Brian Lloyd brian@zope.com Zope Corporation www.zope.com
Brian Lloyd wrote:
I've copied the documentation guys on this. Amos or Mike, can we get this fixed for 2.5?
Will do. -Amos -- Amos Latteier mailto:amos@zope.com Zope Corporation http://www.zope.com/
Brian Lloyd writes:
hasRole is a very very old method that is deprecated, though I just looked and found that the help system (and possibly the documentation) lists it (and omits has_role, has_permission and other things that should be there). I knew the online help systems needs rework:
it is vastly incomplete and partially wrong Maybe with the new Zope components infrastructure, the interfaces become part of the Online Help (that would be quite naturally). Dieter
Dieter Maurer wrote:
Brian Lloyd writes:
hasRole is a very very old method that is deprecated, though I just looked and found that the help system (and possibly the documentation) lists it (and omits has_role, has_permission and other things that should be there). I knew the online help systems needs rework:
it is vastly incomplete and partially wrong
Maybe with the new Zope components infrastructure, the interfaces become part of the Online Help (that would be quite naturally).
That's a good idea. In fact, I wrote up a project proposal suggesting the same thing a while ago: http://dev.zope.org/Wikis/DevSite/Projects/APIDocs/FrontPage Unfortunately it's currently stalled due to lack of time on the part of Mike and me. I would like to see it revived at some point, especially with components becoming a reality now. -Amos -- Amos Latteier amos@zope.com Zope Corporation http://www.zope.com/
participants (5)
-
Amos Latteier -
Brian Lloyd -
Dario Lopez-Kästen -
Dieter Maurer -
merp@SAFe-mail.net