Changeset 7175 for main/waeup.sirp/trunk/src/waeup
- Timestamp:
- 23 Nov 2011, 07:19:16 (13 years ago)
- Location:
- main/waeup.sirp/trunk/src/waeup/sirp
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
main/waeup.sirp/trunk/src/waeup/sirp/browser/viewlets.py
r7172 r7175 3 3 import grok 4 4 5 from zope.component import getMultiAdapter, queryAdapter , getUtility5 from zope.component import getMultiAdapter, queryAdapter 6 6 from zope.interface import Interface 7 7 from zope.location.interfaces import ISite 8 8 from zope.traversing.browser import absoluteURL 9 from zope.pluggableauth.interfaces import IAuthenticatorPlugin10 9 from waeup.sirp.browser.pages import ( 11 10 UniversityPage, FacultyContainerPage, DatacenterPage, FacultyPage, … … 17 16 IWAeUPXMLImporter, IDataCenter) 18 17 from waeup.sirp.browser.layout import WAeUPPage 18 from waeup.sirp.utils.helpers import get_user_account 19 19 20 20 grok.templatedir('templates') … … 339 339 icon = '' 340 340 341 def getUserAccount(self):342 """Return local user account.343 """344 principal_id = self.request.principal.id345 authenticator = getUtility(IAuthenticatorPlugin, name='users')346 account = authenticator.getAccount(principal_id)347 return account348 349 341 @property 350 342 def url(self): 351 account_object = self.getUserAccount()343 account_object = get_user_account(self.request) 352 344 if account_object: 353 return absoluteURL(account_object, self.request)345 return self.view.url(account_object) 354 346 return 355 347 -
main/waeup.sirp/trunk/src/waeup/sirp/utils/helpers.py
r7137 r7175 8 8 from cStringIO import StringIO 9 9 from docutils.core import publish_string 10 from zope.component import getUtility 10 11 from zope.component.interfaces import IFactory 11 12 from zope.interface import implementedBy … … 14 15 from zope.security.interfaces import NoInteraction 15 16 from zope.security.management import getInteraction 17 from zope.pluggableauth.interfaces import IAuthenticatorPlugin 16 18 17 19 BUFSIZE = 8 * 1024 … … 451 453 file_like_obj.seek(0, 2) # seek to last position in file 452 454 return file_like_obj.tell() 455 456 def get_user_account(request): 457 """Return local user account. 458 """ 459 principal_id = request.principal.id 460 authenticator = getUtility(IAuthenticatorPlugin, name='users') 461 account = authenticator.getAccount(principal_id) 462 return account 463
Note: See TracChangeset for help on using the changeset viewer.