← Back to team overview

launchpad-reviewers team mailing list archive

[Merge] lp:~cjwatson/launchpad/person-display-name into lp:launchpad

 

Colin Watson has proposed merging lp:~cjwatson/launchpad/person-display-name into lp:launchpad.

Commit message:
Rename Person.displayname to Person.display_name, leaving a property behind for compatibility.

Requested reviews:
  Launchpad code reviewers (launchpad-reviewers)

For more details, see:
https://code.launchpad.net/~cjwatson/launchpad/person-display-name/+merge/273040

Rename Person.displayname to Person.display_name, leaving a property behind for compatibility.

This begins the process of making things consistent in favour of the newer display_name style, so that we don't suffer from problems like https://bugs.launchpad.net/launchpad/+bug/1501134.  There are too many users of Person.displayname to change all at once, but it's sufficient to change constructors, assignments, code that uses it as a database column, and browser fields.
-- 
Your team Launchpad code reviewers is requested to review the proposed merge of lp:~cjwatson/launchpad/person-display-name into lp:launchpad.
=== modified file 'lib/lp/answers/model/question.py'
--- lib/lp/answers/model/question.py	2015-10-01 01:42:13 +0000
+++ lib/lp/answers/model/question.py	2015-10-01 10:28:57 +0000
@@ -561,7 +561,7 @@
             (Person, QuestionSubscription),
             QuestionSubscription.person_id == Person.id,
             QuestionSubscription.question_id == self.id,
-            ).order_by(Person.displayname)
+            ).order_by(Person.display_name)
         return results
 
     def getIndirectSubscribers(self):
@@ -1347,7 +1347,7 @@
                   LeftJoin(Person, AnswerContact.person == Person.id)]
         conditions = self._getConditionsToQueryAnswerContacts()
         results = self._store.using(*origin).find(Person, conditions)
-        return list(results.order_by(Person.displayname))
+        return list(results.order_by(Person.display_name))
 
     @property
     def direct_answer_contacts_with_languages(self):
@@ -1417,7 +1417,7 @@
         from lp.registry.model.person import Person
         return Person.select(
             " AND ".join(constraints), clauseTables=clause_tables,
-            orderBy=['displayname'], distinct=True)
+            orderBy=['display_name'], distinct=True)
 
     def getAnswerContactsForLanguage(self, language):
         """See `IQuestionTarget`."""

=== modified file 'lib/lp/app/doc/tales.txt'
--- lib/lp/app/doc/tales.txt	2015-07-08 16:05:11 +0000
+++ lib/lp/app/doc/tales.txt	2015-10-01 10:28:57 +0000
@@ -465,7 +465,7 @@
 
     >>> login('test@xxxxxxxxxxxxx')
     >>> sample_person = getUtility(IPersonSet).getByName('name12')
-    >>> sample_person.displayname = (
+    >>> sample_person.display_name = (
     ...     "Sample Person<br/><script>alert('XSS')</script>")
     >>> test_tales("person/fmt:link", person=sample_person)
     u'<a href=".../~name12"...>Sample

=== modified file 'lib/lp/archivepublisher/tests/archive-signing.txt'
--- lib/lp/archivepublisher/tests/archive-signing.txt	2015-09-25 11:04:25 +0000
+++ lib/lp/archivepublisher/tests/archive-signing.txt	2015-10-01 10:28:57 +0000
@@ -340,7 +340,7 @@
 in the default PPA context then propagated to the named-ppa. The key is
 named after the user, even if the default PPA name is something different.
 
-    >>> cprov.displayname = "Not Celso Providelo"
+    >>> cprov.display_name = "Not Celso Providelo"
     >>> named_ppa_signing_key = IArchiveSigningKey(named_ppa)
     >>> named_ppa_signing_key.generateSigningKey()
     Generating: Launchpad PPA for Not Celso Providelo

=== modified file 'lib/lp/blueprints/model/specification.py'
--- lib/lp/blueprints/model/specification.py	2015-09-28 08:13:36 +0000
+++ lib/lp/blueprints/model/specification.py	2015-10-01 10:28:57 +0000
@@ -238,7 +238,7 @@
     subscribers = SQLRelatedJoin('Person',
         joinColumn='specification', otherColumn='person',
         intermediateTable='SpecificationSubscription',
-        orderBy=['displayname', 'name'])
+        orderBy=['display_name', 'name'])
     sprint_links = SQLMultipleJoin('SprintSpecification', orderBy='id',
         joinColumn='specification')
     sprints = SQLRelatedJoin('Sprint', orderBy='name',

=== modified file 'lib/lp/bugs/model/bug.py'
--- lib/lp/bugs/model/bug.py	2015-10-01 01:42:13 +0000
+++ lib/lp/bugs/model/bug.py	2015-10-01 10:28:57 +0000
@@ -1039,7 +1039,7 @@
             BugSubscription.subscribed_by_id == SubscribedBy.id,
             Not(In(BugSubscription.person_id,
                    Select(BugMute.person_id, BugMute.bug_id == self.id)))
-            ).order_by(Person.displayname)
+            ).order_by(Person.display_name)
         return results
 
     def getIndirectSubscribers(self, recipients=None, level=None):

=== modified file 'lib/lp/bugs/stories/bugs/xx-bug-text-pages.txt'
--- lib/lp/bugs/stories/bugs/xx-bug-text-pages.txt	2011-12-30 06:14:56 +0000
+++ lib/lp/bugs/stories/bugs/xx-bug-text-pages.txt	2015-10-01 10:28:57 +0000
@@ -14,7 +14,7 @@
     >>> from lp.registry.model.person import Person
     >>> login("foo.bar@xxxxxxxxxxxxx")
     >>> mark = Person.selectOneBy(name="mark")
-    >>> mark.displayname = u"M\xe1rk Sh\xfattlew\xf2rth"
+    >>> mark.display_name = u"M\xe1rk Sh\xfattlew\xf2rth"
     >>> bug = Bug.get(1)
     >>> content = StringIO.StringIO("<html><body>bogus</body></html>")
     >>> a1 = bug.addAttachment(mark, content, "comment for file a",

=== modified file 'lib/lp/code/browser/tests/test_branchmergeproposal.py'
--- lib/lp/code/browser/tests/test_branchmergeproposal.py	2015-07-21 17:22:42 +0000
+++ lib/lp/code/browser/tests/test_branchmergeproposal.py	2015-10-01 10:28:57 +0000
@@ -11,7 +11,6 @@
     timedelta,
     )
 from difflib import unified_diff
