Skip to content
This repository was archived by the owner on Jun 29, 2019. It is now read-only.

Commit ef37932

Browse files
committed
Improved some doc strings
1 parent 2756603 commit ef37932

File tree

7 files changed

+29
-19
lines changed

7 files changed

+29
-19
lines changed

CHANGELOG.md

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,9 @@
1-
## 0.6.0 (unreleased)
1+
## 0.6.0
2+
3+
Features:
4+
5+
- Issue unique access tokens
6+
- Define what grants a client is allowed to use
27

38
Improvements:
49

docs/error.rst

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,16 +3,14 @@
33

44
.. automodule:: oauth2.error
55

6+
.. autoclass:: AccessTokenNotFound
7+
68
.. autoclass:: AuthCodeNotFound
79

810
.. autoclass:: ClientNotFoundError
911

1012
.. autoclass:: OAuthBaseError
1113

12-
.. autoclass:: OAuthClientError
13-
14-
.. autoclass:: OAuthUserError
15-
1614
.. autoclass:: OAuthInvalidError
1715

1816
.. autoclass:: UserNotAuthenticated

docs/oauth2.rst

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22
=============================
33

44
.. autoclass:: oauth2.Provider
5+
:members: scope_separator
56

67
.. automethod:: oauth2.Provider.add_grant
78
.. automethod:: oauth2.Provider.dispatch
9+
.. automethod:: oauth2.Provider.enable_unique_tokens

oauth2/__init__.py

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -141,6 +141,9 @@ def __init__(self, access_token_store, auth_code_store, client_store,
141141
def add_grant(self, grant):
142142
"""
143143
Adds a Grant that the provider should support.
144+
145+
:param grant: An instance of a class that extends
146+
:class:`oauth2.grant.GrantHandlerFactory`
144147
"""
145148
if hasattr(grant, "expires_in"):
146149
self.token_generator.expires_in = grant.expires_in
@@ -197,7 +200,17 @@ def enable_unique_tokens(self):
197200
@property
198201
def scope_separator(self, separator):
199202
"""
200-
Sets the separator of values in scope query parameter.
203+
Sets the separator of values in the scope query parameter.
204+
Defaults to " " (whitespace).
205+
206+
The following code makes the Provider use "," instead of " "::
207+
208+
provider = Provider()
209+
210+
provider.scope_separator = ","
211+
212+
Now the scope parameter in the request of a client can look like this:
213+
`scope=foo,bar`.
201214
"""
202215
Scope.separator = separator
203216

oauth2/error.py

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -52,13 +52,6 @@ def __init__(self, error, error_uri=None, explanation=None):
5252
super(OAuthBaseError, self).__init__()
5353

5454

55-
class OAuthClientError(OAuthBaseError):
56-
"""
57-
Indicates an error during recognition of a client.
58-
"""
59-
pass
60-
61-
6255
class OAuthInvalidError(OAuthBaseError):
6356
"""
6457
Indicates an error during validation of a request.

oauth2/grant.py

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -27,10 +27,8 @@
2727
* The server that issues the access.
2828
2929
"""
30-
from oauth2.error import OAuthInvalidError, OAuthClientError, \
31-
ClientNotFoundError, UserNotAuthenticated, AccessTokenNotFound, \
32-
UserIdentifierMissingError, OAuthInvalidNoRedirectError, \
33-
RedirectUriUnknown
30+
from oauth2.error import OAuthInvalidError, UserNotAuthenticated, \
31+
AccessTokenNotFound, UserIdentifierMissingError, RedirectUriUnknown
3432
from oauth2.compatibility import urlencode, quote
3533
import json
3634
import time

oauth2/test/__init__.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
import sys
22

3-
# Enables unit tests to be work under Python 2.6
4-
# Code copied from https://github.com/facebook/tornado/blob/master/tornado/test/util.py
3+
# Enables unit tests to work under Python 2.6
4+
# Code copied from
5+
# https://github.com/facebook/tornado/blob/master/tornado/test/util.py
56
if sys.version_info >= (2, 7):
67
import unittest
78
else:

0 commit comments

Comments
 (0)