Skip to content

Commit

Permalink
spelling
Browse files Browse the repository at this point in the history
  • Loading branch information
d10n committed May 15, 2013
1 parent c2e6948 commit fc089d9
Show file tree
Hide file tree
Showing 28 changed files with 98 additions and 99 deletions.
6 changes: 3 additions & 3 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ Features
========

* Loosely coupled.
* Tiny but powerfull interface.
* Tiny but powerful interface.
* The |pyopenid|_ library is the only **optional** dependency.
* CSRF protection.
* **Framework agnostic** thanks to adapters.
Expand Down Expand Up @@ -69,8 +69,8 @@ Contribute
Contributions of any kind are very welcome.
The project is hosted on `GitHub <https://github.com/peterhudec/authomatic>`_.
If you find this library useful and are using it in your projects,
please don't be shy and leave a comment about your usecase on the
`Authomatic Usecases <https://github.com/peterhudec/authomatic/issues/1>`_ issue.
please don't be shy and leave a comment about your use case on the
`Authomatic use cases <https://github.com/peterhudec/authomatic/issues/1>`_ issue.

Usage
=====
Expand Down
2 changes: 1 addition & 1 deletion authomatic/adapters.py
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ def cookies(self):
@abc.abstractmethod
def set_status(self):
"""
To set the staus in JSON endpoint.
To set the status in JSON endpoint.
"""


Expand Down
30 changes: 15 additions & 15 deletions authomatic/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -224,15 +224,15 @@ class ReprMixin(object):
* listed in _repr_ignore.
Values of attributes listed in _repr_sensitive will be replaced by *###*.
Values which repr() string is longer than _repr_lenght_limit will be represented as *ClassName(...)*
Values which repr() string is longer than _repr_length_limit will be represented as *ClassName(...)*
"""

#: Iterable of attributes to be ignored.
_repr_ignore = []
#: Iterable of attributes which value should not be visible.
_repr_sensitive = []
#: `int` Values longer than this will be truncated to *ClassName(...)*.
_repr_lenght_limit = 20
_repr_length_limit = 20


def __repr__(self):
Expand All @@ -253,7 +253,7 @@ def __repr__(self):
v = '###'

# if repr is too long
if len(repr(v)) > self._repr_lenght_limit:
if len(repr(v)) > self._repr_length_limit:
# Truncate to ClassName(...)
v = '{}(...)'.format(v.__class__.__name__)
else:
Expand Down Expand Up @@ -332,7 +332,7 @@ def __init__(self, adapter, secret, name='authomatic', max_age=600, secure=False
:param str name:
Session cookie name.
:param int max_age:
Maximum allowed age of session kookie nonce in seconds.
Maximum allowed age of session cookie nonce in seconds.
:param bool secure:
If ``True`` the session cookie will be saved wit ``Secure`` attribute.
"""
Expand Down Expand Up @@ -464,7 +464,7 @@ def _deserialize(self, value):
The serialized value.
:returns:
Desrialized object.
Deserialized object.
"""

# 4. Split
Expand All @@ -484,7 +484,7 @@ def _deserialize(self, value):
# 2. Deserialize
deserialized = json.loads(decoded)

# 1. Unpicke non json serializable objects.
# 1. Unpickle non json serializable objects.
for key in self.NOT_JSON_SERIALIZABLE:
if key in deserialized.keys():
deserialized[key] = pickle.loads(deserialized[key])
Expand Down Expand Up @@ -618,7 +618,7 @@ def to_dict(self):


class Credentials(ReprMixin):
"""Contains all neccessary informations to fetch **user's protected resources**."""
"""Contains all necessary information to fetch **user's protected resources**."""

_repr_sensitive = ('token', 'refresh_token', 'token_secret', 'consumer_key', 'consumer_secret')

Expand Down Expand Up @@ -813,7 +813,7 @@ def serialize(self):
# Get the provider type specific items.
rest = self.provider_type_class().to_tuple(self)

# Provider ID and provider type ID are allways the first two items.
# Provider ID and provider type ID are always the first two items.
result = (self.provider_id, self.provider_type_id) + rest