-from urllib import quote_plus
 
 from lazr.restful.interfaces import IJSONRequestCache
 import pytz
@@ -169,6 +168,7 @@
         browser = self.getViewBrowser(bmp.merge_source, '+index')
         self.assertThat(browser.contents, HTMLContains(revision_number))
 
+
 class TestBranchMergeProposalMergedViewBzr(
     TestBranchMergeProposalMergedViewMixin, BrowserTestCase):
     """Tests for `BranchMergeProposalMergedView` for Bazaar."""
@@ -1508,7 +1508,7 @@
         bmp = self.factory.makeBranchMergeProposal()
         owner = bmp.target_branch.owner
         login_person(bmp.target_branch.owner)
-        owner.displayname = 'Eric'
+        owner.display_name = 'Eric'
         bmp.approveBranch(owner, 'some-rev', datetime(
                 year=2008, month=9, day=10, tzinfo=pytz.UTC))
         view = create_initialized_view(bmp, '+link-summary')
@@ -1520,7 +1520,7 @@
         bmp = self.factory.makeBranchMergeProposal()
         owner = bmp.target_branch.owner
         login_person(bmp.target_branch.owner)
-        owner.displayname = 'Eric'
+        owner.display_name = 'Eric'
         bmp.rejectBranch(owner, 'some-rev', datetime(
                 year=2008, month=9, day=10, tzinfo=pytz.UTC))
         view = create_initialized_view(bmp, '+link-summary')

=== modified file 'lib/lp/codehosting/inmemory.py'
--- lib/lp/codehosting/inmemory.py	2015-07-06 14:15:39 +0000
+++ lib/lp/codehosting/inmemory.py	2015-10-01 10:28:57 +0000
@@ -280,7 +280,11 @@
     is_team = False
 
     def __init__(self, name):
-        self.name = self.displayname = name
+        self.name = self.display_name = name
+
+    @property
+    def displayname(self):
+        return self.display_name
 
     def inTeam(self, person_or_team):
         if self is person_or_team:

=== modified file 'lib/lp/hardwaredb/model/hwdb.py'
--- lib/lp/hardwaredb/model/hwdb.py	2015-07-08 16:05:11 +0000
+++ lib/lp/hardwaredb/model/hwdb.py	2015-10-01 10:28:57 +0000
@@ -492,7 +492,7 @@
         else:
             user_ids = [row[0] for row in user_ids]
             result = store.find(Person, Person.id.is_in(user_ids))
