launchpad-reviewers team mailing list archive
-
launchpad-reviewers team
-
Mailing list archive
-
Message #17728
[Merge] lp:~cjwatson/launchpad/karmacache-projectgroup into lp:launchpad
Colin Watson has proposed merging lp:~cjwatson/launchpad/karmacache-projectgroup into lp:launchpad.
Commit message:
Rename KarmaCache.project to KarmaCache.projectgroup.
Requested reviews:
Launchpad code reviewers (launchpad-reviewers)
Related bugs:
Bug #523054 in Launchpad itself: "Rename Product.project to Product.projectgroup"
https://bugs.launchpad.net/launchpad/+bug/523054
For more details, see:
https://code.launchpad.net/~cjwatson/launchpad/karmacache-projectgroup/+merge/247859
Rename KarmaCache.project to KarmaCache.projectgroup.
--
Your team Launchpad code reviewers is requested to review the proposed merge of lp:~cjwatson/launchpad/karmacache-projectgroup into lp:launchpad.
=== modified file 'cronscripts/foaf-update-karma-cache.py'
--- cronscripts/foaf-update-karma-cache.py 2013-01-07 02:40:55 +0000
+++ cronscripts/foaf-update-karma-cache.py 2015-01-28 16:17:57 +0000
@@ -145,9 +145,9 @@
# We must issue some SUM queries to insert the karma totals for:
# - All actions of a person on a given product.
# - All actions of a person on a given distribution.
- # - All actions of a person on a given project.
+ # - All actions of a person on a given project group.
# - All actions with a specific category of a person on a given
- # project.
+ # project group.
# - All actions with a specific category of a person.
# - All actions with a specific category of a person.
@@ -184,7 +184,7 @@
GROUP BY person, distribution
""")
- # - All actions of a person on a given project.
+ # - All actions of a person on a given project group.
self.cur.execute("""
INSERT INTO KarmaCache
(person, category, karmavalue, product, distribution,
@@ -199,10 +199,10 @@
""")
# - All actions with a specific category of a person on a given
- # project.
+ # project group.
# IMPORTANT: This has to be the latest step; otherwise the rows
# inserted here will be included in the calculation of the overall
- # karma of a person on a given project.
+ # karma of a person on a given project group.
self.cur.execute("""
INSERT INTO KarmaCache
(person, category, karmavalue, product, distribution,
=== modified file 'lib/lp/registry/interfaces/karma.py'
--- lib/lp/registry/interfaces/karma.py 2013-04-11 05:32:33 +0000
+++ lib/lp/registry/interfaces/karma.py 2015-01-28 16:17:57 +0000
@@ -130,7 +130,7 @@
product = Attribute(_("Project"))
- project = Attribute(_("Project Group"))
+ projectgroup = Attribute(_("Project Group"))
distribution = Attribute(_("Distribution"))
@@ -149,10 +149,10 @@
def updateKarmaValue(value, person_id, category_id, product_id=None,
distribution_id=None, sourcepackagename_id=None,
- project_id=None):
+ projectgroup_id=None):
"""Update the karmavalue attribute of the KarmaCache with the given
- person_id, category_id, product_id, distribution_id and
- sourcepackagename_id.
+ person_id, category_id, product_id, distribution_id,
+ sourcepackagename_id, and projectgroup_id.
Raise NotFoundError if there's no KarmaCache with those attributes.
=== modified file 'lib/lp/registry/model/karma.py'
--- lib/lp/registry/model/karma.py 2013-06-20 05:50:00 +0000
+++ lib/lp/registry/model/karma.py 2015-01-28 16:17:57 +0000
@@ -140,7 +140,7 @@
dbName='karmavalue', notNull=True)
product = ForeignKey(
dbName='product', foreignKey='Product', notNull=False)
- project = ForeignKey(
+ projectgroup = ForeignKey(
dbName='project', foreignKey='ProjectGroup', notNull=False)
distribution = ForeignKey(
dbName='distribution', foreignKey='Distribution', notNull=False)
@@ -154,21 +154,24 @@
implements(IKarmaCacheManager)
def new(self, value, person_id, category_id, product_id=None,
- distribution_id=None, sourcepackagename_id=None, project_id=None):
+ distribution_id=None, sourcepackagename_id=None,
+ projectgroup_id=None):
"""See IKarmaCacheManager."""
return KarmaCache(
karmavalue=value, person=person_id, category=category_id,
product=product_id, distribution=distribution_id,
- sourcepackagename=sourcepackagename_id, project=project_id)
+ sourcepackagename=sourcepackagename_id,
+ projectgroup=projectgroup_id)
def updateKarmaValue(self, value, person_id, category_id, product_id=None,
distribution_id=None, sourcepackagename_id=None,
- project_id=None):
+ projectgroup_id=None):
"""See IKarmaCacheManager."""
entry = self._getEntry(
person_id=person_id, category_id=category_id,
product_id=product_id, distribution_id=distribution_id,
- project_id=project_id, sourcepackagename_id=sourcepackagename_id)
+ projectgroup_id=projectgroup_id,
+ sourcepackagename_id=sourcepackagename_id)
if entry is None:
raise NotFoundError("KarmaCache not found: %s" % vars())
else:
@@ -177,7 +180,7 @@
def _getEntry(self, person_id, category_id, product_id=None,
distribution_id=None, sourcepackagename_id=None,
- project_id=None):
+ projectgroup_id=None):
"""Return the KarmaCache entry with the given arguments.
Return None if it's not found.
@@ -187,7 +190,7 @@
KarmaCache.personID == person_id,
KarmaCache.categoryID == category_id,
KarmaCache.productID == product_id,
- KarmaCache.projectID == project_id,
+ KarmaCache.projectgroupID == projectgroup_id,
KarmaCache.distributionID == distribution_id,
KarmaCache.sourcepackagenameID == sourcepackagename_id).one()
@@ -244,10 +247,10 @@
elif IDistribution.providedBy(self):
condition = KarmaCache.distributionID == self.id
elif IProjectGroup.providedBy(self):
- condition = KarmaCache.projectID == self.id
+ condition = KarmaCache.projectgroupID == self.id
else:
raise AssertionError(
- "Not a product, project or distribution: %r" % self)
+ "Not a product, project group or distribution: %r" % self)
if category is not None:
category = category.id
=== modified file 'lib/lp/registry/model/person.py'
--- lib/lp/registry/model/person.py 2015-01-07 00:35:53 +0000
+++ lib/lp/registry/model/person.py 2015-01-28 16:17:57 +0000
@@ -1001,7 +1001,7 @@
(Product, Distribution, KarmaCache.karmavalue),
KarmaCache.personID == self.id,
KarmaCache.category == None,
- KarmaCache.project == None,
+ KarmaCache.projectgroup == None,
Or(
And(Product.id != None, Product.active == True,
ProductSet.getProductPrivacyFilter(user)),
@@ -1264,7 +1264,7 @@
KarmaCache.category == KarmaCategory.id,
KarmaCache.person == self.id,
KarmaCache.product == None,
- KarmaCache.project == None,
+ KarmaCache.projectgroup == None,
KarmaCache.distribution == None,
KarmaCache.sourcepackagename == None)
result = store.find((KarmaCache, KarmaCategory), conditions)
=== modified file 'lib/lp/services/worlddata/model/language.py'
--- lib/lp/services/worlddata/model/language.py 2013-06-20 05:50:00 +0000
+++ lib/lp/services/worlddata/model/language.py 2015-01-28 16:17:57 +0000
@@ -197,7 +197,7 @@
KarmaCategory.name == 'translations',
KarmaCache.categoryID == KarmaCategory.id,
KarmaCache.productID == None,
- KarmaCache.projectID == None,
+ KarmaCache.projectgroupID == None,
KarmaCache.sourcepackagenameID == None,
KarmaCache.distributionID == None)),
PersonLanguage.personID ==
Follow ups