# Make sure that all items are strings.
Expand All @@ -830,7 +830,7 @@ def serialize(self):
def deserialize(cls, credentials):
"""
A *class method* which reconstructs credentials created by :meth:`serialize`.
You can also passit a :class:`.Credentials` instance.
You can also pass it a :class:`.Credentials` instance.
:param dict config:
The same :doc:`config` used in the :func:`.login` to get the credentials.
Expand Down Expand Up @@ -895,7 +895,7 @@ def popup_js(self, callback_name=None, indent=None, custom=None, stay_open=False
#. Triggers the ``options.onLoginComplete(result, closer)`` handler set with the
:ref:`authomatic.setup() <js_setup>` function of :ref:`javascript.js <js>`.
#. Calls the JavasSript callback specified by :data:`callback_name`
#. Calls the JavasScript callback specified by :data:`callback_name`
on the opener of the *login handler popup* and passes it the
*login result* JSON object as first argument and the `closer` function which
you should call in your callback to close the popup.
Expand Down Expand Up @@ -952,7 +952,7 @@ def popup_html(self, callback_name=None, indent=None, title='Login | {}', custom
#. Triggers the ``options.onLoginComplete(result, closer)`` handler set with the
:ref:`authomatic.setup() <js_setup>` function of :ref:`javascript.js <js>`.
#. Calls the JavasSript callback specified by :data:`callback_name`
#. Calls the JavasScript callback specified by :data:`callback_name`
on the opener of the *login handler popup* and passes it the
*login result* JSON object as first argument and the `closer` function which
you should call in your callback to close the popup.
Expand Down Expand Up @@ -1208,7 +1208,7 @@ def setup(config, secret, session_max_age=600, secure_cookie=False,
as a salt by *CSRF* token generation.
:param session_max_age:
Maximum allowed age of :class:`.Session` kookie nonce in seconds.
Maximum allowed age of :class:`.Session` cookie nonce in seconds.
:param bool secure_cookie:
If ``True`` the :class:`.Session` cookie will be saved wit ``Secure`` attribute.
Expand All @@ -1229,7 +1229,7 @@ def setup(config, secret, session_max_age=600, secure_cookie=False,
Default is ``False``.
:param int logging_level:
The logging level treshold as specified in the standard Python
The logging level threshold as specified in the standard Python
`logging library <http://docs.python.org/2/library/logging.html>`_.
Default is ``logging.INFO``
Expand All @@ -1255,7 +1255,7 @@ def setup(config, secret, session_max_age=600, secure_cookie=False,
def login(adapter, provider_name, callback=None, session=None, session_saver=None, **kwargs):
"""
If :data:`provider_name` specified, launches the login procedure
for coresponding :doc:`provider </reference/providers>` and
for corresponding :doc:`provider </reference/providers>` and
returns :class:`.LoginResult`.
If :data:`provider_name` is empty, acts like :func:`.backend`.
Expand Down Expand Up @@ -1538,7 +1538,7 @@ def get(self):
HTTP headers of the **protected resource** request as a JSON object.
:param JSON json:
You can pass all of the aformentioned params except ``type`` in a JSON object.
You can pass all of the aforementioned params except ``type`` in a JSON object.
.. code-block:: javascript
Expand Down
6 changes: 3 additions & 3 deletions authomatic/extras/gae/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ class GAEError(exceptions.BaseError):
class Webapp2Session(interfaces.BaseSession):
"""
A simple wrapper for |webapp2|_ sessions. If you provide a session
it wrapps it and adds the :meth:`.save` method.
it wraps it and adds the :meth:`.save` method.
If you don't provide a session it creates a new one but you must provide the :data:`.secret`.
Expand Down Expand Up @@ -56,7 +56,7 @@ def __init__(self, handler, session=None, secret=None, cookie_name='webapp2autho
The session secret.
:param str cookie_name:
The name of the session kookie.
The name of the session cookie.
:param backend:
The session backend. One of ``'memcache'`` or ``'datastore'``.
Expand Down Expand Up @@ -180,7 +180,7 @@ def initialize(cls):
.. note::
The *Datastore Viewer* in the ``_ah/admin/`` won't let you add properties to a model
if there is not an entity with that property allready.
if there is not an entity with that property already.
Therefore it is a good idea to keep the **"Example"** entity (which has all
possible properties set) in the datastore.
"""
Expand Down
4 changes: 2 additions & 2 deletions authomatic/extras/gae/openid.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# -*- coding: utf-8 -*-