-        result.order_by(Person.displayname)
+        result.order_by(Person.display_name)
         return result
 
     def hwInfoByBugRelatedUsers(

=== modified file 'lib/lp/registry/browser/person.py'
--- lib/lp/registry/browser/person.py	2015-09-16 13:30:33 +0000
+++ lib/lp/registry/browser/person.py	2015-10-01 10:28:57 +0000
@@ -1244,7 +1244,7 @@
     schema = IPerson
     label = "Review person"
     field_names = [
-        'name', 'displayname',
+        'name', 'display_name',
         'personal_standing', 'personal_standing_reason']
     custom_widget(
         'personal_standing_reason', TextAreaWidget, height=5, width=60)
@@ -2718,7 +2718,7 @@
 class PersonEditView(PersonRenameFormMixin, BasePersonEditView):
     """The Person 'Edit' page."""
 
-    field_names = ['displayname', 'name', 'mugshot', 'description',
+    field_names = ['display_name', 'name', 'mugshot', 'description',
                    'hide_email_addresses', 'verbose_bugnotifications',
                    'selfgenerated_bugnotifications',
                    'expanded_notification_footers']

=== modified file 'lib/lp/registry/browser/team.py'
--- lib/lp/registry/browser/team.py	2015-09-16 13:30:33 +0000
+++ lib/lp/registry/browser/team.py	2015-10-01 10:28:57 +0000
@@ -234,7 +234,7 @@
     * The user has a current commercial subscription.
     """
     field_names = [
-        "name", "visibility", "displayname",
+        "name", "visibility", "display_name",
         "description", "membership_policy",
         "defaultmembershipperiod", "renewal_policy",
         "defaultrenewalperiod", "teamowner",
@@ -377,7 +377,7 @@
 class TeamAdministerView(PersonAdministerView):
     """A view to administer teams on behalf of users."""
     label = "Review team"
-    default_field_names = ['name', 'displayname']
+    default_field_names = ['name', 'display_name']
 
 
 def generateTokenAndValidationEmail(email, team):
@@ -1022,13 +1022,13 @@
         failure=LaunchpadFormView.ajax_failure_handler)
     def create_action(self, action, data):
         name = data.get('name')
-        displayname = data.get('displayname')
+        display_name = data.get('display_name')
         defaultmembershipperiod = data.get('defaultmembershipperiod')
         defaultrenewalperiod = data.get('defaultrenewalperiod')
         membership_policy = data.get('membership_policy')
         teamowner = data.get('teamowner')
         team = getUtility(IPersonSet).newTeam(
-            teamowner, name, displayname, None, membership_policy,
+            teamowner, name, display_name, None, membership_policy,
             defaultmembershipperiod, defaultrenewalperiod)
         visibility = data.get('visibility')
         if visibility:
@@ -1068,7 +1068,7 @@
     next_url = None
 
     field_names = [
-        "name", "displayname", "visibility", "membership_policy",
+        "name", "display_name", "visibility", "membership_policy",
         "teamowner"]
 
     # Use a dropdown - Javascript will be used to change this to a choice
@@ -2068,9 +2068,10 @@
             else:
                 relationship = 'an indirect member'
                 full_path = [self.context] + path
-		path_template = '&rArr;'.join(['%s'] * len(full_path))
+                path_template = '&rArr;'.join(['%s'] * len(full_path))
                 path_string = structured(
-                    '(%s)' % path_template, *[team.displayname for team in full_path])
+                    '(%s)' % path_template,
+                    *[team.displayname for team in full_path])
             error = structured(
                 'Circular team memberships are not allowed. '
                 '%(new)s cannot be the new team owner, since %(context)s '

=== modified file 'lib/lp/registry/browser/tests/person-admin-views.txt'
--- lib/lp/registry/browser/tests/person-admin-views.txt	2015-01-07 00:35:53 +0000
+++ lib/lp/registry/browser/tests/person-admin-views.txt	2015-10-01 10:28:57 +0000
@@ -17,7 +17,7 @@
     >>> print view.errors
     []
     >>> view.field_names
-    ['name', 'displayname',
+    ['name', 'display_name',
      'personal_standing', 'personal_standing_reason']
     >>> view.label
     'Review person'
@@ -34,7 +34,7 @@
 
     >>> form = {
     ...     'field.name': 'zaphod',
-    ...     'field.displayname': 'Zaphod Beeblebrox',
+    ...     'field.display_name': 'Zaphod Beeblebrox',
     ...     'field.personal_standing': 'POOR',
     ...     'field.personal_standing_reason': "Zaphod's just this guy.",
     ...     'field.actions.change': 'Change',
@@ -44,7 +44,7 @@
     []
     >>> print user.name
     zaphod
-    >>> print user.displayname
+    >>> print user.display_name
     Zaphod Beeblebrox
     >>> user.personal_standing
     <DBItem PersonalStanding.POOR, ...>

=== modified file 'lib/lp/registry/browser/tests/private-team-creation-views.txt'
--- lib/lp/registry/browser/tests/private-team-creation-views.txt	2015-05-14 13:57:51 +0000
+++ lib/lp/registry/browser/tests/private-team-creation-views.txt	2015-10-01 10:28:57 +0000
@@ -51,7 +51,7 @@
     >>> foo_bar = personset.getByEmail('foo.bar@xxxxxxxxxxxxx')
     >>> form = {
     ...     'field.name': 'super-secret',
-    ...     'field.displayname': 'Shhhh',
+    ...     'field.display_name': 'Shhhh',
     ...     'field.defaultmembershipperiod': '365',
     ...     'field.defaultrenewalperiod': '',
     ...     'field.membership_policy': 'OPEN',
@@ -74,7 +74,7 @@
 
     >>> form = {
     ...     'field.name': 'super-secret2',
-    ...     'field.displayname': 'Shhhh',
+    ...     'field.display_name': 'Shhhh',
     ...     'field.defaultmembershipperiod': '365',
     ...     'field.defaultrenewalperiod': '',
     ...     'field.membership_policy': 'RESTRICTED',
@@ -96,7 +96,7 @@
     >>> login('commercial-member@xxxxxxxxxxxxx')
     >>> form = {
     ...     'field.name': 'secret-team',
-    ...     'field.displayname': 'Shhhh',
+    ...     'field.display_name': 'Shhhh',
     ...     'field.defaultmembershipperiod': '365',
     ...     'field.defaultrenewalperiod': '365',
     ...     'field.membership_policy': 'RESTRICTED',
@@ -126,7 +126,7 @@
     >>> login('foo.bar@xxxxxxxxxxxxx')
     >>> form = {
     ...     'field.name': 'secret-team',
-    ...     'field.displayname': 'Shhhh',
+    ...     'field.display_name': 'Shhhh',
     ...     'field.defaultmembershipperiod': '365',
     ...     'field.defaultrenewalperiod': '',
     ...     'field.membership_policy': 'RESTRICTED',
@@ -151,7 +151,7 @@
     >>> login('no-priv@xxxxxxxxxxxxx')
     >>> form = {
     ...     'field.name': 'secret-team',
-    ...     'field.displayname': 'Shhhh',
+    ...     'field.display_name': 'Shhhh',
     ...     'field.defaultmembershipperiod': '365',
     ...     'field.defaultrenewalperiod': '',
     ...     'field.membership_policy': 'RESTRICTED',
@@ -200,7 +200,7 @@
 
     >>> form = {
     ...     'field.name': 'super-secret3',
-    ...     'field.displayname': 'Shhhh',
+    ...     'field.display_name': 'Shhhh',
     ...     'field.defaultmembershipperiod': '365',
     ...     'field.defaultrenewalperiod': '',
     ...     'field.membership_policy': 'OPEN',
@@ -326,14 +326,14 @@
     bugtracker.
 
 All changes are aborted when a data validation error occurs.  The
-displayname for the team is the old value.
+display_name for the team is the old value.
 
     >>> transaction.commit()
     >>> super_secret2 = personset.getByName('super-secret2')
     >>> print super_secret2.name
     super-secret2
 
-    >>> print super_secret2.displayname
+    >>> print super_secret2.display_name
     Shhhh
 
 
@@ -346,7 +346,7 @@
     >>> login('foo.bar@xxxxxxxxxxxxx')
     >>> form = {
     ...     'field.name': 'private-super-secret',
-    ...     'field.displayname': 'Shhhh',
+    ...     'field.display_name': 'Shhhh',
     ...     'field.defaultmembershipperiod': '365',
     ...     'field.defaultrenewalperiod': '',
     ...     'field.membership_policy': 'RESTRICTED',
@@ -369,7 +369,7 @@
     >>> login('no-priv@xxxxxxxxxxxxx')
     >>> form = {
     ...     'field.name': 'private-top-secret',
-    ...     'field.displayname': 'Shhhh',
+    ...     'field.display_name': 'Shhhh',
     ...     'field.defaultmembershipperiod': '365',
     ...     'field.defaultrenewalperiod': '',
     ...     'field.membership_policy': 'RESTRICTED',

=== modified file 'lib/lp/registry/browser/tests/test_distroseries.py'
--- lib/lp/registry/browser/tests/test_distroseries.py	2014-11-09 22:19:51 +0000
+++ lib/lp/registry/browser/tests/test_distroseries.py	2015-10-01 10:28:57 +0000
@@ -501,7 +501,7 @@
         job.start()
         job.fail()
         with person_logged_in(series.distribution.owner):
-            series.distribution.owner.displayname = u"Bob Individual"
+            series.distribution.owner.display_name = u"Bob Individual"
         with anonymous_logged_in():
             view = create_initialized_view(series, '+portlet-derivation')
             html_content = view()

=== modified file 'lib/lp/registry/browser/tests/test_team.py'
--- lib/lp/registry/browser/tests/test_team.py	2013-01-16 06:42:14 +0000
+++ lib/lp/registry/browser/tests/test_team.py	2015-10-01 10:28:57 +0000
@@ -284,7 +284,7 @@
             view = create_initialized_view(team, name="+edit")
             self.assertEqual('team', view.widgets['name']._data)
             self.assertEqual(
-                'A Team', view.widgets['displayname']._data)
+                'A Team', view.widgets['display_name']._data)
             self.assertEqual(
                 'A great team', view.widgets['description']._data)
             self.assertEqual(
@@ -449,7 +449,7 @@
         team = self.factory.makeTeam(name="team", owner=owner)
         form = {
             'field.name': team.name,
-            'field.displayname': team.displayname,
+            'field.display_name': team.display_name,
             'field.defaultmembershipperiod': '180',
             'field.defaultrenewalperiod': '365',
             'field.membership_policy': 'RESTRICTED',
@@ -476,7 +476,7 @@
         person = self.factory.makePerson()
         form = {
             'field.actions.create': 'Create Team',
-            'field.displayname': 'liberty-land',
+            'field.display_name': 'liberty-land',
             'field.name': 'libertyland',
             'field.renewal_policy': 'NONE',
             'field.renewal_policy-empty-marker': 1,
@@ -526,7 +526,7 @@
         team_name = self.factory.getUniqueString()
         form = {
             'field.name': team_name,
-            'field.displayname': 'New Team',
+            'field.display_name': 'New Team',
             'field.membership_policy': 'RESTRICTED',
             'field.visibility': 'PRIVATE',
             'field.actions.create': 'Create',
@@ -578,7 +578,7 @@
         team_name = self.factory.getUniqueString()
         form = {
             'field.name': team_name,
-            'field.displayname': 'New Team',
+            'field.display_name': 'New Team',
             'field.visibility': 'PRIVATE',
             'field.membership_policy': 'RESTRICTED',
             'field.actions.create': 'Create',

=== modified file 'lib/lp/registry/configure.zcml'
--- lib/lp/registry/configure.zcml	2015-09-28 17:38:45 +0000
+++ lib/lp/registry/configure.zcml	2015-10-01 10:28:57 +0000
@@ -1033,7 +1033,7 @@
                 set_schema="lp.registry.interfaces.person.IPersonViewRestricted
                             lp.registry.interfaces.person.IPersonPublic
                             lp.registry.interfaces.person.ITeamPublic"
-                set_attributes="displayname icon logo visibility"/>
+                set_attributes="display_name icon logo visibility"/>
             <require
                 permission="launchpad.Moderate"
                 interface="lp.registry.interfaces.person.IPersonModerateRestricted"

=== modified file 'lib/lp/registry/doc/person-merge.txt'
--- lib/lp/registry/doc/person-merge.txt	2013-06-05 09:40:19 +0000
+++ lib/lp/registry/doc/person-merge.txt	2015-10-01 10:28:57 +0000
@@ -283,10 +283,12 @@
     ...     lead += 1
     ...     name = str(lead)
     ...     lp = PersonCreationRationale.OWNER_CREATED_LAUNCHPAD
-    ...     winner = Person(name=name+'.winner', displayname='Merge Winner',
-    ...                     creation_rationale=lp)
-    ...     loser = Person(name=name+'.loser', displayname='Merge Loser',
-    ...                     creation_rationale=lp)
+    ...     winner = Person(
+    ...         name=name+'.winner', display_name='Merge Winner',
+    ...         creation_rationale=lp)
+    ...     loser = Person(
+    ...         name=name+'.loser', display_name='Merge Loser',
+    ...         creation_rationale=lp)
     ...     yield winner, loser
     >>> endless_supply_of_players = new_players()
 

=== modified file 'lib/lp/registry/interfaces/person.py'
--- lib/lp/registry/interfaces/person.py	2015-09-17 08:52:02 +0000
+++ lib/lp/registry/interfaces/person.py	2015-10-01 10:28:57 +0000
@@ -638,13 +638,13 @@
                 "A short unique name, beginning with a lower-case "
                 "letter or number, and containing only letters, "
                 "numbers, dots, hyphens, or plus signs.")))
-    displayname = exported(
+    display_name = exported(
         StrippedTextLine(
             title=_('Display Name'), required=True, readonly=False,
             description=_(
                 "Your name as you would like it displayed throughout "
-                "Launchpad. Most people use their full name here.")),
-        exported_as='display_name')
+                "Launchpad. Most people use their full name here.")))
+    displayname = Attribute('Display name (deprecated)')
     unique_displayname = TextLine(
         title=_('Return a string of the form $displayname ($name).'))
     # NB at this stage we do not allow individual people to have their own
@@ -2023,7 +2023,7 @@
     """
     export_as_webservice_entry('team')
 
-    # Logo, Mugshot and displayname are here so that they can have a
+    # Logo, Mugshot and display_name are here so that they can have a
     # description on a Team which is different to the description they have on
     # a Person.
     logo = copy_field(
@@ -2041,8 +2041,8 @@
             "on the team page in Launchpad. It "
             "should be no bigger than 100kb in size. "))
 
-    displayname = copy_field(
-        IPerson['displayname'],
+    display_name = copy_field(
+        IPerson['display_name'],
         description=_(
             "This team's name as you would like it displayed throughout "
             "Launchpad."))
@@ -2203,7 +2203,7 @@
 
     @call_with(teamowner=REQUEST_USER)
     @rename_parameters_as(
-        displayname='display_name', teamdescription='team_description',
+        teamdescription='team_description',
         defaultmembershipperiod='default_membership_period',
         defaultrenewalperiod='default_renewal_period')
     @operation_parameters(
@@ -2211,11 +2211,11 @@
             title=_('Membership policy'), vocabulary=TeamMembershipPolicy,
             required=False, default=TeamMembershipPolicy.MODERATED))
     @export_factory_operation(
-        ITeam, ['name', 'displayname', 'teamdescription',
+        ITeam, ['name', 'display_name', 'teamdescription',
                 'defaultmembershipperiod', 'defaultrenewalperiod',
                 'subscription_policy'])
     @operation_for_version("beta")
-    def newTeam(teamowner, name, displayname, teamdescription=None,
+    def newTeam(teamowner, name, display_name, teamdescription=None,
                 membership_policy=TeamMembershipPolicy.MODERATED,
                 defaultmembershipperiod=None, defaultrenewalperiod=None,
                 subscription_policy=None):

=== modified file 'lib/lp/registry/model/mailinglist.py'
--- lib/lp/registry/model/mailinglist.py	2015-07-08 16:05:11 +0000
+++ lib/lp/registry/model/mailinglist.py	2015-10-01 10:28:57 +0000
@@ -386,7 +386,7 @@
                              TeamParticipation.team == self.team,
                              MailingListSubscription.person == Person.id,
                              MailingListSubscription.mailing_list == self)
-        return results.order_by(Person.displayname, Person.name)
+        return results.order_by(Person.display_name, Person.name)
 
     def subscribe(self, person, address=None):
         """See `IMailingList`."""
@@ -600,7 +600,7 @@
             )
         team_ids, list_ids = self._getTeamIdsAndMailingListIds(team_names)
         preferred = store.using(*tables).find(
-            (EmailAddress.email, Person.displayname, Team.name),
+            (EmailAddress.email, Person.display_name, Team.name),
             And(MailingListSubscription.mailing_listID.is_in(list_ids),
                 TeamParticipation.teamID.is_in(team_ids),
                 MailingList.teamID == TeamParticipation.teamID,
@@ -643,7 +643,7 @@
             )
         team_ids, list_ids = self._getTeamIdsAndMailingListIds(team_names)
         team_members = store.using(*tables).find(
-            (Team.name, Person.displayname, EmailAddress.email),
+            (Team.name, Person.display_name, EmailAddress.email),
             And(TeamParticipation.teamID.is_in(team_ids),
                 MailingList.status != MailingListStatus.INACTIVE,
                 Person.teamowner == None,
@@ -665,7 +665,7 @@
             Join(Team, Team.id == MailingList.teamID),
             )
         approved_posters = store.using(*tables).find(
-            (Team.name, Person.displayname, EmailAddress.email),
+            (Team.name, Person.display_name, EmailAddress.email),
             And(MessageApproval.mailing_listID.is_in(list_ids),
                 MessageApproval.status.is_in(MESSAGE_APPROVAL_STATUSES),
                 EmailAddress.status.is_in(EMAIL_ADDRESS_STATUSES),

=== modified file 'lib/lp/registry/model/person.py'
--- lib/lp/registry/model/person.py	2015-09-22 15:04:52 +0000
+++ lib/lp/registry/model/person.py	2015-10-01 10:28:57 +0000
@@ -404,10 +404,10 @@
 
 def person_sort_key(person):
     """Identical to `person_sort_key` in the database."""
-    # Strip noise out of displayname. We do not have to bother with
+    # Strip noise out of display_name. We do not have to bother with
     # name, as we know it is just plain ascii.
-    displayname = _person_sort_re.sub(u'', person.displayname.lower())
-    return "%s, %s" % (displayname.strip(), person.name)
+    display_name = _person_sort_re.sub(u'', person.display_name.lower())
+    return "%s, %s" % (display_name.strip(), person.name)
 
 
 @implementer(IPersonSettings)
@@ -545,7 +545,11 @@
         displayname = self.displayname.encode('ASCII', 'backslashreplace')
         return '<Person at 0x%x %s (%s)>' % (id(self), self.name, displayname)
 
-    displayname = StringCol(dbName='displayname', notNull=True)
+    display_name = StringCol(dbName='displayname', notNull=True)
+
+    @property
+    def displayname(self):
+        return self.display_name
 
     teamdescription = StringCol(dbName='teamdescription', default=None)
     homepage_content = StringCol(default=None)
@@ -1708,7 +1712,7 @@
             Person.merged == None)
         return IStore(Person).find(
             Person, query).order_by(
-                Upper(Person.displayname), Upper(Person.name))
+                Upper(Person.display_name), Upper(Person.name))
 
     @cachedproperty
     def administrated_teams(self):
@@ -2136,7 +2140,7 @@
                     TeamMembershipStatus.APPROVED,
                     TeamMembershipStatus.ADMIN,
                     ]))).order_by(
-                        Upper(Team.displayname),
+                        Upper(Team.display_name),
                         Upper(Team.name))
 
     def anyone_can_join(self):
