[web] closes #1892494: emailaddress and anonymity
notice though mangle-address is weak since address won't be
mangled when fetched through rql
--- a/entities/lib.py Thu Aug 04 12:50:55 2011 +0200
+++ b/entities/lib.py Thu Aug 04 12:50:57 2011 +0200
@@ -40,6 +40,7 @@
class EmailAddress(AnyEntity):
__regid__ = 'EmailAddress'
fetch_attrs, fetch_order = fetch_config(['address', 'alias'])
+ rest_attr = 'eid'
def dc_title(self):
if self.alias:
--- a/web/views/cwuser.py Thu Aug 04 12:50:55 2011 +0200
+++ b/web/views/cwuser.py Thu Aug 04 12:50:57 2011 +0200
@@ -168,6 +168,10 @@
class CWUserManagementView(StartupView):
__regid__ = 'cw.user-management'
+ # XXX one could wish to display for instance only user's firstname/surname
+ # for non managers but filtering out NULL cause crash with an ldapuser
+ # source.
+ __select__ = match_user_groups('managers')
rql = ('Any U,USN,F,S,U,UAA,UDS, L,UAA,UDSN ORDERBY L WHERE U is CWUser, '
'U login L, U firstname F, U surname S, '
'U in_state US, US name USN, '
--- a/web/views/emailaddress.py Thu Aug 04 12:50:55 2011 +0200
+++ b/web/views/emailaddress.py Thu Aug 04 12:50:57 2011 +0200
@@ -15,9 +15,8 @@
#
# You should have received a copy of the GNU Lesser General Public License along
# with CubicWeb. If not, see <http://www.gnu.org/licenses/>.
-"""Specific views for email addresses entities
+"""Specific views for email addresses entities"""
-"""
__docformat__ = "restructuredtext en"
from logilab.mtconverter import xml_escape
@@ -85,8 +84,7 @@
class EmailAddressOneLineView(baseviews.OneLineView):
__select__ = is_instance('EmailAddress')
- def cell_call(self, row, col, **kwargs):
- entity = self.cw_rset.get_entity(row, col)
+ def entity_call(self, entity, **kwargs):
if entity.reverse_primary_email:
self.w(u'<b>')
if entity.alias:
@@ -106,8 +104,7 @@
__regid__ = 'mailto'
__select__ = is_instance('EmailAddress')
- def cell_call(self, row, col, **kwargs):
- entity = self.cw_rset.get_entity(row, col)
+ def entity_call(self, entity, **kwargs):
if entity.reverse_primary_email:
self.w(u'<b>')
if entity.alias:
@@ -130,7 +127,10 @@
__select__ = is_instance('EmailAddress')
def cell_call(self, row, col, **kwargs):
- self.wview('mailto', self.cw_rset, row=row, col=col, **kwargs)
+ if self._cw.vreg.config['mangle-emails']:
+ self.wview('oneline', self.cw_rset, row=row, col=col, **kwargs)
+ else:
+ self.wview('mailto', self.cw_rset, row=row, col=col, **kwargs)
class EmailAddressTextView(baseviews.TextView):