# We need absolute iport to import from openid library which has the same name as this module
# We need absolute import to import from openid library which has the same name as this module
from __future__ import absolute_import
import logging
import datetime
Expand Down Expand Up @@ -99,7 +99,7 @@ def useNonce(cls, server_url, timestamp, salt):

if result:
# if so, the nonce is not valid so return False
cls._log(logging.WARNING, 'NDBOpenIDStore: Nonce was allready used!')
cls._log(logging.WARNING, 'NDBOpenIDStore: Nonce was already used!')
return False
else:
# if not, store the key to datastore and return True
Expand Down
12 changes: 6 additions & 6 deletions authomatic/providers/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ def _error_traceback_html(exc_info, traceback):
Generates error traceback HTML.
:param tuple exc_info:
Output of :finc:`sys.exc_info` function.
Output of :func:`sys.exc_info` function.
:param traceback:
Output of :func:`traceback.format_exc` function.
Expand Down Expand Up @@ -87,7 +87,7 @@ def wrap(provider, *args, **kwargs):
except Exception as e:
if settings.report_errors:
error = e
provider._log(logging.ERROR, 'Reported supressed exception: {}!'.format(repr(error)))
provider._log(logging.ERROR, 'Reported suppressed exception: {}!'.format(repr(error)))
else:
if settings.debug:
# TODO: Check whether it actually works without middleware
Expand Down Expand Up @@ -319,7 +319,7 @@ def csrf_generator():
@classmethod
def _log(cls, level, msg):
"""
Logs a message with preformated prefix.
Logs a message with pre-formatted prefix.
:param int level:
Logging level as specified in the
Expand Down Expand Up @@ -635,7 +635,7 @@ def create_request_elements(self, request_type, credentials, url, method='GET',
|classmethod|
:param int request_type:
Type of the request specified by one of the classe's constants.
Type of the request specified by one of the class's constants.
:param credentials:
:class:`.Credentials` of the **user** whose
Expand Down Expand Up @@ -668,7 +668,7 @@ def create_request_elements(self, request_type, credentials, url, method='GET',
@property
def type_id(self):
"""
A short string reprezenting the provider implementation id used for
A short string representing the provider implementation id used for
serialization of :class:`.Credentials` and to identify the type of provider in JavaScript.
The part before hyphen denotes the type of the provider, the part after hyphen denotes the class id
e.g. ``oauth2.Facebook.type_id = '2-5'``, ``oauth1.Twitter.type_id = '1-5'``.
Expand Down Expand Up @@ -754,7 +754,7 @@ def access(self, url, params=None, method='GET', headers={}, max_redirects=5, co
:returns:
:class:`.Response`
"""

return self.access_with_credentials(credentials=self.credentials,
url=url,
params=params,
Expand Down
2 changes: 1 addition & 1 deletion authomatic/providers/oauth1.py
Original file line number Diff line number Diff line change
Expand Up @@ -789,7 +789,7 @@ def _x_user_parser(user, data):


# The provider type ID is generated from this list's indexes!
# Allways apppend new providers at the end so that ids of existing providers dont change!
# Always append new providers at the end so that ids of existing providers don't change!
PROVIDER_ID_MAP = [OAuth1, Bitbucket, Flickr, Meetup, Plurk, Twitter, Tumblr, UbuntuOne, Vimeo, Xero, Yahoo]


Expand Down
12 changes: 6 additions & 6 deletions authomatic/providers/oauth2.py
Original file line number Diff line number Diff line change
Expand Up @@ -137,11 +137,11 @@ def create_request_elements(cls, request_type, credentials, url, method='GET', p
params['redirect_uri'] = redirect_uri
params['grant_type'] = 'authorization_code'

# TODO: Chenck whether all providers accept it
# TODO: Check whether all providers accept it
headers.update(cls._authorization_header(credentials))
else:
raise OAuth2Error('Credentials with valid token, consumer_key, consumer_secret and argument ' + \
'redirect_uri are required to create OAuth 2.0 acces token request elements!')
'redirect_uri are required to create OAuth 2.0 access token request elements!')

elif request_type == cls.REFRESH_TOKEN_REQUEST_TYPE:
# Refresh access token request.
Expand Down Expand Up @@ -550,7 +550,7 @@ class Facebook(OAuth2):
def _x_request_elements_filter(cls, request_type, request_elements, credentials):

if request_type == cls.REFRESH_TOKEN_REQUEST_TYPE:
# As allways, Facebook has it's original name for "refresh_token"!
# As always, Facebook has it's original name for "refresh_token"!
url, method, params, headers, body = request_elements
params['fb_exchange_token'] = params.pop('refresh_token')
params['grant_type'] = 'fb_exchange_token'
Expand Down Expand Up @@ -592,7 +592,7 @@ def _x_credentials_parser(credentials, data):

@staticmethod
def _x_refresh_credentials_if(credentials):
# Allways refresh.
# Always refresh.
return True


Expand Down Expand Up @@ -905,7 +905,7 @@ class VK(OAuth2):
'consumer_key': '#####',
'consumer_secret': '#####',
'id': authomatic.provider_id(),
'scope': ['1024'] # Allways a single item.
'scope': ['1024'] # Always a single item.
}
}
Expand Down Expand Up @@ -1074,7 +1074,7 @@ def _x_user_parser(user, data):


# The provider type ID is generated from this list's indexes!
# Allways apppend new providers at the end so that ids of existing providers don't change!
# Always append new providers at the end so that ids of existing providers don't change!
PROVIDER_ID_MAP = [OAuth2, Behance, Bitly, Cosm, DeviantART, Facebook, Foursquare, GitHub, Google, LinkedIn,
PayPal, Reddit, Viadeo, VK, WindowsLive, Yammer, Yandex]

Expand Down
14 changes: 7 additions & 7 deletions authomatic/providers/openid.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
"""

# We need absolute iport to import from openid library which has the same name as this module
# We need absolute import to import from openid library which has the same name as this module
from __future__ import absolute_import
import datetime
import logging
Expand All @@ -33,7 +33,7 @@
__all__ = ['OpenID', 'Yahoo', 'Google']


# Supress openid logging.
# Suppress openid logging.
oidutil.log = lambda message, level=0: None


Expand Down Expand Up @@ -91,7 +91,7 @@ def __init__(self, session, nonce_timeout=None):

def storeAssociation(self, server_url, association):
self._log(logging.DEBUG, 'SessionOpenIDStore: Storing association to session.')
# Allways store only one association as a tuple.
# Always store only one association as a tuple.
self.session['oia'] = (server_url, association.handle, association.serialize())


Expand Down Expand Up @@ -225,7 +225,7 @@ def __init__(self, *args, **kwargs):
# AX
self.ax = self._kwarg(kwargs, 'ax', self.AX)
self.ax_required = self._kwarg(kwargs, 'ax_required', self.AX_REQUIRED)
# add required schemas to schemas if not allready there
# add required schemas to schemas if not already there
for i in self.ax_required:
if i not in self.ax:
self.ax.append(i)
Expand Down Expand Up @@ -319,15 +319,15 @@ def login(self):

# get user ID
data['guid'] = response.getDisplayIdentifier()

self._log(logging.INFO, 'Authentication successful.')

# get user data from AX response
ax_response = ax.FetchResponse.fromSuccessResponse(response)
if ax_response and ax_response.data:
self._log(logging.INFO, 'Got AX data.')
ax_data = {}
# conver iterable values to their first item
# convert iterable values to their first item
for k, v in ax_response.data.iteritems():
if v and type(v) in (list, tuple):
ax_data[k] = v[0]
Expand Down Expand Up @@ -375,7 +375,7 @@ def login(self):
url=self.identifier,
original_message=e.message)

self._log(logging.INFO, 'Service discovery for identifier {} successfull.'.format(self.identifier))
self._log(logging.INFO, 'Service discovery for identifier {} successful.'.format(self.identifier))

# add SREG extension
# we need to remove required fields from optional fields because addExtension then raises an error
Expand Down
6 changes: 3 additions & 3 deletions authomatic/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,11 +26,11 @@
#: If ``True`` the :class:`.Session` cookie will be saved wit ``Secure`` attribute.
secure_cookie = None

#: Maximum allowed age of :class:`.Session` kookie nonce in seconds.
#: Maximum allowed age of :class:`.Session` cookie nonce in seconds.
session_max_age = 600

#: :class:`int` The logging level treshold as specified in the standard Python
#: :class:`int` The logging level threshold as specified in the standard Python
#: `logging library <http://docs.python.org/2/library/logging.html>`_.
logging_level = logging.INFO

fetch_headers = {}
fetch_headers = {}
Loading

0 comments on commit fc089d9

Please sign in to comment.