@@ -3414,7 +3418,7 @@
                 trust_email=False)
         return person
 
-    def newTeam(self, teamowner, name, displayname, teamdescription=None,
+    def newTeam(self, teamowner, name, display_name, teamdescription=None,
                 membership_policy=TeamMembershipPolicy.MODERATED,
                 defaultmembershipperiod=None, defaultrenewalperiod=None,
                 subscription_policy=None):
@@ -3426,11 +3430,12 @@
         if subscription_policy is not None:
             # Support 1.0 API.
             membership_policy = subscription_policy
-        team = Person(teamowner=teamowner, name=name, displayname=displayname,
-                description=teamdescription,
-                defaultmembershipperiod=defaultmembershipperiod,
-                defaultrenewalperiod=defaultrenewalperiod,
-                membership_policy=membership_policy)
+        team = Person(
+            teamowner=teamowner, name=name, display_name=display_name,
+            description=teamdescription,
+            defaultmembershipperiod=defaultmembershipperiod,
+            defaultrenewalperiod=defaultrenewalperiod,
+            membership_policy=membership_policy)
         notify(ObjectCreatedEvent(team))
         # Here we add the owner as a team admin manually because we know what
         # we're doing (so we don't need to do any sanity checks) and we don't
@@ -3501,7 +3506,7 @@
         else:
             account_id = account.id
         person = Person(
-            name=name, displayname=displayname, accountID=account_id,
+            name=name, display_name=displayname, accountID=account_id,
             creation_rationale=rationale, creation_comment=comment,
             hide_email_addresses=hide_email_addresses, registrant=registrant)
         return person

=== modified file 'lib/lp/registry/services/sharingservice.py'
--- lib/lp/registry/services/sharingservice.py	2015-07-08 16:05:11 +0000
+++ lib/lp/registry/services/sharingservice.py	2015-10-01 10:28:57 +0000
@@ -582,10 +582,10 @@
         policies = getUtility(IAccessPolicySource).findByPillar([pillar])
         ap_grant_flat = getUtility(IAccessPolicyGrantFlatSource)
         # XXX 2012-03-22 wallyworld bug 961836
-        # We want to use person_sort_key(Person.displayname, Person.name) but
+        # We want to use person_sort_key(Person.display_name, Person.name) but
         # StormRangeFactory doesn't support that yet.
         grant_permissions = ap_grant_flat.findGranteePermissionsByPolicy(
-            policies).order_by(Person.displayname, Person.name)
+            policies).order_by(Person.display_name, Person.name)
         return grant_permissions
 
     @available_with_permission('launchpad.Driver', 'pillar')

