1
# Copyright 2011 Canonical Ltd. This software is licensed under the
2
# GNU Affero General Public License version 3 (see the file LICENSE).
4
"""Launchpad-specific field marshallers for the web service."""
13
from lazr.restful.marshallers import (
14
TextFieldMarshaller as LazrTextFieldMarshaller,
16
from zope.app.security.interfaces import IUnauthenticatedPrincipal
18
from lp.services.utils import obfuscate_email
21
class TextFieldMarshaller(LazrTextFieldMarshaller):
22
"""Do not expose email addresses for anonymous users."""
24
def unmarshall(self, entry, value):
25
"""See `IFieldMarshaller`.
27
Return the value as is.
29
if (value is not None and
30
IUnauthenticatedPrincipal.providedBy(self.request.principal)):
31
return obfuscate_email(value)