← Back to team overview

launchpad-reviewers team mailing list archive

[Merge] lp:~sinzui/launchpad/contact-launchpad-0 into lp:launchpad/devel

 

Curtis Hovey has proposed merging lp:~sinzui/launchpad/contact-launchpad-0 into lp:launchpad/devel.

Requested reviews:
  Launchpad code reviewers (launchpad-reviewers)
Related bugs:
  #440244 +review-licenses page should be sorted by date not alphabetically
  https://bugs.launchpad.net/bugs/440244
  #643727 notifyCommercialMailingList does not need to send email to Launchpad
  https://bugs.launchpad.net/bugs/643727


This is my branch to point commercial inquires to the commercial@ address.

    lp:~sinzui/launchpad/contact-launchpad-0
    Diff size: 321
    Launchpad bug:
        https://bugs.launchpad.net/bugs/643727
        https://bugs.launchpad.net/bugs/440244
    Test command: ./bin/test -vv \
        -t project-add-views -t TestProductLicenseMixin -t commercial
    Pre-implementation: bac
    Target release: 10.10


Point the commercial inquires to the commercial@ address
--------------------------------------------------------

notifyCommercialMailingList() is A) not sending to the commercial list, but to
feedback, and B) the email is not needed because projects are reviewed
everyday in the Web report. Stop sending emails from this method. Ensure that
all licensing/commercial emails are really sent to commercial@

There are a few cases in the templates where users are directed to send
commercial inquiries to feedback@

+review-licenses page should be sorted by date not alphabetically


Rules
-----

    * Remove the code that send an email to the commercial list when
      a users registers a project that will require review.
    * Updated commercial directions to use the commercial@ email address.
    * Sort +review-licenses by alphabetically


QA
--

    * For a project you control on edge, visit the Change details page.
    * Choose Other/Proprietary
    * Verify the Contact us link that appears is to commercial@.
    * Submit the form
    * Verify the contact us link below the licenses points to commercial@
    * Verify an email is not sent to commercial@
    * Remove the licenses.


Lint
----

Linting changed files:
  lib/canonical/widgets/templates/license.pt
  lib/lp/registry/browser/product.py
  lib/lp/registry/browser/tests/project-add-views.txt
  lib/lp/registry/browser/tests/test_product.py
  lib/lp/registry/doc/commercialsubscription.txt
  lib/lp/registry/model/product.py
  lib/lp/registry/templates/product-portlet-requires-subscription.pt


Test
----

Updated tests to not verify an email sent to commercial@ when a special
license is selected.
    * lib/lp/registry/browser/tests/project-add-views.txt
    * lib/lp/registry/browser/tests/test_product.py

Updated test to verify projects are sorted by date.
    * lib/lp/registry/doc/commercialsubscription.txt


Implementation
--------------

Changed feedback@ to commercial@.
    * lib/canonical/widgets/templates/license.pt
    * lib/lp/registry/templates/product-portlet-requires-subscription.pt

Removed the rule to send an email to the commercial@ list.
    * lib/lp/registry/browser/product.py

Updated the sort order.
    * lib/lp/registry/model/product.py
-- 
https://code.launchpad.net/~sinzui/launchpad/contact-launchpad-0/+merge/36658
Your team Launchpad code reviewers is requested to review the proposed merge of lp:~sinzui/launchpad/contact-launchpad-0 into lp:launchpad/devel.
=== modified file 'lib/canonical/widgets/templates/license.pt'
--- lib/canonical/widgets/templates/license.pt	2010-08-26 23:51:10 +0000
+++ lib/canonical/widgets/templates/license.pt	2010-09-26 14:55:59 +0000
@@ -245,7 +245,7 @@
             voucher management page</a>.
         </li>
       </ol>
-      <a href="mailto:feedback@xxxxxxxxxxxxx";>Contact us</a>
+      <a href="mailto:commercial@xxxxxxxxxxxxx";>Contact us</a>
       for more information regarding commercial subscriptions.
     </div>
 </div>

=== modified file 'lib/lp/registry/browser/product.py'
--- lib/lp/registry/browser/product.py	2010-09-24 18:12:48 +0000
+++ lib/lp/registry/browser/product.py	2010-09-26 14:55:59 +0000
@@ -297,14 +297,13 @@
             pass
 
     def notifyCommercialMailingList(self):
-        """Email feedback@xxxxxxxxxxxxx to review product license."""
-        if (License.OTHER_PROPRIETARY in self.product.licenses
-            or License.OTHER_OPEN_SOURCE in self.product.licenses):
-            review_needed = True
-        elif (len(self.product.licenses) == 1
-            and License.DONT_KNOW in self.product.licenses):
-            review_needed = False
-        else:
+        """Notify user about Launchpad license rules."""
+        licenses = list(self.product.licenses)
+        needs_email = (
+            License.OTHER_PROPRIETARY in licenses
+            or License.OTHER_OPEN_SOURCE in licenses
+            or [License.DONT_KNOW] == licenses)
+        if not needs_email:
             # The project has a recognized license.
             return
 