=== modified file 'lib/lp/registry/tests/test_mlists.py'
--- lib/lp/registry/tests/test_mlists.py	2015-09-09 16:48:52 +0000
+++ lib/lp/registry/tests/test_mlists.py	2015-10-01 10:28:57 +0000
@@ -364,7 +364,7 @@
     def test_import_existing_with_nonascii_name(self):
         # Make sure that a person with a non-ascii name, who's already a
         # member of the list, gets a proper log message.
-        self.anne.displayname = u'\u1ea2nn\u1ebf P\u1ec5rs\u1ed1n'
+        self.anne.display_name = u'\u1ea2nn\u1ebf P\u1ec5rs\u1ed1n'
         importer = Importer('aardvarks', self.logger)
         self.anne.join(self.team)
         self.mailing_list.subscribe(self.anne)

=== modified file 'lib/lp/registry/tests/test_person_sort_key.py'
--- lib/lp/registry/tests/test_person_sort_key.py	2012-01-01 02:58:52 +0000
+++ lib/lp/registry/tests/test_person_sort_key.py	2015-10-01 10:28:57 +0000
@@ -50,7 +50,7 @@
         # Case conversion is handled correctly using Unicode.
         self.assertSortKeysEqual(
             u"Bj\N{LATIN CAPITAL LETTER O WITH DIAERESIS}rn", "bjorn",
-            u"bj\xf6rn, bjorn") # Lower case o with diaeresis
+            u"bj\xf6rn, bjorn")  # Lower case o with diaeresis
 
 
 class TestPersonSortKeyInDatabase(TestPersonSortKeyBase, TestCase):
