Merge lp:~cjwatson/launchpad/karmacache-projectgroup into lp:launchpad

Proposed by Colin Watson
Status: Merged
Approved by: Colin Watson
Approved revision: no longer in the source branch.
Merged at revision: 17313
Proposed branch: lp:~cjwatson/launchpad/karmacache-projectgroup
Merge into: lp:launchpad
Diff against target: 172 lines (+24/-21)
5 files modified
cronscripts/foaf-update-karma-cache.py (+5/-5)
lib/lp/registry/interfaces/karma.py (+4/-4)
lib/lp/registry/model/karma.py (+12/-9)
lib/lp/registry/model/person.py (+2/-2)
lib/lp/services/worlddata/model/language.py (+1/-1)
To merge this branch: bzr merge lp:~cjwatson/launchpad/karmacache-projectgroup
Reviewer Review Type Date Requested Status
William Grant code Approve
Review via email: mp+247859@code.launchpad.net

Commit message

Rename KarmaCache.project to KarmaCache.projectgroup.

Description of the change

Rename KarmaCache.project to KarmaCache.projectgroup.

To post a comment you must log in.
Revision history for this message
William Grant (wgrant) :
review: Approve (code)

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'cronscripts/foaf-update-karma-cache.py'
2--- cronscripts/foaf-update-karma-cache.py 2013-01-07 02:40:55 +0000
3+++ cronscripts/foaf-update-karma-cache.py 2015-01-28 16:17:57 +0000
4@@ -145,9 +145,9 @@
5 # We must issue some SUM queries to insert the karma totals for:
6 # - All actions of a person on a given product.
7 # - All actions of a person on a given distribution.
8- # - All actions of a person on a given project.
9+ # - All actions of a person on a given project group.
10 # - All actions with a specific category of a person on a given
11- # project.
12+ # project group.
13 # - All actions with a specific category of a person.
14
15 # - All actions with a specific category of a person.
16@@ -184,7 +184,7 @@
17 GROUP BY person, distribution
18 """)
19
20- # - All actions of a person on a given project.
21+ # - All actions of a person on a given project group.
22 self.cur.execute("""
23 INSERT INTO KarmaCache
24 (person, category, karmavalue, product, distribution,
25@@ -199,10 +199,10 @@
26 """)
27
28 # - All actions with a specific category of a person on a given
29- # project.
30+ # project group.
31 # IMPORTANT: This has to be the latest step; otherwise the rows
32 # inserted here will be included in the calculation of the overall
33- # karma of a person on a given project.
34+ # karma of a person on a given project group.
35 self.cur.execute("""
36 INSERT INTO KarmaCache
37 (person, category, karmavalue, product, distribution,
38
39=== modified file 'lib/lp/registry/interfaces/karma.py'
40--- lib/lp/registry/interfaces/karma.py 2013-04-11 05:32:33 +0000
41+++ lib/lp/registry/interfaces/karma.py 2015-01-28 16:17:57 +0000
42@@ -130,7 +130,7 @@
43
44 product = Attribute(_("Project"))
45
46- project = Attribute(_("Project Group"))
47+ projectgroup = Attribute(_("Project Group"))
48
49 distribution = Attribute(_("Distribution"))
50
51@@ -149,10 +149,10 @@
52
53 def updateKarmaValue(value, person_id, category_id, product_id=None,
54 distribution_id=None, sourcepackagename_id=None,
55- project_id=None):
56+ projectgroup_id=None):
57 """Update the karmavalue attribute of the KarmaCache with the given
58- person_id, category_id, product_id, distribution_id and
59- sourcepackagename_id.
60+ person_id, category_id, product_id, distribution_id,
61+ sourcepackagename_id, and projectgroup_id.
62
63 Raise NotFoundError if there's no KarmaCache with those attributes.
64
65
66=== modified file 'lib/lp/registry/model/karma.py'
67--- lib/lp/registry/model/karma.py 2013-06-20 05:50:00 +0000
68+++ lib/lp/registry/model/karma.py 2015-01-28 16:17:57 +0000
69@@ -140,7 +140,7 @@
70 dbName='karmavalue', notNull=True)
71 product = ForeignKey(
72 dbName='product', foreignKey='Product', notNull=False)
73- project = ForeignKey(
74+ projectgroup = ForeignKey(
75 dbName='project', foreignKey='ProjectGroup', notNull=False)
76 distribution = ForeignKey(
77 dbName='distribution', foreignKey='Distribution', notNull=False)
78@@ -154,21 +154,24 @@
79 implements(IKarmaCacheManager)
80
81 def new(self, value, person_id, category_id, product_id=None,
82- distribution_id=None, sourcepackagename_id=None, project_id=None):
83+ distribution_id=None, sourcepackagename_id=None,
84+ projectgroup_id=None):
85 """See IKarmaCacheManager."""
86 return KarmaCache(
87 karmavalue=value, person=person_id, category=category_id,
88 product=product_id, distribution=distribution_id,
89- sourcepackagename=sourcepackagename_id, project=project_id)
90+ sourcepackagename=sourcepackagename_id,
91+ projectgroup=projectgroup_id)
92
93 def updateKarmaValue(self, value, person_id, category_id, product_id=None,
94 distribution_id=None, sourcepackagename_id=None,
95- project_id=None):
96+ projectgroup_id=None):
97 """See IKarmaCacheManager."""
98 entry = self._getEntry(
99 person_id=person_id, category_id=category_id,
100 product_id=product_id, distribution_id=distribution_id,
101- project_id=project_id, sourcepackagename_id=sourcepackagename_id)
102+ projectgroup_id=projectgroup_id,
103+ sourcepackagename_id=sourcepackagename_id)
104 if entry is None:
105 raise NotFoundError("KarmaCache not found: %s" % vars())
106 else:
107@@ -177,7 +180,7 @@
108
109 def _getEntry(self, person_id, category_id, product_id=None,
110 distribution_id=None, sourcepackagename_id=None,
111- project_id=None):
112+ projectgroup_id=None):
113 """Return the KarmaCache entry with the given arguments.
114
115 Return None if it's not found.
116@@ -187,7 +190,7 @@
117 KarmaCache.personID == person_id,
118 KarmaCache.categoryID == category_id,
119 KarmaCache.productID == product_id,
120- KarmaCache.projectID == project_id,
121+ KarmaCache.projectgroupID == projectgroup_id,
122 KarmaCache.distributionID == distribution_id,
123 KarmaCache.sourcepackagenameID == sourcepackagename_id).one()
124
125@@ -244,10 +247,10 @@
126 elif IDistribution.providedBy(self):
127 condition = KarmaCache.distributionID == self.id
128 elif IProjectGroup.providedBy(self):
129- condition = KarmaCache.projectID == self.id
130+ condition = KarmaCache.projectgroupID == self.id
131 else:
132 raise AssertionError(
133- "Not a product, project or distribution: %r" % self)
134+ "Not a product, project group or distribution: %r" % self)
135
136 if category is not None:
137 category = category.id
138
139=== modified file 'lib/lp/registry/model/person.py'
140--- lib/lp/registry/model/person.py 2015-01-07 00:35:53 +0000
141+++ lib/lp/registry/model/person.py 2015-01-28 16:17:57 +0000
142@@ -1001,7 +1001,7 @@
143 (Product, Distribution, KarmaCache.karmavalue),
144 KarmaCache.personID == self.id,
145 KarmaCache.category == None,
146- KarmaCache.project == None,
147+ KarmaCache.projectgroup == None,
148 Or(
149 And(Product.id != None, Product.active == True,
150 ProductSet.getProductPrivacyFilter(user)),
151@@ -1264,7 +1264,7 @@
152 KarmaCache.category == KarmaCategory.id,
153 KarmaCache.person == self.id,
154 KarmaCache.product == None,
155- KarmaCache.project == None,
156+ KarmaCache.projectgroup == None,
157 KarmaCache.distribution == None,
158 KarmaCache.sourcepackagename == None)
159 result = store.find((KarmaCache, KarmaCategory), conditions)
160
161=== modified file 'lib/lp/services/worlddata/model/language.py'
162--- lib/lp/services/worlddata/model/language.py 2013-06-20 05:50:00 +0000
163+++ lib/lp/services/worlddata/model/language.py 2015-01-28 16:17:57 +0000
164@@ -197,7 +197,7 @@
165 KarmaCategory.name == 'translations',
166 KarmaCache.categoryID == KarmaCategory.id,
167 KarmaCache.productID == None,
168- KarmaCache.projectID == None,
169+ KarmaCache.projectgroupID == None,
170 KarmaCache.sourcepackagenameID == None,
171 KarmaCache.distributionID == None)),
172 PersonLanguage.personID ==