================================== Differences between Zope2 and Grok ================================== :Author: Vincent Fretin :Version: unkown Get the user id --------------- Zope 2:: self.request.AUTHENTICATED_USER.getId() Dolmen:: self.request.principal.id Check if user is anonymous -------------------------- Zope 2:: portal_membership.isAnonymousUser() What this code do is actually:: u = getSecurityManager().getUser() return u is None or u.getUserName() == 'Anonymous User' Dolmen:: from zope.authentication.interfaces import IUnauthenticatedPrincipal IUnauthenticatedPrincipal.providedBy(self.request.principal) Example how to retrieve the email from the authenticated user ------------------------------------------------------------- Zope 2 / Plone:: self.request.AUTHENTICATED_USER.getProperty('email') Dolmen:: from menhir.contenttype.user.user import IUser email = IUser(self.request.principal).email Get the absolute ur of an object -------------------------------- Zope 2:: self.context.absolute_url() Grok:: from zope.traversing.browser.absoluteurl import absoluteURL absoluteURL(self.context, self.request) or simply in a grok.View:: self.url(self.context)