@@ -66,7 +66,7 @@
         super(TestPersonSortKeyInDatabase, self).tearDown()
         self.con.close()
 
-    def get_person_sort_key(self, displayname, name):
+    def get_person_sort_key(self, display_name, name):
         '''Calls the `person_sort_key` stored procedure.
 
         Note that although the stored procedure returns a UTF-8 encoded
@@ -76,28 +76,26 @@
         # pass it UTF-8 encoded strings to match our database encoding.
         self.cur.execute(
             "SELECT person_sort_key(%s, %s)", (
-                displayname.encode("UTF-8"), name.encode("UTF-8")))
+                display_name.encode("UTF-8"), name.encode("UTF-8")))
         return self.cur.fetchone()[0]
 
-    def assertSortKeysEqual(self, displayname, name, expected):
+    def assertSortKeysEqual(self, display_name, name, expected):
         # The sort key from the database matches the expected sort key.
         self.assertEqual(
-            expected, self.get_person_sort_key(
-                displayname, name))
+            expected, self.get_person_sort_key(display_name, name))
 
 
 class PersonNames:
     """A fake with enough information for `person_sort_key`."""
 
-    def __init__(self, displayname, name):
-        self.displayname = displayname
+    def __init__(self, display_name, name):
+        self.display_name = display_name
         self.name = name
 
 
 class TestPersonSortKeyInProcess(TestPersonSortKeyBase, TestCase):
 
-    def assertSortKeysEqual(self, displayname, name, expected):
+    def assertSortKeysEqual(self, display_name, name, expected):
         # The sort key calculated in-process matches the expected sort key.
         self.assertEqual(
-            expected, person_sort_key(
-                PersonNames(displayname, name)))
+            expected, person_sort_key(PersonNames(display_name, name)))

=== modified file 'lib/lp/registry/tests/test_personset.py'
--- lib/lp/registry/tests/test_personset.py	2015-03-10 22:07:32 +0000
+++ lib/lp/registry/tests/test_personset.py	2015-10-01 10:28:57 +0000
@@ -265,7 +265,7 @@
     def makePerson(self, account):
         return self.store.add(Person(
             name='acc%d' % account.id, account=account,
-            displayname='Displayname',
+            display_name='Displayname',
             creation_rationale=PersonCreationRationale.UNKNOWN))
 
     def makeEmailAddress(self, email, person):

=== modified file 'lib/lp/registry/vocabularies.py'
--- lib/lp/registry/vocabularies.py	2015-07-08 16:05:11 +0000
+++ lib/lp/registry/vocabularies.py	2015-10-01 10:28:57 +0000
@@ -367,7 +367,7 @@
 class UserTeamsParticipationVocabulary(SQLObjectVocabularyBase):
     """Describes the public teams in which the current user participates."""
     _table = Person
-    _orderBy = 'displayname'
+    _orderBy = 'display_name'
 
     INCLUDE_PRIVATE_TEAM = False
 
@@ -412,7 +412,7 @@
     a preferred email address, that is, unvalidated person profiles.
     """
 
-    _orderBy = ['displayname']
+    _orderBy = ['display_name']
     displayname = 'Select a Person or Team'
     step_title = 'Search'
 
@@ -443,7 +443,7 @@
     accounts to merge. You *don't* want to use it.
     """
 
-    _orderBy = ['displayname']
+    _orderBy = ['display_name']
     displayname = 'Select a Person to Merge'
     step_title = 'Search'
     must_have_email = True
@@ -579,7 +579,7 @@
                 get_person_visibility_terms(getUtility(ILaunchBag).user),
                 Person.merged == None,
                 *extra_clauses)
-            result.order_by(Person.displayname, Person.name)
+            result.order_by(Person.display_name, Person.name)
         else:
             # Do a full search based on the text given.
 
@@ -668,7 +668,7 @@
                         1) DESC""" % self._karma_context_constraint)
             else:
                 rank_order = SQL("rank DESC")
-            result.order_by(rank_order, Person.displayname, Person.name)
+            result.order_by(rank_order, Person.display_name, Person.name)
         result.config(limit=self.LIMIT)
 
         # We will be displaying the person's irc nick(s) and emails in the

=== modified file 'lib/lp/services/database/doc/db-policy.txt'
--- lib/lp/services/database/doc/db-policy.txt	2014-01-30 15:04:06 +0000
+++ lib/lp/services/database/doc/db-policy.txt	2015-10-01 10:28:57 +0000
@@ -19,7 +19,7 @@
     >>> writable_janitor = IMasterStore(Person).find(
     ...     Person, Person.name == 'janitor').one()
 
-    >>> writable_janitor.displayname = 'Jack the Janitor'
+    >>> writable_janitor.display_name = 'Jack the Janitor'
     >>> transaction.commit()
 
 Sometimes though we know we will not make changes and don't care much
@@ -37,7 +37,7 @@
     >>> ro_janitor is writable_janitor
     False
 
-    >>> ro_janitor.displayname = 'Janice the Janitor'
+    >>> ro_janitor.display_name = 'Janice the Janitor'
     >>> transaction.commit()
     Traceback (most recent call last):
     ...

=== modified file 'lib/lp/services/database/doc/storm.txt'
--- lib/lp/services/database/doc/storm.txt	2013-06-20 05:50:00 +0000
+++ lib/lp/services/database/doc/storm.txt	2015-10-01 10:28:57 +0000
@@ -71,7 +71,7 @@
     >>> main_slave = ISlaveStore(Person)
     >>> t = transaction.begin()
     >>> person = main_slave.find(Person, name='mark').one()
-    >>> person.displayname = 'Cannot change'
+    >>> person.display_name = 'Cannot change'
     >>> transaction.commit()
     Traceback (most recent call last):
     ...
@@ -80,7 +80,7 @@
     >>> transaction.abort()
     >>> t = transaction.begin()
     >>> person = main_slave.find(Person, name='mark').one()
-    >>> IMasterObject(person).displayname = 'Can change'
+    >>> IMasterObject(person).display_name = 'Can change'
     >>> transaction.commit()
 
 

=== modified file 'lib/lp/services/mail/doc/sending-mail.txt'
--- lib/lp/services/mail/doc/sending-mail.txt	2015-07-21 09:04:01 +0000
+++ lib/lp/services/mail/doc/sending-mail.txt	2015-10-01 10:28:57 +0000
@@ -138,11 +138,11 @@
     u'Inneh\xe5ll'
 
 
-If we use simple_sendmail_from_person, the person's displayname can
+If we use simple_sendmail_from_person, the person's display_name can
 contain non-ASCII characters:
 
     >>> login('foo.bar@xxxxxxxxxxxxx')
-    >>> foo_bar.displayname = u'F\xf6\xf6 B\u0105r'
+    >>> foo_bar.display_name = u'F\xf6\xf6 B\u0105r'
     >>> msgid = simple_sendmail_from_person(
     ...     person=foo_bar,
     ...     to_addrs='Sample Person <test@xxxxxxxxxxxxx>',
@@ -172,7 +172,7 @@
 surrounded by quotes and quoted if necessary:
 
     >>> login('foo.bar@xxxxxxxxxxxxx')
-    >>> foo_bar.displayname = u'Foo [Baz] " Bar'
+    >>> foo_bar.display_name = u'Foo [Baz] " Bar'
     >>> msgid = simple_sendmail_from_person(
     ...     person=foo_bar,
     ...     to_addrs='Sample Person <test@xxxxxxxxxxxxx>',

=== modified file 'lib/lp/services/verification/browser/logintoken.py'
--- lib/lp/services/verification/browser/logintoken.py	2015-09-28 17:38:45 +0000
+++ lib/lp/services/verification/browser/logintoken.py	2015-10-01 10:28:57 +0000
@@ -173,7 +173,7 @@
 
     schema = ITeam
     field_names = [
-        'teamowner', 'displayname', 'description', 'membership_policy',
+        'teamowner', 'display_name', 'description', 'membership_policy',
         'defaultmembershipperiod', 'renewal_policy', 'defaultrenewalperiod']
     label = 'Claim Launchpad team'
     custom_widget('description', TextAreaWidget, height=10, width=30)

=== modified file 'lib/lp/services/webapp/doc/test_adapter_permissions.txt'
--- lib/lp/services/webapp/doc/test_adapter_permissions.txt	2012-09-28 06:34:26 +0000
+++ lib/lp/services/webapp/doc/test_adapter_permissions.txt	2015-10-01 10:28:57 +0000
@@ -19,7 +19,7 @@
     >>> t = transaction.begin()
     >>> main_slave = getUtility(IStoreSelector).get(MAIN_STORE, SLAVE_FLAVOR)
     >>> janitor = main_slave.find(Person, name='janitor').one()
-    >>> janitor.displayname = 'Ben Dover'
+    >>> janitor.display_name = 'Ben Dover'
     >>> transaction.commit()
     Traceback (most recent call last):
     ...
@@ -29,7 +29,7 @@
 
     >>> transaction.abort()
     >>> t = transaction.begin()
-    >>> main_slave.find(Person, name='janitor').one().displayname = 'BenD'
+    >>> main_slave.find(Person, name='janitor').one().display_name = 'BenD'
     >>> transaction.commit()
     Traceback (most recent call last):
     ...
@@ -40,9 +40,9 @@
 
     >>> t = transaction.begin()
     >>> main_master = getUtility(IStoreSelector).get(MAIN_STORE, MASTER_FLAVOR)
-    >>> main_master.find(Person, name='janitor').one().displayname = 'BenD'
+    >>> main_master.find(Person, name='janitor').one().display_name = 'BenD'
     >>> transaction.commit()
     >>> t = transaction.begin()
-    >>> main_master.find(Person, name='janitor').one().displayname
+    >>> main_master.find(Person, name='janitor').one().display_name
     u'BenD'
     >>> transaction.abort()

=== modified file 'lib/lp/services/webapp/tests/test_batching.py'
--- lib/lp/services/webapp/tests/test_batching.py	2015-02-19 05:49:54 +0000
+++ lib/lp/services/webapp/tests/test_batching.py	2015-10-01 10:28:57 +0000
@@ -94,7 +94,7 @@
     def test_getOrderValuesFor__two_sort_columns(self):
         # Sorting by more than one column is supported.
         resultset = self.makeStormResultSet()
-        resultset.order_by(Person.displayname, Person.name)
+        resultset.order_by(Person.display_name, Person.name)
         range_factory = StormRangeFactory(resultset)
         order_values = range_factory.getOrderValuesFor(resultset[0])
         self.assertEqual(
@@ -394,18 +394,18 @@
         resultset = self.makeStormResultSet()
         range_factory = StormRangeFactory(resultset, self.logError)
         order_by = [
-            Person.id, Person.datecreated, Person.name, Person.displayname]
+            Person.id, Person.datecreated, Person.name, Person.display_name]
         limits = [1, datetime(2011, 07, 25, 0, 0, 0), 'foo', 'bar']
         result = range_factory.limitsGroupedByOrderDirection(order_by, limits)
         self.assertEqual([(order_by, limits)], result)
         order_by = [
             Desc(Person.id), Desc(Person.datecreated), Desc(Person.name),
-            Desc(Person.displayname)]
+            Desc(Person.display_name)]
         result = range_factory.limitsGroupedByOrderDirection(order_by, limits)
         self.assertEqual([(order_by, limits)], result)
         order_by = [
             Person.id, Person.datecreated, Desc(Person.name),
-            Desc(Person.displayname)]
+            Desc(Person.display_name)]
         result = range_factory.limitsGroupedByOrderDirection(order_by, limits)
         self.assertEqual(
             [(order_by[:2], limits[:2]), (order_by[2:], limits[2:])], result)
@@ -441,7 +441,7 @@
         range_factory = StormRangeFactory(resultset, self.logError)
         order_by = [
             Person.id, Person.datecreated, Desc(Person.name),
-            Desc(Person.displayname)]
+            Desc(Person.display_name)]
         limits = [
             1, datetime(2011, 07, 25, 0, 0, 0, tzinfo=pytz.UTC), 'foo', 'bar']
         limits = range_factory.limitsGroupedByOrderDirection(order_by, limits)

=== modified file 'lib/lp/services/webservice/stories/xx-service.txt'
--- lib/lp/services/webservice/stories/xx-service.txt	2014-01-30 15:04:06 +0000
+++ lib/lp/services/webservice/stories/xx-service.txt	2015-10-01 10:28:57 +0000
@@ -100,7 +100,7 @@
     >>> print response.getheader('status')
     401 Unauthorized
     >>> print response.body
-    (<Person at...>, 'displayname', 'launchpad.Edit')
+    (<Person at...>, 'display_name', 'launchpad.Edit')
 
 A completely unsigned web service request is treated as an anonymous
 request, with the OAuth consumer name being equal to the User-Agent.

=== modified file 'lib/lp/soyuz/doc/soyuz-set-of-uploads.txt'
--- lib/lp/soyuz/doc/soyuz-set-of-uploads.txt	2015-08-25 14:05:24 +0000
+++ lib/lp/soyuz/doc/soyuz-set-of-uploads.txt	2015-10-01 10:28:57 +0000
@@ -316,7 +316,7 @@
 
     >>> from lp.registry.interfaces.person import IPersonSet
     >>> name16 = getUtility(IPersonSet).getByName('name16')
-    >>> name16.displayname = "Foo B. Bar"
+    >>> name16.display_name = "Foo B. Bar"
 
 Check the email recipient for displayname containing special chars,
 '.', must be rfc2047 compliant:
@@ -362,7 +362,7 @@
 
 Revert changes:
 
-    >>> name16.displayname = "Foo Bar"
+    >>> name16.display_name = "Foo Bar"
 
 Check if we forcibly add the changer as recipient for "sync" uploads,
 which contains unsigned changesfile. Ensure it sends email to the

=== modified file 'lib/lp/soyuz/stories/soyuz/xx-distribution-archives.txt'
--- lib/lp/soyuz/stories/soyuz/xx-distribution-archives.txt	2015-06-26 14:00:41 +0000
+++ lib/lp/soyuz/stories/soyuz/xx-distribution-archives.txt	2015-10-01 10:28:57 +0000
@@ -126,7 +126,7 @@
     ...     copy_location)
     >>> copy_archive = naked_copy_location.archive
     >>> copy_archive.private = True
-    >>> copy_archive.owner.displayname = "Harry Potter"
+    >>> copy_archive.owner.display_name = "Harry Potter"
     >>> package_copy_request = ubuntu.main_archive.requestPackageCopy(
     ...     naked_copy_location, copy_archive.owner)
     >>> pub_src = stp.getPubSource(

=== modified file 'lib/lp/translations/browser/tests/test_pofile_view.py'
--- lib/lp/translations/browser/tests/test_pofile_view.py	2015-02-19 23:22:05 +0000
+++ lib/lp/translations/browser/tests/test_pofile_view.py	2015-10-01 10:28:57 +0000
@@ -3,7 +3,6 @@
 
 __metaclass__ = type
 
-from storm.store import Store
 from testtools.matchers import Equals
 from zope.component import getUtility
 
@@ -29,7 +28,6 @@
 from lp.translations.enums import TranslationPermission
 from lp.translations.interfaces.potemplate import IPOTemplateSet
 from lp.translations.interfaces.translationsperson import ITranslationsPerson
-from lp.translations.model.pofiletranslator import POFileTranslator
 
 
 class TestQueryCount(TestCaseWithFactory):
@@ -333,7 +331,7 @@
         pofile = self.factory.makePOFile('ie')
         translator_entry = self._makeTranslationTeam(pofile)
         self._setTeamGuide(pofile, team=translator_entry)
-        translator_entry.translator.displayname = "<blink>Y</blink>"
+        translator_entry.translator.display_name = "<blink>Y</blink>"
 
         view = self._makeView(pofile=pofile)
         self.assertIn(


Follow ups