equal
deleted
inserted
replaced
26 |
26 |
27 # import Zope3 packages |
27 # import Zope3 packages |
28 from zc.set import Set |
28 from zc.set import Set |
29 from zope.component import getUtility |
29 from zope.component import getUtility |
30 from zope.deprecation.deprecation import deprecate |
30 from zope.deprecation.deprecation import deprecate |
|
31 from zope.i18n import translate |
31 from zope.interface import implements |
32 from zope.interface import implements |
32 from zope.security.proxy import removeSecurityProxy |
33 from zope.security.proxy import removeSecurityProxy |
33 |
34 |
34 # import local packages |
35 # import local packages |
|
36 from ztfy.utils.request import getRequest |
|
37 |
|
38 from ztfy.utils import _ |
35 |
39 |
36 |
40 |
37 def unproxied(value): |
41 def unproxied(value): |
38 """Remove security proxies from given value ; if value is a list or dict, all elements are unproxied""" |
42 """Remove security proxies from given value ; if value is a list or dict, all elements are unproxied""" |
39 if isinstance(value, (list, PersistentList)): |
43 if isinstance(value, (list, PersistentList)): |
58 |
62 |
59 implements(IPrincipalInfo) |
63 implements(IPrincipalInfo) |
60 |
64 |
61 def __init__(self, id): |
65 def __init__(self, id): |
62 self.id = id |
66 self.id = id |
|
67 self.request = getRequest() |
63 |
68 |
64 @property |
69 @property |
65 def title(self): |
70 def title(self): |
66 return _("< missing principal %s >") % self.id |
71 return translate(_("< missing principal %s >"), context=self.request) % self.id |
67 |
72 |
68 @property |
73 @property |
69 def description(self): |
74 def description(self): |
70 return _("This principal can't be found in any authentication utility...") |
75 return translate(_("This principal can't be found in any authentication utility..."), context=self.request) |
71 |
76 |
72 |
77 |
73 @deprecate("ztfy.utils.security.getPrincipal is deprecated. Use ztfy.security.search.getPrincipal function instead.") |
78 @deprecate("ztfy.utils.security.getPrincipal is deprecated. Use ztfy.security.search.getPrincipal function instead.") |
74 def getPrincipal(uid): |
79 def getPrincipal(uid): |
75 principals = getUtility(IAuthentication) |
80 principals = getUtility(IAuthentication) |