8687.15.17
by Karl Fogel
Add the copyright header block to the rest of the files under lib/lp/. |
1 |
# Copyright 2009 Canonical Ltd. This software is licensed under the
|
2 |
# GNU Affero General Public License version 3 (see the file LICENSE).
|
|
6206.2.1
by Barry Warsaw
Bug 224874, a cron script for updating personal standing based on the number |
3 |
|
4 |
"""Core implementation of the script to update personal standing."""
|
|
5 |
||
6 |
__metaclass__ = type |
|
7 |
__all__ = [ |
|
8 |
'UpdatePersonalStanding', |
|
9 |
]
|
|
10 |
||
11 |
||
12 |
from zope.component import getUtility |
|
13 |
||
8356.1.1
by Leonard Richardson
Partial move. |
14 |
from lp.services.scripts.base import LaunchpadCronScript |
6206.2.1
by Barry Warsaw
Bug 224874, a cron script for updating personal standing based on the number |
15 |
|
16 |
||
17 |
class UpdatePersonalStanding(LaunchpadCronScript): |
|
18 |
"""Update personal standings based on approved moderated messages.
|
|
19 |
||
20 |
When a person who is not a member posts a message to a mailing list, their
|
|
21 |
message will get held for moderator approval. If their postings to three
|
|
22 |
different lists are approved, they get their personal standing bumped from
|
|
23 |
Unknown to Good. This will allow them to post to mailing lists they are
|
|
24 |
not a member of with no future holds on their messages.
|
|
25 |
||
26 |
Note however that it takes approved posts to three different lists to bump
|
|
27 |
standing. Also, standing will only ever transition from Unknown to Good.
|
|
28 |
If their current personal standing is not Unknown, nothing will change.
|
|
29 |
"""
|
|
30 |
||
31 |
def main(self): |
|
32 |
"""Main script entry point."""
|
|
33 |
self.logger.info('Updating personal standings') |
|
6206.2.9
by Barry Warsaw
Add the actual cron script, and tests to be sure the cron script works via |
34 |
self.txn.begin() |
8203.2.3
by Curtis Hovey
Added missing block to run special doctests. Moved to lp.registry files into the tree. |
35 |
# Avoid circular imports.
|
36 |
from lp.registry.interfaces.person import IPersonSet |
|
6206.2.6
by Barry Warsaw
Francis, the SQL wizard that he is, gave me the magic one-shot update, so the |
37 |
getUtility(IPersonSet).updatePersonalStandings() |
6206.2.1
by Barry Warsaw
Bug 224874, a cron script for updating personal standing based on the number |
38 |
self.txn.commit() |
39 |
self.logger.info('Done.') |