Merge lp:~sinzui/launchpad/entitlement-2 into lp:launchpad
Status: | Merged |
---|---|
Approved by: | Curtis Hovey |
Approved revision: | no longer in the source branch. |
Merged at revision: | 14953 |
Proposed branch: | lp:~sinzui/launchpad/entitlement-2 |
Merge into: | lp:launchpad |
Prerequisite: | lp:~sinzui/launchpad/entitlement-1 |
Diff against target: |
685 lines (+309/-189) 9 files modified
lib/lp/registry/browser/product.py (+0/-82) lib/lp/registry/browser/tests/test_product.py (+0/-87) lib/lp/registry/configure.zcml (+1/-1) lib/lp/registry/model/product.py (+2/-0) lib/lp/registry/stories/product/xx-product-index.txt (+2/-0) lib/lp/registry/subscribers.py (+106/-5) lib/lp/registry/tests/test_product.py (+33/-3) lib/lp/registry/tests/test_subscribers.py (+152/-0) lib/lp/testing/factory.py (+13/-11) |
To merge this branch: | bzr merge lp:~sinzui/launchpad/entitlement-2 |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Benji York (community) | code | Approve | |
Review via email: mp+97078@code.launchpad.net |
This proposal supersedes a proposal from 2012-03-12.
Commit message
Move license notification code from the view to the model.
Description of the change
We want to give proprietary projects complimentary commercial subscriptions
to ensure that projects can be configured setup to no disclose information
from the start.
This branch follows moves the code that send emails to users about
licenses from the view to the model so that changes made over the API
generate emails. Most of this branch is a refactoring.
-------
RULES
PREVIOUS BRANCH
* When a OTHER/PROPRIETARY license is added to a project, and the
project does not have any commercial subscriptions add a commercial
subscription that expires in 4 weeks.
* We check for previous active and expired commercial subscriptions
to ensure that users cannot get extra time by reconfiguring their
project.
* Product.
* Use StevenK's example from the LaunchpadFactory to create a
commercial subscription without a voucher.
THIS BRANCH
* Push the rules to send licensing emails to the model.
* Emails are currently sent by the views that allow users to change
licenses. Change made in the model or via the API are missin emails.
* Notify of the ObjectModifiedEvent in the _setLicenses() method.
FUTURE BRANCH
* The UI and an email is sent to inform the user of the complimentary
commercial subscription and it will explain when it expires and how
to active the proprietary features. There is a link to purchase a
full subscription.
* This email probably replaces the existing email that explain Lp's
licensing and purchasing rules.
* At 4 weeks and 1 weeks before a commercial subscription expires, a
reminder is sent to purchase a commercial subscription.
* the email also explain that the project will be deactivated if the
to ensure proprietary is not added added.
* Users can choose an Open source license. Branches and bugs will
remain proprietary because we understand that confidential information
can never be disclosed, but new bugs and branches will be public...
the project's focus of development must be set to a public branch.
* Bonus points if there is a clear way to identify a Canonical owned
project and set the commercial subscription to expire in 10 years.
QA
* Visit https:/
non-
* Verify an email was not sent.
* Use Change details to set the license to proprietary.
* Verify an email was sent to the maintainer explaining Lp's licensing
policy
* Visit https:/
proprietary project.
* Verify it has a commercial subscription that expires in one month.
* Verify an email was sent to the maintainer explaining Lp's licensing
policy
LINT
lib/
lib/
lib/
lib/
lib/
lib/
lib/
lib/
TEST
./bin/test -vv lp.registry.
./bin/test -vv lp.registry.
./bin/test -vv lp.registry.
IMPLEMENTATION
Login as the product owner before creating the product so that there is an
interaction for events to use.
lib/
Remove view code and tests -- moved to subscribers.py and
test_subscriber
licenses is not needed anymore. It will never run in production because
we fixed all the production data. All products have one or more Licenses.
lib/
lib/
Notify that the licenses changed.
lib/
lib/
Refactored the view code and tests to work with events at the model
level. Removed a dead method called product_modified that was in
subscribers.py, I suspect it is vestigial to product._owner change event
that once needlessly changed the owner of subordinate objects.
lib/
lib/
lib/
This branch looks good, the only comments I have are concerning code
that hasn't actually changed, so take that into consideration:
Is it possible that the strings included in the body of the email might
be wider than is customary for email messages? If so, we can use the
textwrap.fill function to tame the long lines.
It's arguable as to whether this is an improvement or not, but it
occurred to me that _indent() could be implemented with this regex:
re.sub('^', ' '*4, text, flags=re.M)
Using the string "Commercial" as the display-name portion of the from
address seems a little vague. Maybe something like "Launchpad
Commercial Services" (or a shorter variation) would be nicer.