[Python-modules-commits] [python-openid-cla] 01/04: Initial import of python-openid-cla-1.2
Sergio Durigan Junior
sergiodj-guest at moszumanska.debian.org
Mon Jul 11 22:40:53 UTC 2016
This is an automated email from the git hooks/post-receive script.
sergiodj-guest pushed a commit to branch master
in repository python-openid-cla.
commit 74b22a6db7d5a303766e44174f5ecfecc78e03c9
Author: Sergio Durigan Junior <sergiodj at sergiodj.net>
Date: Mon Jul 11 17:46:35 2016 -0400
Initial import of python-openid-cla-1.2
---
PKG-INFO | 11 ++
openid_cla/__init__.py | 25 ++++
openid_cla/cla.py | 144 ++++++++++++++++++++++++
python_openid_cla.egg-info/PKG-INFO | 11 ++
python_openid_cla.egg-info/SOURCES.txt | 9 ++
python_openid_cla.egg-info/dependency_links.txt | 1 +
python_openid_cla.egg-info/requires.txt | 2 +
python_openid_cla.egg-info/top_level.txt | 1 +
python_openid_cla.egg-info/zip-safe | 1 +
setup.cfg | 5 +
setup.py | 48 ++++++++
11 files changed, 258 insertions(+)
diff --git a/PKG-INFO b/PKG-INFO
new file mode 100644
index 0000000..f45b498
--- /dev/null
+++ b/PKG-INFO
@@ -0,0 +1,11 @@
+Metadata-Version: 1.0
+Name: python-openid-cla
+Version: 1.2
+Summary: This is an implementation of the OpenID cla extension for python-openid
+Home-page: http://www.github.com/puiterwijk/python-openid-cla/
+Author: Patrick Uiterwijk
+Author-email: puiterwijk at gmail.com
+License: BSD
+Description: UNKNOWN
+Keywords: openid cla
+Platform: UNKNOWN
diff --git a/openid_cla/__init__.py b/openid_cla/__init__.py
new file mode 100644
index 0000000..d4ec196
--- /dev/null
+++ b/openid_cla/__init__.py
@@ -0,0 +1,25 @@
+# Copyright (c) 2013, Patrick Uiterwijk <puiterwijk at gmail.com>
+# All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions are met:
+# * Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# * Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in the
+# documentation and/or other materials provided with the distribution.
+# * Neither the name of Patrick Uiterwijk nor the
+# names of its contributors may be used to endorse or promote products
+# derived from this software without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+# ARE DISCLAIMED. IN NO EVENT SHALL Patrick Uiterwijk BE LIABLE FOR ANY
+# DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+# (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+# ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
diff --git a/openid_cla/cla.py b/openid_cla/cla.py
new file mode 100644
index 0000000..1996ee9
--- /dev/null
+++ b/openid_cla/cla.py
@@ -0,0 +1,144 @@
+"""CLA extension request and response parsing and object representation
+ at var cla_uri: The URI used for the CLA extension namespace and XRD Type Value
+"""
+
+from openid.message import (
+ registerNamespaceAlias,
+ NamespaceAliasRegistrationError,
+)
+from openid.extension import Extension
+import logging
+
+import six
+
+__all__ = [
+ 'CLARequest',
+ 'CLAResponse',
+ 'cla_uri',
+ 'supportsCLA',
+]
+
+# The namespace for this extension
+cla_uri = 'http://fedoraproject.org/specs/open_id/cla'
+
+# Some predefined CLA uris
+CLA_URI_FEDORA_CLICK = 'http://admin.fedoraproject.org/accounts/cla/click'
+CLA_URI_FEDORA_DELL = 'http://admin.fedoraproject.org/accounts/cla/dell'
+CLA_URI_FEDORA_DONE = 'http://admin.fedoraproject.org/accounts/cla/done'
+CLA_URI_FEDORA_FEDORA = 'http://admin.fedoraproject.org/accounts/cla/fedora'
+CLA_URI_FEDORA_FPCA = 'http://admin.fedoraproject.org/accounts/cla/fpca'
+CLA_URI_FEDORA_IBM = 'http://admin.fedoraproject.org/accounts/cla/ibm'
+CLA_URI_FEDORA_INTEL = 'http://admin.fedoraproject.org/accounts/cla/intel'
+CLA_URI_FEDORA_REDHAT = 'http://admin.fedoraproject.org/accounts/cla/redhat'
+
+
+try:
+ registerNamespaceAlias(cla_uri, 'cla')
+except NamespaceAliasRegistrationError as e:
+ logging.exception('registerNamespaceAlias(%r, %r) failed: %s' % (
+ cla_uri, 'cla', str(e),))
+
+
+def supportsCLA(endpoint):
+ return endpoint.usesExtension(cla_uri)
+
+
+class CLARequest(Extension):
+ ns_uri = 'http://fedoraproject.org/specs/open_id/cla'
+ ns_alias = 'cla'
+
+ def __init__(self, requested=None):
+ Extension.__init__(self)
+ self.requested = []
+
+ if requested:
+ self.requestCLAs(requested)
+
+ def requestedCLAs(self):
+ return self.requested
+
+ def fromOpenIDRequest(cls, request):
+ self = cls()
+
+ # Since we're going to mess with namespace URI mapping, don't
+ # mutate the object that was passed in.
+ message = request.message.copy()
+
+ args = message.getArgs(self.ns_uri)
+ self.parseExtensionArgs(args)
+
+ return self
+
+ fromOpenIDRequest = classmethod(fromOpenIDRequest)
+
+ def parseExtensionArgs(self, args):
+ items = args.get('query_cla')
+ if items:
+ for cla_uri in items.split(','):
+ self.requestCLA(cla_uri)
+
+ def wereCLAsRequested(self):
+ return bool(self.requested)
+
+ def __requests__(self, cla_uri):
+ return cla_uri in self.requested
+
+ def requestCLA(self, cla_uri):
+ if not cla_uri in self.requested:
+ self.requested.append(cla_uri)
+
+ def requestCLAs(self, cla_uris):
+ if isinstance(cla_uris, six.string_types):
+ raise TypeError('CLA URIs should be passed as a list of '
+ 'strings (not %r)' % (type(field_names),))
+
+ for cla_uri in cla_uris:
+ self.requestCLA(cla_uri)
+
+ def getExtensionArgs(self):
+ args = {}
+
+ if self.requested:
+ args['query_cla'] = ','.join(self.requested)
+
+ return args
+
+
+class CLAResponse(Extension):
+ ns_uri = 'http://fedoraproject.org/specs/open_id/cla'
+ ns_alias = 'cla'
+
+ def __init__(self, clas=None):
+ Extension.__init__(self)
+ if clas is None:
+ self.clas = []
+ else:
+ self.clas = clas
+
+ def extractResponse(cls, request, clas):
+ self = cls()
+ for cla in request.requestedCLAs():
+ if cla in clas:
+ self.clas.append(cla)
+ return self
+
+ extractResponse = classmethod(extractResponse)
+
+ def fromSuccessResponse(cls, success_response, signed_only=True):
+ self = cls()
+ if signed_only:
+ args = success_response.getSignedNS(self.ns_uri)
+ else:
+ args = success_response.message.getArgs(self.ns_uri)
+
+ if not args:
+ return None
+
+ self.clas = args['signed_cla'].split(',')
+
+ return self
+
+ fromSuccessResponse = classmethod(fromSuccessResponse)
+
+ def getExtensionArgs(self):
+ return {'signed_cla': ','.join(self.clas)}
diff --git a/python_openid_cla.egg-info/PKG-INFO b/python_openid_cla.egg-info/PKG-INFO
new file mode 100644
index 0000000..f45b498
--- /dev/null
+++ b/python_openid_cla.egg-info/PKG-INFO
@@ -0,0 +1,11 @@
+Metadata-Version: 1.0
+Name: python-openid-cla
+Version: 1.2
+Summary: This is an implementation of the OpenID cla extension for python-openid
+Home-page: http://www.github.com/puiterwijk/python-openid-cla/
+Author: Patrick Uiterwijk
+Author-email: puiterwijk at gmail.com
+License: BSD
+Description: UNKNOWN
+Keywords: openid cla
+Platform: UNKNOWN
diff --git a/python_openid_cla.egg-info/SOURCES.txt b/python_openid_cla.egg-info/SOURCES.txt
new file mode 100644
index 0000000..32cd62e
--- /dev/null
+++ b/python_openid_cla.egg-info/SOURCES.txt
@@ -0,0 +1,9 @@
+setup.py
+openid_cla/__init__.py
+openid_cla/cla.py
+python_openid_cla.egg-info/PKG-INFO
+python_openid_cla.egg-info/SOURCES.txt
+python_openid_cla.egg-info/dependency_links.txt
+python_openid_cla.egg-info/requires.txt
+python_openid_cla.egg-info/top_level.txt
+python_openid_cla.egg-info/zip-safe
\ No newline at end of file
diff --git a/python_openid_cla.egg-info/dependency_links.txt b/python_openid_cla.egg-info/dependency_links.txt
new file mode 100644
index 0000000..8b13789
--- /dev/null
+++ b/python_openid_cla.egg-info/dependency_links.txt
@@ -0,0 +1 @@
+
diff --git a/python_openid_cla.egg-info/requires.txt b/python_openid_cla.egg-info/requires.txt
new file mode 100644
index 0000000..6bb08e0
--- /dev/null
+++ b/python_openid_cla.egg-info/requires.txt
@@ -0,0 +1,2 @@
+six
+python-openid>=2.2.5
\ No newline at end of file
diff --git a/python_openid_cla.egg-info/top_level.txt b/python_openid_cla.egg-info/top_level.txt
new file mode 100644
index 0000000..b589346
--- /dev/null
+++ b/python_openid_cla.egg-info/top_level.txt
@@ -0,0 +1 @@
+openid_cla
diff --git a/python_openid_cla.egg-info/zip-safe b/python_openid_cla.egg-info/zip-safe
new file mode 100644
index 0000000..8b13789
--- /dev/null
+++ b/python_openid_cla.egg-info/zip-safe
@@ -0,0 +1 @@
+
diff --git a/setup.cfg b/setup.cfg
new file mode 100644
index 0000000..861a9f5
--- /dev/null
+++ b/setup.cfg
@@ -0,0 +1,5 @@
+[egg_info]
+tag_build =
+tag_date = 0
+tag_svn_revision = 0
+
diff --git a/setup.py b/setup.py
new file mode 100644
index 0000000..13d643a
--- /dev/null
+++ b/setup.py
@@ -0,0 +1,48 @@
+# Copyright (c) 2013, Patrick Uiterwijk <puiterwijk at gmail.com>
+# All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions are met:
+# * Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# * Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in the
+# documentation and/or other materials provided with the distribution.
+# * Neither the name of Patrick Uiterwijk nor the
+# names of its contributors may be used to endorse or promote products
+# derived from this software without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+# ARE DISCLAIMED. IN NO EVENT SHALL Patrick Uiterwijk BE LIABLE FOR ANY
+# DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+# (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+# ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+import sys
+from setuptools import setup, find_packages
+
+install_requires = ['six']
+
+if sys.version_info[0] == 2:
+ install_requires.append('python-openid>=2.2.5')
+elif sys.version_info[0] == 3:
+ install_requires.append('python3-openid')
+
+setup(
+ name = "python-openid-cla",
+ version = "1.2",
+ install_requires = install_requires,
+ zip_safe = True,
+ packages = ['openid_cla'],
+ author = 'Patrick Uiterwijk',
+ author_email = 'puiterwijk at gmail.com',
+ description = 'This is an implementation of the OpenID cla extension for python-openid',
+ license = 'BSD',
+ keywords = 'openid cla',
+ url = 'http://www.github.com/puiterwijk/python-openid-cla/',
+)
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/python-modules/packages/python-openid-cla.git
More information about the Python-modules-commits
mailing list