Merge lp:~cjwatson/launchpad/oauth-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: 17320
Proposed branch: lp:~cjwatson/launchpad/oauth-projectgroup
Merge into: lp:launchpad
Diff against target: 126 lines (+18/-18)
3 files modified
lib/lp/services/oauth/interfaces.py (+2/-2)
lib/lp/services/oauth/model.py (+14/-14)
lib/lp/services/oauth/tests/test_tokens.py (+2/-2)
To merge this branch: bzr merge lp:~cjwatson/launchpad/oauth-projectgroup
Reviewer Review Type Date Requested Status
Colin Watson (community) Approve
Review via email: mp+247970@code.launchpad.net

Commit message

Rename IOAuthToken.project to IOAuthToken.projectgroup.

Description of the change

Rename IOAuthToken.project to IOAuthToken.projectgroup.

To post a comment you must log in.
Revision history for this message
Colin Watson (cjwatson) :
review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'lib/lp/services/oauth/interfaces.py'
2--- lib/lp/services/oauth/interfaces.py 2014-09-01 03:45:08 +0000
3+++ lib/lp/services/oauth/interfaces.py 2015-01-29 12:17:16 +0000
4@@ -148,8 +148,8 @@
5 description=_('The key used to identify this token. It is included '
6 'by the consumer in each request.'))
7 product = Choice(title=_('Project'), required=False, vocabulary='Product')
8- project = Choice(
9- title=_('Project'), required=False, vocabulary='ProjectGroup')
10+ projectgroup = Choice(
11+ title=_('Project Group'), required=False, vocabulary='ProjectGroup')
12 sourcepackagename = Choice(
13 title=_("Package"), required=False, vocabulary='SourcePackageName')
14 distribution = Choice(
15
16=== modified file 'lib/lp/services/oauth/model.py'
17--- lib/lp/services/oauth/model.py 2014-09-02 01:23:41 +0000
18+++ lib/lp/services/oauth/model.py 2015-01-29 12:17:16 +0000
19@@ -197,7 +197,7 @@
20
21 product = ForeignKey(
22 dbName='product', foreignKey='Product', notNull=False, default=None)
23- project = ForeignKey(
24+ projectgroup = ForeignKey(
25 dbName='project', foreignKey='ProjectGroup', notNull=False,
26 default=None)
27 sourcepackagename = ForeignKey(
28@@ -208,22 +208,22 @@
29 notNull=False, default=None)
30
31 def __init__(self, consumer, permission, key, secret='', person=None,
32- date_expires=None, product=None, project=None,
33+ date_expires=None, product=None, projectgroup=None,
34 distribution=None, sourcepackagename=None):
35 secret = hashlib.sha256(secret).hexdigest()
36 super(OAuthAccessToken, self).__init__(
37 consumer=consumer, permission=permission, key=key,
38 _secret=secret, person=person, date_expires=date_expires,
39- product=product, project=project, distribution=distribution,
40- sourcepackagename=sourcepackagename)
41+ product=product, projectgroup=projectgroup,
42+ distribution=distribution, sourcepackagename=sourcepackagename)
43
44 @property
45 def context(self):
46 """See `IOAuthToken`."""
47 if self.product:
48 return self.product
49- elif self.project:
50- return self.project
51+ elif self.projectgroup:
52+ return self.projectgroup
53 elif self.distribution:
54 if self.sourcepackagename:
55 return self.distribution.getSourcePackage(
56@@ -261,7 +261,7 @@
57
58 product = ForeignKey(
59 dbName='product', foreignKey='Product', notNull=False, default=None)
60- project = ForeignKey(
61+ projectgroup = ForeignKey(
62 dbName='project', foreignKey='ProjectGroup', notNull=False,
63 default=None)
64 sourcepackagename = ForeignKey(
65@@ -272,22 +272,22 @@
66 notNull=False, default=None)
67
68 def __init__(self, consumer, key, secret='', permission=None, person=None,
69- date_expires=None, product=None, project=None,
70+ date_expires=None, product=None, projectgroup=None,
71 distribution=None, sourcepackagename=None):
72 secret = hashlib.sha256(secret).hexdigest()
73 super(OAuthRequestToken, self).__init__(
74 consumer=consumer, permission=permission, key=key,
75 _secret=secret, person=person, date_expires=date_expires,
76- product=product, project=project, distribution=distribution,
77- sourcepackagename=sourcepackagename)
78+ product=product, projectgroup=projectgroup,
79+ distribution=distribution, sourcepackagename=sourcepackagename)
80
81 @property
82 def context(self):
83 """See `IOAuthToken`."""
84 if self.product:
85 return self.product
86- elif self.project:
87- return self.project
88+ elif self.projectgroup:
89+ return self.projectgroup
90 elif self.distribution:
91 if self.sourcepackagename:
92 return self.distribution.getSourcePackage(
93@@ -323,7 +323,7 @@
94 if IProduct.providedBy(context):
95 self.product = context
96 elif IProjectGroup.providedBy(context):
97- self.project = context
98+ self.projectgroup = context
99 elif IDistribution.providedBy(context):
100 self.distribution = context
101 elif IDistributionSourcePackage.providedBy(context):
102@@ -352,7 +352,7 @@
103 consumer=self.consumer, person=self.person, key=key,
104 secret=secret, permission=access_level,
105 date_expires=self.date_expires, product=self.product,
106- project=self.project, distribution=self.distribution,
107+ projectgroup=self.projectgroup, distribution=self.distribution,
108 sourcepackagename=self.sourcepackagename)
109
110 # We want to notify the user that this oauth token has been generated
111
112=== modified file 'lib/lp/services/oauth/tests/test_tokens.py'
113--- lib/lp/services/oauth/tests/test_tokens.py 2014-06-27 10:08:20 +0000
114+++ lib/lp/services/oauth/tests/test_tokens.py 2015-01-29 12:17:16 +0000
115@@ -223,9 +223,9 @@
116 self.factory.makeProduct)
117 self.assertEquals(token.context.name, name)
118
119- def test_review_with_project_context(self):
120+ def test_review_with_project_group_context(self):
121 # When reviewing a request token, the context may be set to a
122- # project.
123+ # project group.
124 token, name = self._reviewed_token_for_context(
125 self.factory.makeProject)
126 self.assertEquals(token.context.name, name)