@@ -332,16 +331,6 @@
             product_summary=indent(self.product.summary),
             license_titles=indent(license_titles),
             license_info=indent(self.product.license_info))
-        if review_needed:
-            # Email the Commercial team that a project needs review.
-            subject = (
-                "Project License Submitted for %(product_name)s "
-                "by %(user_name)s" % substitutions)
-            template = helpers.get_email_template('product-license.txt')
-            message = template % substitutions
-            simple_sendmail(
-                from_address, commercial_address,
-                subject, message, headers={'Reply-To': user_address})
         # Email the user about license policy.
         subject = (
             "License information for %(product_name)s "

=== modified file 'lib/lp/registry/browser/tests/project-add-views.txt'
--- lib/lp/registry/browser/tests/project-add-views.txt	2010-08-10 20:02:08 +0000
+++ lib/lp/registry/browser/tests/project-add-views.txt	2010-09-26 14:55:59 +0000
@@ -159,8 +159,9 @@
 Feedback notification
 ---------------------
 
-When projects are created with the Other/Proprietary license, a message is
-sent to feedback@xxxxxxxxxxxxx.
+When projects are created with the Other/Proprietary, Other/Open Source or
+I Don't Know license, a message is sent to the user explaining the licensing
+rules.
 
     >>> form = {
     ...     'field.displayname': 'Badger',
@@ -241,30 +242,6 @@
     The Launchpad team.
     <BLANKLINE>
     ----------------------------------------
-    From: Launchpad <noreply@xxxxxxxxxxxxx>
-    To: Commercial <commercial@xxxxxxxxxxxxx>
-    Subject: Project License Submitted for badger by name16
-    Please review this project's licenses.
-    http://launchpad.dev/badger
-    <BLANKLINE>
-    User: Foo Bar (name16)
-    <BLANKLINE>
-    <BLANKLINE>
-    Project Name: badger
-    <BLANKLINE>
-    <BLANKLINE>
-    Project Summary:
-        There's the Badger!
-    <BLANKLINE>
-    <BLANKLINE>
-    Licenses:
-        Other/Proprietary
-    <BLANKLINE>
-    <BLANKLINE>
-    License info:
-        The Badger(tm) License
-    <BLANKLINE>
-    ----------------------------------------
 
 
 Duplicate projects

=== modified file 'lib/lp/registry/browser/tests/test_product.py'
--- lib/lp/registry/browser/tests/test_product.py	2010-08-20 20:31:18 +0000
+++ lib/lp/registry/browser/tests/test_product.py	2010-09-26 14:55:59 +0000
@@ -56,15 +56,6 @@
             'Commercial <commercial@xxxxxxxxxxxxx>',
             notification['Reply-To'])
 
-    def verify_commercial_email(self, notification):
-        # Verify that the commercial team was sent an email.
-        self.assertEqual(
-            'Project License Submitted for ball by registrant',
-            notification['Subject'])
-        self.assertEqual(
-            'Commercial <commercial@xxxxxxxxxxxxx>',
-            notification['To'])
-
     def test_ProductLicenseMixin_instance(self):
         # The object under test is an instance of ProductLicenseMixin.
         self.assertTrue(isinstance(self.view, ProductLicenseMixin))
@@ -85,26 +76,24 @@
         self.verify_user_email(notifications.pop())
 
     def test_notifyCommercialMailingList_other_open_source(self):
-        # An Other/Open Source license sends two emails.
+        # An Other/Open Source license sends one emails.
         self.product.licenses = [License.OTHER_OPEN_SOURCE]
         self.product.license_info = 'http://www,boost.org/'
         self.view.notifyCommercialMailingList()
         self.verify_whiteboard()
         notifications = pop_notifications()
-        self.assertEqual(2, len(notifications))
+        self.assertEqual(1, len(notifications))
         self.verify_user_email(notifications.pop())
-        self.verify_commercial_email(notifications.pop())
 
     def test_notifyCommercialMailingList_other_proprietary(self):
-        # An Other/Proprietary license sends two emails.
+        # An Other/Proprietary license sends one emails.
         self.product.licenses = [License.OTHER_PROPRIETARY]
         self.product.license_info = 'All mine'
         self.view.notifyCommercialMailingList()
         self.verify_whiteboard()
         notifications = pop_notifications()
-        self.assertEqual(2, len(notifications))
+        self.assertEqual(1, len(notifications))
         self.verify_user_email(notifications.pop())
-        self.verify_commercial_email(notifications.pop())
 
     def test__formatDate(self):
         # Verify the date format.

=== modified file 'lib/lp/registry/doc/commercialsubscription.txt'
--- lib/lp/registry/doc/commercialsubscription.txt	2010-08-16 19:28:37 +0000
+++ lib/lp/registry/doc/commercialsubscription.txt	2010-09-26 14:55:59 +0000
@@ -366,19 +366,21 @@
 =======================
 
 The forReview() method allows searching for products whose license needs to
-be reviewed. You can search by text in the Product table's full text index.
+be reviewed. You can search by text in the Product table's full text index
+as well as the license_info field. The results are ordered by date ceated
+then display name.
 
     >>> from canonical.database.sqlbase import flush_database_updates
     >>> from datetime import timedelta
     >>> bzr.licenses = [License.GNU_GPL_V2, License.ECLIPSE]
     >>> flush_database_updates()
     >>> for product in product_set.forReview(search_text='gnome'):
-    ...     print product.name
-    evolution
-    gnome-terminal
-    applets
+    ...     print product.displayname
+    python gnome2 dev
+    Evolution
+    GNOME Terminal
+    Gnome Applets
     gnomebaker
-    python-gnome2-dev
 
 You can search for whether the product is active or not.
 
@@ -391,11 +393,11 @@
 
     >>> for product in product_set.forReview(license_reviewed=True):
     ...     print product.name
+    python-gnome2-dev
+    unassigned
+    alsa-utils
     rosetta
     obsolete-junk
-    alsa-utils
-    python-gnome2-dev
-    unassigned
 
 You can search for products by license. This will match products with
 any one of the licenses listed.
@@ -428,30 +430,12 @@
 
     >>> for product in product_set.forReview(license_info_is_empty=True):
     ...     print product.name
-    aptoncd
+    tomcat
+    python-gnome2-dev
+    unassigned
     arch-mirrors
-    bazaar
-    bzr
-    derby
-    evolution
-    gnome-terminal
-    applets
-    jokosher
-    launchpad
-    rosetta
     firefox
-    thunderbird
-    netapplet
-    redfish
-    landscape
-    tomcat
-    upstart
-    a52dec
-    alsa-utils
-    gnomebaker
-    iso-codes
-    python-gnome2-dev
-    unassigned
+    ...
     >>> for product in product_set.forReview(license_info_is_empty=False):
     ...     print product.name
     mega-money-maker
@@ -469,10 +453,10 @@
     >>> for product in product_set.forReview(
     ...     license_reviewed=True, license_approved=False):
     ...     print product.name
-    rosetta
-    alsa-utils
     python-gnome2-dev
     unassigned
+    alsa-utils
+    rosetta
 
 You can search for products based on a date range in which the product
 was created.
@@ -604,11 +588,11 @@
     >>> gnome =  product_set.forReview(search_text='gnome')
     >>> for product in gnome:
     ...     print product.name
+    python-gnome2-dev
     evolution
     gnome-terminal
     applets
     gnomebaker
-    python-gnome2-dev
 
 An admin can access 'forReview'.
 
@@ -618,11 +602,11 @@
     >>> gnome =  product_set.forReview(search_text='gnome')
     >>> for product in gnome:
     ...     print product.name
+    python-gnome2-dev
     evolution
     gnome-terminal
     applets
     gnomebaker
-    python-gnome2-dev
 
 Members of the registry experts celebrity have permission to review
 IProduct and IProjectGroup objects and access an IProjectGroupSet.

=== modified file 'lib/lp/registry/model/product.py'
--- lib/lp/registry/model/product.py	2010-09-24 20:23:31 +0000
+++ lib/lp/registry/model/product.py	2010-09-26 14:55:59 +0000
@@ -1521,7 +1521,8 @@
 
         result = IStore(Product).find(
             Product, *conditions).config(
-                distinct=True).order_by(Product.displayname, Product.name)
+                distinct=True).order_by(
+                    Product.datecreated, Product.displayname)
         return result
 
     def search(self, text=None, soyuz=None,

=== modified file 'lib/lp/registry/templates/product-portlet-requires-subscription.pt'
--- lib/lp/registry/templates/product-portlet-requires-subscription.pt	2009-08-11 12:43:24 +0000
+++ lib/lp/registry/templates/product-portlet-requires-subscription.pt	2010-09-26 14:55:59 +0000
@@ -25,7 +25,7 @@
     </p>
     <ul class="bulleted" style="clear:left;">
       <li><a href="+purchase-subscription">Purchase a subscription.</a></li>
-      <li><a href="mailto:feedback@xxxxxxxxxxxxx";>Contact us</a>
+      <li><a href="mailto:commercial@xxxxxxxxxxxxx";>Contact us</a>
           about changing your license.
       </li>
     </ul>