repository_name
stringlengths
5
67
func_path_in_repository
stringlengths
4
234
func_name
stringlengths
0
314
whole_func_string
stringlengths
52
3.87M
language
stringclasses
6 values
func_code_string
stringlengths
52
3.87M
func_documentation_string
stringlengths
1
47.2k
func_code_url
stringlengths
85
339
nitmir/django-cas-server
cas_server/auth.py
DjangoAuthUser.attributs
def attributs(self): """ The user attributes, defined as the fields on the :attr:`user` object. :return: a :class:`dict` with the :attr:`user` object fields. Attributes may be If the user do not exists, the returned :class:`dict` is empty. :rtype: dict ...
python
def attributs(self): """ The user attributes, defined as the fields on the :attr:`user` object. :return: a :class:`dict` with the :attr:`user` object fields. Attributes may be If the user do not exists, the returned :class:`dict` is empty. :rtype: dict ...
The user attributes, defined as the fields on the :attr:`user` object. :return: a :class:`dict` with the :attr:`user` object fields. Attributes may be If the user do not exists, the returned :class:`dict` is empty. :rtype: dict
https://github.com/nitmir/django-cas-server/blob/d106181b94c444f1946269da5c20f6c904840ad3/cas_server/auth.py#L436-L476
nitmir/django-cas-server
cas_server/utils.py
json_encode
def json_encode(obj): """Encode a python object to json""" try: return json_encode.encoder.encode(obj) except AttributeError: json_encode.encoder = DjangoJSONEncoder(default=six.text_type) return json_encode(obj)
python
def json_encode(obj): """Encode a python object to json""" try: return json_encode.encoder.encode(obj) except AttributeError: json_encode.encoder = DjangoJSONEncoder(default=six.text_type) return json_encode(obj)
Encode a python object to json
https://github.com/nitmir/django-cas-server/blob/d106181b94c444f1946269da5c20f6c904840ad3/cas_server/utils.py#L50-L56
nitmir/django-cas-server
cas_server/utils.py
context
def context(params): """ Function that add somes variable to the context before template rendering :param dict params: The context dictionary used to render templates. :return: The ``params`` dictionary with the key ``settings`` set to :obj:`django.conf.settings`. :rtype...
python
def context(params): """ Function that add somes variable to the context before template rendering :param dict params: The context dictionary used to render templates. :return: The ``params`` dictionary with the key ``settings`` set to :obj:`django.conf.settings`. :rtype...
Function that add somes variable to the context before template rendering :param dict params: The context dictionary used to render templates. :return: The ``params`` dictionary with the key ``settings`` set to :obj:`django.conf.settings`. :rtype: dict
https://github.com/nitmir/django-cas-server/blob/d106181b94c444f1946269da5c20f6c904840ad3/cas_server/utils.py#L59-L100
nitmir/django-cas-server
cas_server/utils.py
json_response
def json_response(request, data): """ Wrapper dumping `data` to a json and sending it to the user with an HttpResponse :param django.http.HttpRequest request: The request object used to generate this response. :param dict data: The python dictionnary to return as a json :return: The...
python
def json_response(request, data): """ Wrapper dumping `data` to a json and sending it to the user with an HttpResponse :param django.http.HttpRequest request: The request object used to generate this response. :param dict data: The python dictionnary to return as a json :return: The...
Wrapper dumping `data` to a json and sending it to the user with an HttpResponse :param django.http.HttpRequest request: The request object used to generate this response. :param dict data: The python dictionnary to return as a json :return: The content of ``data`` serialized in json :r...
https://github.com/nitmir/django-cas-server/blob/d106181b94c444f1946269da5c20f6c904840ad3/cas_server/utils.py#L103-L115
nitmir/django-cas-server
cas_server/utils.py
import_attr
def import_attr(path): """ transform a python dotted path to the attr :param path: A dotted path to a python object or a python object :type path: :obj:`unicode` or :obj:`str` or anything :return: The python object pointed by the dotted path or the python object unchanged """ ...
python
def import_attr(path): """ transform a python dotted path to the attr :param path: A dotted path to a python object or a python object :type path: :obj:`unicode` or :obj:`str` or anything :return: The python object pointed by the dotted path or the python object unchanged """ ...
transform a python dotted path to the attr :param path: A dotted path to a python object or a python object :type path: :obj:`unicode` or :obj:`str` or anything :return: The python object pointed by the dotted path or the python object unchanged
https://github.com/nitmir/django-cas-server/blob/d106181b94c444f1946269da5c20f6c904840ad3/cas_server/utils.py#L118-L140
nitmir/django-cas-server
cas_server/utils.py
redirect_params
def redirect_params(url_name, params=None): """ Redirect to ``url_name`` with ``params`` as querystring :param unicode url_name: a URL pattern name :param params: Some parameter to append to the reversed URL :type params: :obj:`dict` or :obj:`NoneType<types.NoneType>` :retur...
python
def redirect_params(url_name, params=None): """ Redirect to ``url_name`` with ``params`` as querystring :param unicode url_name: a URL pattern name :param params: Some parameter to append to the reversed URL :type params: :obj:`dict` or :obj:`NoneType<types.NoneType>` :retur...
Redirect to ``url_name`` with ``params`` as querystring :param unicode url_name: a URL pattern name :param params: Some parameter to append to the reversed URL :type params: :obj:`dict` or :obj:`NoneType<types.NoneType>` :return: A redirection to the URL with name ``url_name`` with ``pa...
https://github.com/nitmir/django-cas-server/blob/d106181b94c444f1946269da5c20f6c904840ad3/cas_server/utils.py#L143-L155
nitmir/django-cas-server
cas_server/utils.py
reverse_params
def reverse_params(url_name, params=None, **kwargs): """ compute the reverse url of ``url_name`` and add to it parameters from ``params`` as querystring :param unicode url_name: a URL pattern name :param params: Some parameter to append to the reversed URL :type params: :obj...
python
def reverse_params(url_name, params=None, **kwargs): """ compute the reverse url of ``url_name`` and add to it parameters from ``params`` as querystring :param unicode url_name: a URL pattern name :param params: Some parameter to append to the reversed URL :type params: :obj...
compute the reverse url of ``url_name`` and add to it parameters from ``params`` as querystring :param unicode url_name: a URL pattern name :param params: Some parameter to append to the reversed URL :type params: :obj:`dict` or :obj:`NoneType<types.NoneType>` :param **kwargs: a...
https://github.com/nitmir/django-cas-server/blob/d106181b94c444f1946269da5c20f6c904840ad3/cas_server/utils.py#L158-L175
nitmir/django-cas-server
cas_server/utils.py
copy_params
def copy_params(get_or_post_params, ignore=None): """ copy a :class:`django.http.QueryDict` in a :obj:`dict` ignoring keys in the set ``ignore`` :param django.http.QueryDict get_or_post_params: A GET or POST :class:`QueryDict<django.http.QueryDict>` :param set ignore: An optinal...
python
def copy_params(get_or_post_params, ignore=None): """ copy a :class:`django.http.QueryDict` in a :obj:`dict` ignoring keys in the set ``ignore`` :param django.http.QueryDict get_or_post_params: A GET or POST :class:`QueryDict<django.http.QueryDict>` :param set ignore: An optinal...
copy a :class:`django.http.QueryDict` in a :obj:`dict` ignoring keys in the set ``ignore`` :param django.http.QueryDict get_or_post_params: A GET or POST :class:`QueryDict<django.http.QueryDict>` :param set ignore: An optinal set of keys to ignore during the copy :return: A copy of ...
https://github.com/nitmir/django-cas-server/blob/d106181b94c444f1946269da5c20f6c904840ad3/cas_server/utils.py#L178-L194
nitmir/django-cas-server
cas_server/utils.py
set_cookie
def set_cookie(response, key, value, max_age): """ Set the cookie ``key`` on ``response`` with value ``value`` valid for ``max_age`` secondes :param django.http.HttpResponse response: a django response where to set the cookie :param unicode key: the cookie key :param unicode value: ...
python
def set_cookie(response, key, value, max_age): """ Set the cookie ``key`` on ``response`` with value ``value`` valid for ``max_age`` secondes :param django.http.HttpResponse response: a django response where to set the cookie :param unicode key: the cookie key :param unicode value: ...
Set the cookie ``key`` on ``response`` with value ``value`` valid for ``max_age`` secondes :param django.http.HttpResponse response: a django response where to set the cookie :param unicode key: the cookie key :param unicode value: the cookie value :param int max_age: the maximum validi...
https://github.com/nitmir/django-cas-server/blob/d106181b94c444f1946269da5c20f6c904840ad3/cas_server/utils.py#L197-L217
nitmir/django-cas-server
cas_server/utils.py
get_current_url
def get_current_url(request, ignore_params=None): """ Giving a django request, return the current http url, possibly ignoring some GET parameters :param django.http.HttpRequest request: The current request object. :param set ignore_params: An optional set of GET parameters to ignore ...
python
def get_current_url(request, ignore_params=None): """ Giving a django request, return the current http url, possibly ignoring some GET parameters :param django.http.HttpRequest request: The current request object. :param set ignore_params: An optional set of GET parameters to ignore ...
Giving a django request, return the current http url, possibly ignoring some GET parameters :param django.http.HttpRequest request: The current request object. :param set ignore_params: An optional set of GET parameters to ignore :return: The URL of the current page, possibly omitting some para...
https://github.com/nitmir/django-cas-server/blob/d106181b94c444f1946269da5c20f6c904840ad3/cas_server/utils.py#L220-L238
nitmir/django-cas-server
cas_server/utils.py
update_url
def update_url(url, params): """ update parameters using ``params`` in the ``url`` query string :param url: An URL possibily with a querystring :type url: :obj:`unicode` or :obj:`str` :param dict params: A dictionary of parameters for updating the url querystring :return: Th...
python
def update_url(url, params): """ update parameters using ``params`` in the ``url`` query string :param url: An URL possibily with a querystring :type url: :obj:`unicode` or :obj:`str` :param dict params: A dictionary of parameters for updating the url querystring :return: Th...
update parameters using ``params`` in the ``url`` query string :param url: An URL possibily with a querystring :type url: :obj:`unicode` or :obj:`str` :param dict params: A dictionary of parameters for updating the url querystring :return: The URL with an updated querystring :rt...
https://github.com/nitmir/django-cas-server/blob/d106181b94c444f1946269da5c20f6c904840ad3/cas_server/utils.py#L241-L270
nitmir/django-cas-server
cas_server/utils.py
unpack_nested_exception
def unpack_nested_exception(error): """ If exception are stacked, return the first one :param error: A python exception with possible exception embeded within :return: A python exception with no exception embeded within """ i = 0 while True: if error.args[i:]: ...
python
def unpack_nested_exception(error): """ If exception are stacked, return the first one :param error: A python exception with possible exception embeded within :return: A python exception with no exception embeded within """ i = 0 while True: if error.args[i:]: ...
If exception are stacked, return the first one :param error: A python exception with possible exception embeded within :return: A python exception with no exception embeded within
https://github.com/nitmir/django-cas-server/blob/d106181b94c444f1946269da5c20f6c904840ad3/cas_server/utils.py#L273-L290
nitmir/django-cas-server
cas_server/utils.py
_gen_ticket
def _gen_ticket(prefix=None, lg=settings.CAS_TICKET_LEN): """ Generate a ticket with prefix ``prefix`` and length ``lg`` :param unicode prefix: An optional prefix (probably ST, PT, PGT or PGTIOU) :param int lg: The length of the generated ticket (with the prefix) :return: A randomll...
python
def _gen_ticket(prefix=None, lg=settings.CAS_TICKET_LEN): """ Generate a ticket with prefix ``prefix`` and length ``lg`` :param unicode prefix: An optional prefix (probably ST, PT, PGT or PGTIOU) :param int lg: The length of the generated ticket (with the prefix) :return: A randomll...
Generate a ticket with prefix ``prefix`` and length ``lg`` :param unicode prefix: An optional prefix (probably ST, PT, PGT or PGTIOU) :param int lg: The length of the generated ticket (with the prefix) :return: A randomlly generated ticket of length ``lg`` :rtype: unicode
https://github.com/nitmir/django-cas-server/blob/d106181b94c444f1946269da5c20f6c904840ad3/cas_server/utils.py#L293-L310
nitmir/django-cas-server
cas_server/utils.py
get_tuple
def get_tuple(nuplet, index, default=None): """ :param tuple nuplet: A tuple :param int index: An index :param default: An optional default value :return: ``nuplet[index]`` if defined, else ``default`` (possibly ``None``) """ if nuplet is None: return default try:...
python
def get_tuple(nuplet, index, default=None): """ :param tuple nuplet: A tuple :param int index: An index :param default: An optional default value :return: ``nuplet[index]`` if defined, else ``default`` (possibly ``None``) """ if nuplet is None: return default try:...
:param tuple nuplet: A tuple :param int index: An index :param default: An optional default value :return: ``nuplet[index]`` if defined, else ``default`` (possibly ``None``)
https://github.com/nitmir/django-cas-server/blob/d106181b94c444f1946269da5c20f6c904840ad3/cas_server/utils.py#L378-L390
nitmir/django-cas-server
cas_server/utils.py
crypt_salt_is_valid
def crypt_salt_is_valid(salt): """ Validate a salt as crypt salt :param str salt: a password salt :return: ``True`` if ``salt`` is a valid crypt salt on this system, ``False`` otherwise :rtype: bool """ if len(salt) < 2: return False else: if salt[0] == '...
python
def crypt_salt_is_valid(salt): """ Validate a salt as crypt salt :param str salt: a password salt :return: ``True`` if ``salt`` is a valid crypt salt on this system, ``False`` otherwise :rtype: bool """ if len(salt) < 2: return False else: if salt[0] == '...
Validate a salt as crypt salt :param str salt: a password salt :return: ``True`` if ``salt`` is a valid crypt salt on this system, ``False`` otherwise :rtype: bool
https://github.com/nitmir/django-cas-server/blob/d106181b94c444f1946269da5c20f6c904840ad3/cas_server/utils.py#L393-L417
nitmir/django-cas-server
cas_server/utils.py
check_password
def check_password(method, password, hashed_password, charset): """ Check that ``password`` match `hashed_password` using ``method``, assuming the encoding is ``charset``. :param str method: on of ``"crypt"``, ``"ldap"``, ``"hex_md5"``, ``"hex_sha1"``, ``"hex_sha224"``, ``"hex_s...
python
def check_password(method, password, hashed_password, charset): """ Check that ``password`` match `hashed_password` using ``method``, assuming the encoding is ``charset``. :param str method: on of ``"crypt"``, ``"ldap"``, ``"hex_md5"``, ``"hex_sha1"``, ``"hex_sha224"``, ``"hex_s...
Check that ``password`` match `hashed_password` using ``method``, assuming the encoding is ``charset``. :param str method: on of ``"crypt"``, ``"ldap"``, ``"hex_md5"``, ``"hex_sha1"``, ``"hex_sha224"``, ``"hex_sha256"``, ``"hex_sha384"``, ``"hex_sha512"``, ``"plain"`` :param passwor...
https://github.com/nitmir/django-cas-server/blob/d106181b94c444f1946269da5c20f6c904840ad3/cas_server/utils.py#L607-L658
nitmir/django-cas-server
cas_server/utils.py
last_version
def last_version(): """ Fetch the last version from pypi and return it. On successful fetch from pypi, the response is cached 24h, on error, it is cached 10 min. :return: the last django-cas-server version :rtype: unicode """ try: last_update, version, success = last...
python
def last_version(): """ Fetch the last version from pypi and return it. On successful fetch from pypi, the response is cached 24h, on error, it is cached 10 min. :return: the last django-cas-server version :rtype: unicode """ try: last_update, version, success = last...
Fetch the last version from pypi and return it. On successful fetch from pypi, the response is cached 24h, on error, it is cached 10 min. :return: the last django-cas-server version :rtype: unicode
https://github.com/nitmir/django-cas-server/blob/d106181b94c444f1946269da5c20f6c904840ad3/cas_server/utils.py#L673-L705
nitmir/django-cas-server
cas_server/utils.py
regexpr_validator
def regexpr_validator(value): """ Test that ``value`` is a valid regular expression :param unicode value: A regular expression to test :raises ValidationError: if ``value`` is not a valid regular expression """ try: re.compile(value) except re.error: raise Valida...
python
def regexpr_validator(value): """ Test that ``value`` is a valid regular expression :param unicode value: A regular expression to test :raises ValidationError: if ``value`` is not a valid regular expression """ try: re.compile(value) except re.error: raise Valida...
Test that ``value`` is a valid regular expression :param unicode value: A regular expression to test :raises ValidationError: if ``value`` is not a valid regular expression
https://github.com/nitmir/django-cas-server/blob/d106181b94c444f1946269da5c20f6c904840ad3/cas_server/utils.py#L736-L749
nitmir/django-cas-server
cas_server/utils.py
LdapHashUserPassword._raise_bad_scheme
def _raise_bad_scheme(cls, scheme, valid, msg): """ Raise :attr:`BadScheme` error for ``scheme``, possible valid scheme are in ``valid``, the error message is ``msg`` :param bytes scheme: A bad scheme :param list valid: A list a valid scheme :param st...
python
def _raise_bad_scheme(cls, scheme, valid, msg): """ Raise :attr:`BadScheme` error for ``scheme``, possible valid scheme are in ``valid``, the error message is ``msg`` :param bytes scheme: A bad scheme :param list valid: A list a valid scheme :param st...
Raise :attr:`BadScheme` error for ``scheme``, possible valid scheme are in ``valid``, the error message is ``msg`` :param bytes scheme: A bad scheme :param list valid: A list a valid scheme :param str msg: The error template message :raises LdapHashUserPasswo...
https://github.com/nitmir/django-cas-server/blob/d106181b94c444f1946269da5c20f6c904840ad3/cas_server/utils.py#L470-L482
nitmir/django-cas-server
cas_server/utils.py
LdapHashUserPassword.hash
def hash(cls, scheme, password, salt=None, charset="utf8"): """ Hash ``password`` with ``scheme`` using ``salt``. This three variable beeing encoded in ``charset``. :param bytes scheme: A valid scheme :param bytes password: A byte string to hash using ``scheme`` ...
python
def hash(cls, scheme, password, salt=None, charset="utf8"): """ Hash ``password`` with ``scheme`` using ``salt``. This three variable beeing encoded in ``charset``. :param bytes scheme: A valid scheme :param bytes password: A byte string to hash using ``scheme`` ...
Hash ``password`` with ``scheme`` using ``salt``. This three variable beeing encoded in ``charset``. :param bytes scheme: A valid scheme :param bytes password: A byte string to hash using ``scheme`` :param bytes salt: An optional salt to use if ``scheme`` requires any ...
https://github.com/nitmir/django-cas-server/blob/d106181b94c444f1946269da5c20f6c904840ad3/cas_server/utils.py#L530-L562
nitmir/django-cas-server
cas_server/utils.py
LdapHashUserPassword.get_scheme
def get_scheme(cls, hashed_passord): """ Return the scheme of ``hashed_passord`` or raise :attr:`BadHash` :param bytes hashed_passord: A hashed password :return: The scheme used by the hashed password :rtype: bytes :raises BadHash: if no valid scheme ...
python
def get_scheme(cls, hashed_passord): """ Return the scheme of ``hashed_passord`` or raise :attr:`BadHash` :param bytes hashed_passord: A hashed password :return: The scheme used by the hashed password :rtype: bytes :raises BadHash: if no valid scheme ...
Return the scheme of ``hashed_passord`` or raise :attr:`BadHash` :param bytes hashed_passord: A hashed password :return: The scheme used by the hashed password :rtype: bytes :raises BadHash: if no valid scheme is found within ``hashed_passord``
https://github.com/nitmir/django-cas-server/blob/d106181b94c444f1946269da5c20f6c904840ad3/cas_server/utils.py#L565-L578
nitmir/django-cas-server
cas_server/utils.py
LdapHashUserPassword.get_salt
def get_salt(cls, hashed_passord): """ Return the salt of ``hashed_passord`` possibly empty :param bytes hashed_passord: A hashed password :return: The salt used by the hashed password (empty if no salt is used) :rtype: bytes :raises BadHash: if no va...
python
def get_salt(cls, hashed_passord): """ Return the salt of ``hashed_passord`` possibly empty :param bytes hashed_passord: A hashed password :return: The salt used by the hashed password (empty if no salt is used) :rtype: bytes :raises BadHash: if no va...
Return the salt of ``hashed_passord`` possibly empty :param bytes hashed_passord: A hashed password :return: The salt used by the hashed password (empty if no salt is used) :rtype: bytes :raises BadHash: if no valid scheme is found within ``hashed_passord`` or if the ...
https://github.com/nitmir/django-cas-server/blob/d106181b94c444f1946269da5c20f6c904840ad3/cas_server/utils.py#L581-L604
nitmir/django-cas-server
cas_server/federate.py
CASFederateValidateUser.verify_ticket
def verify_ticket(self, ticket): """ test ``ticket`` against the CAS provider, if valid, create a :class:`FederatedUser<cas_server.models.FederatedUser>` matching provider returned username and attributes. :param unicode ticket: The ticket to validate against the...
python
def verify_ticket(self, ticket): """ test ``ticket`` against the CAS provider, if valid, create a :class:`FederatedUser<cas_server.models.FederatedUser>` matching provider returned username and attributes. :param unicode ticket: The ticket to validate against the...
test ``ticket`` against the CAS provider, if valid, create a :class:`FederatedUser<cas_server.models.FederatedUser>` matching provider returned username and attributes. :param unicode ticket: The ticket to validate against the provider CAS :return: ``True`` if the valida...
https://github.com/nitmir/django-cas-server/blob/d106181b94c444f1946269da5c20f6c904840ad3/cas_server/federate.py#L70-L99
nitmir/django-cas-server
cas_server/federate.py
CASFederateValidateUser.register_slo
def register_slo(username, session_key, ticket): """ association a ``ticket`` with a (``username``, ``session_key``) for processing later SLO request by creating a :class:`cas_server.models.FederateSLO` object. :param unicode username: A logged user username, with the ``@`` ...
python
def register_slo(username, session_key, ticket): """ association a ``ticket`` with a (``username``, ``session_key``) for processing later SLO request by creating a :class:`cas_server.models.FederateSLO` object. :param unicode username: A logged user username, with the ``@`` ...
association a ``ticket`` with a (``username``, ``session_key``) for processing later SLO request by creating a :class:`cas_server.models.FederateSLO` object. :param unicode username: A logged user username, with the ``@`` component. :param unicode session_key: A logged user session_...
https://github.com/nitmir/django-cas-server/blob/d106181b94c444f1946269da5c20f6c904840ad3/cas_server/federate.py#L102-L119
nitmir/django-cas-server
cas_server/federate.py
CASFederateValidateUser.clean_sessions
def clean_sessions(self, logout_request): """ process a SLO request: Search for ticket values in ``logout_request``. For each ticket value matching a :class:`cas_server.models.FederateSLO`, disconnect the corresponding user. :param unicode logout_request: An XML ...
python
def clean_sessions(self, logout_request): """ process a SLO request: Search for ticket values in ``logout_request``. For each ticket value matching a :class:`cas_server.models.FederateSLO`, disconnect the corresponding user. :param unicode logout_request: An XML ...
process a SLO request: Search for ticket values in ``logout_request``. For each ticket value matching a :class:`cas_server.models.FederateSLO`, disconnect the corresponding user. :param unicode logout_request: An XML document contening one or more Single Log Out requ...
https://github.com/nitmir/django-cas-server/blob/d106181b94c444f1946269da5c20f6c904840ad3/cas_server/federate.py#L121-L153
nitmir/django-cas-server
docs/_ext/djangodocs.py
visit_snippet
def visit_snippet(self, node): """ HTML document generator visit handler """ lang = self.highlightlang linenos = node.rawsource.count('\n') >= self.highlightlinenothreshold - 1 fname = node['filename'] highlight_args = node.get('highlight_args', {}) if 'language' in node: # code-...
python
def visit_snippet(self, node): """ HTML document generator visit handler """ lang = self.highlightlang linenos = node.rawsource.count('\n') >= self.highlightlinenothreshold - 1 fname = node['filename'] highlight_args = node.get('highlight_args', {}) if 'language' in node: # code-...
HTML document generator visit handler
https://github.com/nitmir/django-cas-server/blob/d106181b94c444f1946269da5c20f6c904840ad3/docs/_ext/djangodocs.py#L90-L118
nitmir/django-cas-server
docs/_ext/djangodocs.py
visit_snippet_latex
def visit_snippet_latex(self, node): """ Latex document generator visit handler """ code = node.rawsource.rstrip('\n') lang = self.hlsettingstack[-1][0] linenos = code.count('\n') >= self.hlsettingstack[-1][1] - 1 fname = node['filename'] highlight_args = node.get('highlight_args', {}) ...
python
def visit_snippet_latex(self, node): """ Latex document generator visit handler """ code = node.rawsource.rstrip('\n') lang = self.hlsettingstack[-1][0] linenos = code.count('\n') >= self.hlsettingstack[-1][1] - 1 fname = node['filename'] highlight_args = node.get('highlight_args', {}) ...
Latex document generator visit handler
https://github.com/nitmir/django-cas-server/blob/d106181b94c444f1946269da5c20f6c904840ad3/docs/_ext/djangodocs.py#L121-L166
valerymelou/django-active-link
active_link/templatetags/active_link_tags.py
active_link
def active_link(context, viewnames, css_class=None, strict=None, *args, **kwargs): """ Renders the given CSS class if the request path matches the path of the view. :param context: The context where the tag was called. Used to access the request object. :param viewnames: The name of the view or views se...
python
def active_link(context, viewnames, css_class=None, strict=None, *args, **kwargs): """ Renders the given CSS class if the request path matches the path of the view. :param context: The context where the tag was called. Used to access the request object. :param viewnames: The name of the view or views se...
Renders the given CSS class if the request path matches the path of the view. :param context: The context where the tag was called. Used to access the request object. :param viewnames: The name of the view or views separated by || (include namespaces if any). :param css_class: The CSS class to render. :...
https://github.com/valerymelou/django-active-link/blob/4791e7af2fb6d77d3ef2a3f3be0241b5c3019beb/active_link/templatetags/active_link_tags.py#L14-L48
nitmir/django-cas-server
cas_server/forms.py
UserCredential.clean
def clean(self): """ Validate that the submited :attr:`username` and :attr:`password` are valid :raises django.forms.ValidationError: if the :attr:`username` and :attr:`password` are not valid. :return: The cleaned POST data :rtype: dict "...
python
def clean(self): """ Validate that the submited :attr:`username` and :attr:`password` are valid :raises django.forms.ValidationError: if the :attr:`username` and :attr:`password` are not valid. :return: The cleaned POST data :rtype: dict "...
Validate that the submited :attr:`username` and :attr:`password` are valid :raises django.forms.ValidationError: if the :attr:`username` and :attr:`password` are not valid. :return: The cleaned POST data :rtype: dict
https://github.com/nitmir/django-cas-server/blob/d106181b94c444f1946269da5c20f6c904840ad3/cas_server/forms.py#L118-L136
nitmir/django-cas-server
cas_server/forms.py
FederateUserCredential.clean
def clean(self): """ Validate that the submited :attr:`username` and :attr:`password` are valid using the :class:`CASFederateAuth<cas_server.auth.CASFederateAuth>` auth class. :raises django.forms.ValidationError: if the :attr:`username` and :attr:`password` ...
python
def clean(self): """ Validate that the submited :attr:`username` and :attr:`password` are valid using the :class:`CASFederateAuth<cas_server.auth.CASFederateAuth>` auth class. :raises django.forms.ValidationError: if the :attr:`username` and :attr:`password` ...
Validate that the submited :attr:`username` and :attr:`password` are valid using the :class:`CASFederateAuth<cas_server.auth.CASFederateAuth>` auth class. :raises django.forms.ValidationError: if the :attr:`username` and :attr:`password` do not correspond to a :class:`FederatedU...
https://github.com/nitmir/django-cas-server/blob/d106181b94c444f1946269da5c20f6c904840ad3/cas_server/forms.py#L167-L188
nitmir/django-cas-server
cas_server/views.py
LogoutMixin.logout
def logout(self, all_session=False): """ effectively destroy a CAS session :param boolean all_session: If ``True`` destroy all the user sessions, otherwise destroy the current user session. :return: The number of destroyed sessions :rtype: int ...
python
def logout(self, all_session=False): """ effectively destroy a CAS session :param boolean all_session: If ``True`` destroy all the user sessions, otherwise destroy the current user session. :return: The number of destroyed sessions :rtype: int ...
effectively destroy a CAS session :param boolean all_session: If ``True`` destroy all the user sessions, otherwise destroy the current user session. :return: The number of destroyed sessions :rtype: int
https://github.com/nitmir/django-cas-server/blob/d106181b94c444f1946269da5c20f6c904840ad3/cas_server/views.py#L53-L108
nitmir/django-cas-server
cas_server/views.py
LogoutView.init_get
def init_get(self, request): """ Initialize the :class:`LogoutView` attributes on GET request :param django.http.HttpRequest request: The current request object """ self.request = request self.service = request.GET.get('service') self.url = request.GET.ge...
python
def init_get(self, request): """ Initialize the :class:`LogoutView` attributes on GET request :param django.http.HttpRequest request: The current request object """ self.request = request self.service = request.GET.get('service') self.url = request.GET.ge...
Initialize the :class:`LogoutView` attributes on GET request :param django.http.HttpRequest request: The current request object
https://github.com/nitmir/django-cas-server/blob/d106181b94c444f1946269da5c20f6c904840ad3/cas_server/views.py#L137-L146
nitmir/django-cas-server
cas_server/views.py
LogoutView.get
def get(self, request, *args, **kwargs): """ method called on GET request on this view :param django.http.HttpRequest request: The current request object """ logger.info("logout requested") # initialize the class attributes self.init_get(request) ...
python
def get(self, request, *args, **kwargs): """ method called on GET request on this view :param django.http.HttpRequest request: The current request object """ logger.info("logout requested") # initialize the class attributes self.init_get(request) ...
method called on GET request on this view :param django.http.HttpRequest request: The current request object
https://github.com/nitmir/django-cas-server/blob/d106181b94c444f1946269da5c20f6c904840ad3/cas_server/views.py#L148-L231
nitmir/django-cas-server
cas_server/views.py
FederateAuth.get_cas_client
def get_cas_client(self, request, provider, renew=False): """ return a CAS client object matching provider :param django.http.HttpRequest request: The current request object :param cas_server.models.FederatedIendityProvider provider: the user identity provider :r...
python
def get_cas_client(self, request, provider, renew=False): """ return a CAS client object matching provider :param django.http.HttpRequest request: The current request object :param cas_server.models.FederatedIendityProvider provider: the user identity provider :r...
return a CAS client object matching provider :param django.http.HttpRequest request: The current request object :param cas_server.models.FederatedIendityProvider provider: the user identity provider :return: The user CAS client object :rtype: :class:`federate.CASFederate...
https://github.com/nitmir/django-cas-server/blob/d106181b94c444f1946269da5c20f6c904840ad3/cas_server/views.py#L244-L257
nitmir/django-cas-server
cas_server/views.py
FederateAuth.post
def post(self, request, provider=None): """ method called on POST request :param django.http.HttpRequest request: The current request object :param unicode provider: Optional parameter. The user provider suffix. """ # if settings.CAS_FEDERATE is not True redi...
python
def post(self, request, provider=None): """ method called on POST request :param django.http.HttpRequest request: The current request object :param unicode provider: Optional parameter. The user provider suffix. """ # if settings.CAS_FEDERATE is not True redi...
method called on POST request :param django.http.HttpRequest request: The current request object :param unicode provider: Optional parameter. The user provider suffix.
https://github.com/nitmir/django-cas-server/blob/d106181b94c444f1946269da5c20f6c904840ad3/cas_server/views.py#L259-L301
nitmir/django-cas-server
cas_server/views.py
FederateAuth.get
def get(self, request, provider=None): """ method called on GET request :param django.http.HttpRequestself. request: The current request object :param unicode provider: Optional parameter. The user provider suffix. """ # if settings.CAS_FEDERATE is not True r...
python
def get(self, request, provider=None): """ method called on GET request :param django.http.HttpRequestself. request: The current request object :param unicode provider: Optional parameter. The user provider suffix. """ # if settings.CAS_FEDERATE is not True r...
method called on GET request :param django.http.HttpRequestself. request: The current request object :param unicode provider: Optional parameter. The user provider suffix.
https://github.com/nitmir/django-cas-server/blob/d106181b94c444f1946269da5c20f6c904840ad3/cas_server/views.py#L303-L392
nitmir/django-cas-server
cas_server/views.py
LoginView.init_post
def init_post(self, request): """ Initialize POST received parameters :param django.http.HttpRequest request: The current request object """ self.request = request self.service = request.POST.get('service') self.renew = bool(request.POST.get('renew') and ...
python
def init_post(self, request): """ Initialize POST received parameters :param django.http.HttpRequest request: The current request object """ self.request = request self.service = request.POST.get('service') self.renew = bool(request.POST.get('renew') and ...
Initialize POST received parameters :param django.http.HttpRequest request: The current request object
https://github.com/nitmir/django-cas-server/blob/d106181b94c444f1946269da5c20f6c904840ad3/cas_server/views.py#L442-L460
nitmir/django-cas-server
cas_server/views.py
LoginView.gen_lt
def gen_lt(self): """Generate a new LoginTicket and add it to the list of valid LT for the user""" self.request.session['lt'] = self.request.session.get('lt', []) + [utils.gen_lt()] if len(self.request.session['lt']) > 100: self.request.session['lt'] = self.request.session['lt'][-100...
python
def gen_lt(self): """Generate a new LoginTicket and add it to the list of valid LT for the user""" self.request.session['lt'] = self.request.session.get('lt', []) + [utils.gen_lt()] if len(self.request.session['lt']) > 100: self.request.session['lt'] = self.request.session['lt'][-100...
Generate a new LoginTicket and add it to the list of valid LT for the user
https://github.com/nitmir/django-cas-server/blob/d106181b94c444f1946269da5c20f6c904840ad3/cas_server/views.py#L462-L466
nitmir/django-cas-server
cas_server/views.py
LoginView.check_lt
def check_lt(self): """ Check is the POSTed LoginTicket is valid, if yes invalide it :return: ``True`` if the LoginTicket is valid, ``False`` otherwise :rtype: bool """ # save LT for later check lt_valid = self.request.session.get('lt', []) lt...
python
def check_lt(self): """ Check is the POSTed LoginTicket is valid, if yes invalide it :return: ``True`` if the LoginTicket is valid, ``False`` otherwise :rtype: bool """ # save LT for later check lt_valid = self.request.session.get('lt', []) lt...
Check is the POSTed LoginTicket is valid, if yes invalide it :return: ``True`` if the LoginTicket is valid, ``False`` otherwise :rtype: bool
https://github.com/nitmir/django-cas-server/blob/d106181b94c444f1946269da5c20f6c904840ad3/cas_server/views.py#L468-L488
nitmir/django-cas-server
cas_server/views.py
LoginView.post
def post(self, request, *args, **kwargs): """ method called on POST request on this view :param django.http.HttpRequest request: The current request object """ # initialize class parameters self.init_post(request) # process the POST request ret = ...
python
def post(self, request, *args, **kwargs): """ method called on POST request on this view :param django.http.HttpRequest request: The current request object """ # initialize class parameters self.init_post(request) # process the POST request ret = ...
method called on POST request on this view :param django.http.HttpRequest request: The current request object
https://github.com/nitmir/django-cas-server/blob/d106181b94c444f1946269da5c20f6c904840ad3/cas_server/views.py#L490-L541
nitmir/django-cas-server
cas_server/views.py
LoginView.process_post
def process_post(self): """ Analyse the POST request: * check that the LoginTicket is valid * check that the user sumited credentials are valid :return: * :attr:`INVALID_LOGIN_TICKET` if the POSTed LoginTicket is not valid ...
python
def process_post(self): """ Analyse the POST request: * check that the LoginTicket is valid * check that the user sumited credentials are valid :return: * :attr:`INVALID_LOGIN_TICKET` if the POSTed LoginTicket is not valid ...
Analyse the POST request: * check that the LoginTicket is valid * check that the user sumited credentials are valid :return: * :attr:`INVALID_LOGIN_TICKET` if the POSTed LoginTicket is not valid * :attr:`USER_ALREADY_LOGGED` if the user is al...
https://github.com/nitmir/django-cas-server/blob/d106181b94c444f1946269da5c20f6c904840ad3/cas_server/views.py#L543-L581
nitmir/django-cas-server
cas_server/views.py
LoginView.init_get
def init_get(self, request): """ Initialize GET received parameters :param django.http.HttpRequest request: The current request object """ self.request = request self.service = request.GET.get('service') self.renew = bool(request.GET.get('renew') and requ...
python
def init_get(self, request): """ Initialize GET received parameters :param django.http.HttpRequest request: The current request object """ self.request = request self.service = request.GET.get('service') self.renew = bool(request.GET.get('renew') and requ...
Initialize GET received parameters :param django.http.HttpRequest request: The current request object
https://github.com/nitmir/django-cas-server/blob/d106181b94c444f1946269da5c20f6c904840ad3/cas_server/views.py#L583-L604
nitmir/django-cas-server
cas_server/views.py
LoginView.get
def get(self, request, *args, **kwargs): """ method called on GET request on this view :param django.http.HttpRequest request: The current request object """ # initialize class parameters self.init_get(request) # process the GET request self.proce...
python
def get(self, request, *args, **kwargs): """ method called on GET request on this view :param django.http.HttpRequest request: The current request object """ # initialize class parameters self.init_get(request) # process the GET request self.proce...
method called on GET request on this view :param django.http.HttpRequest request: The current request object
https://github.com/nitmir/django-cas-server/blob/d106181b94c444f1946269da5c20f6c904840ad3/cas_server/views.py#L606-L617
nitmir/django-cas-server
cas_server/views.py
LoginView.process_get
def process_get(self): """ Analyse the GET request :return: * :attr:`USER_NOT_AUTHENTICATED` if the user is not authenticated or is requesting for authentication renewal * :attr:`USER_AUTHENTICATED` if the user is authenticated and is no...
python
def process_get(self): """ Analyse the GET request :return: * :attr:`USER_NOT_AUTHENTICATED` if the user is not authenticated or is requesting for authentication renewal * :attr:`USER_AUTHENTICATED` if the user is authenticated and is no...
Analyse the GET request :return: * :attr:`USER_NOT_AUTHENTICATED` if the user is not authenticated or is requesting for authentication renewal * :attr:`USER_AUTHENTICATED` if the user is authenticated and is not requesting for authenticati...
https://github.com/nitmir/django-cas-server/blob/d106181b94c444f1946269da5c20f6c904840ad3/cas_server/views.py#L619-L636
nitmir/django-cas-server
cas_server/views.py
LoginView.init_form
def init_form(self, values=None): """ Initialization of the good form depending of POST and GET parameters :param django.http.QueryDict values: A POST or GET QueryDict """ if values: values = values.copy() values['lt'] = self.request.session['lt']...
python
def init_form(self, values=None): """ Initialization of the good form depending of POST and GET parameters :param django.http.QueryDict values: A POST or GET QueryDict """ if values: values = values.copy() values['lt'] = self.request.session['lt']...
Initialization of the good form depending of POST and GET parameters :param django.http.QueryDict values: A POST or GET QueryDict
https://github.com/nitmir/django-cas-server/blob/d106181b94c444f1946269da5c20f6c904840ad3/cas_server/views.py#L638-L671
nitmir/django-cas-server
cas_server/views.py
LoginView.service_login
def service_login(self): """ Perform login against a service :return: * The rendering of the ``settings.CAS_WARN_TEMPLATE`` if the user asked to be warned before ticket emission and has not yep been warned. * The redirection to the servi...
python
def service_login(self): """ Perform login against a service :return: * The rendering of the ``settings.CAS_WARN_TEMPLATE`` if the user asked to be warned before ticket emission and has not yep been warned. * The redirection to the servi...
Perform login against a service :return: * The rendering of the ``settings.CAS_WARN_TEMPLATE`` if the user asked to be warned before ticket emission and has not yep been warned. * The redirection to the service URL with a ticket GET parameter ...
https://github.com/nitmir/django-cas-server/blob/d106181b94c444f1946269da5c20f6c904840ad3/cas_server/views.py#L673-L773
nitmir/django-cas-server
cas_server/views.py
LoginView.authenticated
def authenticated(self): """ Processing authenticated users :return: * The returned value of :meth:`service_login` if :attr:`service` is defined * The rendering of ``settings.CAS_LOGGED_TEMPLATE`` otherwise :rtype: django.http.HttpResponse ...
python
def authenticated(self): """ Processing authenticated users :return: * The returned value of :meth:`service_login` if :attr:`service` is defined * The rendering of ``settings.CAS_LOGGED_TEMPLATE`` otherwise :rtype: django.http.HttpResponse ...
Processing authenticated users :return: * The returned value of :meth:`service_login` if :attr:`service` is defined * The rendering of ``settings.CAS_LOGGED_TEMPLATE`` otherwise :rtype: django.http.HttpResponse
https://github.com/nitmir/django-cas-server/blob/d106181b94c444f1946269da5c20f6c904840ad3/cas_server/views.py#L775-L822
nitmir/django-cas-server
cas_server/views.py
LoginView.not_authenticated
def not_authenticated(self): """ Processing non authenticated users :return: * The rendering of ``settings.CAS_LOGIN_TEMPLATE`` with various messages depending of GET/POST parameters * The redirection to :class:`FederateAuth` if ``settin...
python
def not_authenticated(self): """ Processing non authenticated users :return: * The rendering of ``settings.CAS_LOGIN_TEMPLATE`` with various messages depending of GET/POST parameters * The redirection to :class:`FederateAuth` if ``settin...
Processing non authenticated users :return: * The rendering of ``settings.CAS_LOGIN_TEMPLATE`` with various messages depending of GET/POST parameters * The redirection to :class:`FederateAuth` if ``settings.CAS_FEDERATE`` is ``True`` and t...
https://github.com/nitmir/django-cas-server/blob/d106181b94c444f1946269da5c20f6c904840ad3/cas_server/views.py#L824-L930
nitmir/django-cas-server
cas_server/views.py
LoginView.common
def common(self): """ Common part execute uppon GET and POST request :return: * The returned value of :meth:`authenticated` if the user is authenticated and not requesting for authentication or if the authentication has just been renewed ...
python
def common(self): """ Common part execute uppon GET and POST request :return: * The returned value of :meth:`authenticated` if the user is authenticated and not requesting for authentication or if the authentication has just been renewed ...
Common part execute uppon GET and POST request :return: * The returned value of :meth:`authenticated` if the user is authenticated and not requesting for authentication or if the authentication has just been renewed * The returned value of :meth:`not_authen...
https://github.com/nitmir/django-cas-server/blob/d106181b94c444f1946269da5c20f6c904840ad3/cas_server/views.py#L932-L946
nitmir/django-cas-server
cas_server/views.py
Auth.post
def post(request): """ method called on POST request on this view :param django.http.HttpRequest request: The current request object :return: ``HttpResponse(u"yes\\n")`` if the POSTed tuple (username, password, service) if valid (i.e. (username, password) is ...
python
def post(request): """ method called on POST request on this view :param django.http.HttpRequest request: The current request object :return: ``HttpResponse(u"yes\\n")`` if the POSTed tuple (username, password, service) if valid (i.e. (username, password) is ...
method called on POST request on this view :param django.http.HttpRequest request: The current request object :return: ``HttpResponse(u"yes\\n")`` if the POSTed tuple (username, password, service) if valid (i.e. (username, password) is valid dans username is allowed on service)....
https://github.com/nitmir/django-cas-server/blob/d106181b94c444f1946269da5c20f6c904840ad3/cas_server/views.py#L958-L1008
nitmir/django-cas-server
cas_server/views.py
Validate.get
def get(request): """ method called on GET request on this view :param django.http.HttpRequest request: The current request object :return: * ``HttpResponse("yes\\nusername")`` if submited (service, ticket) is valid * else ``HttpResponse("no\\...
python
def get(request): """ method called on GET request on this view :param django.http.HttpRequest request: The current request object :return: * ``HttpResponse("yes\\nusername")`` if submited (service, ticket) is valid * else ``HttpResponse("no\\...
method called on GET request on this view :param django.http.HttpRequest request: The current request object :return: * ``HttpResponse("yes\\nusername")`` if submited (service, ticket) is valid * else ``HttpResponse("no\\n")`` :rtype: django.http.Http...
https://github.com/nitmir/django-cas-server/blob/d106181b94c444f1946269da5c20f6c904840ad3/cas_server/views.py#L1014-L1058
nitmir/django-cas-server
cas_server/views.py
ValidateService.get
def get(self, request): """ method called on GET request on this view :param django.http.HttpRequest request: The current request object: :return: The rendering of ``cas_server/serviceValidate.xml`` if no errors is raised, the rendering or ``cas_server/servic...
python
def get(self, request): """ method called on GET request on this view :param django.http.HttpRequest request: The current request object: :return: The rendering of ``cas_server/serviceValidate.xml`` if no errors is raised, the rendering or ``cas_server/servic...
method called on GET request on this view :param django.http.HttpRequest request: The current request object: :return: The rendering of ``cas_server/serviceValidate.xml`` if no errors is raised, the rendering or ``cas_server/serviceValidateError.xml`` otherwise. :rty...
https://github.com/nitmir/django-cas-server/blob/d106181b94c444f1946269da5c20f6c904840ad3/cas_server/views.py#L1125-L1189
nitmir/django-cas-server
cas_server/views.py
ValidateService.process_ticket
def process_ticket(self): """ fetch the ticket against the database and check its validity :raises ValidateError: if the ticket is not found or not valid, potentially for that service :returns: A couple (ticket, proxies list) :rtype: :obj:`tuple` ...
python
def process_ticket(self): """ fetch the ticket against the database and check its validity :raises ValidateError: if the ticket is not found or not valid, potentially for that service :returns: A couple (ticket, proxies list) :rtype: :obj:`tuple` ...
fetch the ticket against the database and check its validity :raises ValidateError: if the ticket is not found or not valid, potentially for that service :returns: A couple (ticket, proxies list) :rtype: :obj:`tuple`
https://github.com/nitmir/django-cas-server/blob/d106181b94c444f1946269da5c20f6c904840ad3/cas_server/views.py#L1191-L1217
nitmir/django-cas-server
cas_server/views.py
ValidateService.process_pgturl
def process_pgturl(self, params): """ Handle PGT request :param dict params: A template context dict :raises ValidateError: if pgtUrl is invalid or if TLS validation of the pgtUrl fails :return: The rendering of ``cas_server/serviceValidate.xml``, using ``params`...
python
def process_pgturl(self, params): """ Handle PGT request :param dict params: A template context dict :raises ValidateError: if pgtUrl is invalid or if TLS validation of the pgtUrl fails :return: The rendering of ``cas_server/serviceValidate.xml``, using ``params`...
Handle PGT request :param dict params: A template context dict :raises ValidateError: if pgtUrl is invalid or if TLS validation of the pgtUrl fails :return: The rendering of ``cas_server/serviceValidate.xml``, using ``params`` :rtype: django.http.HttpResponse
https://github.com/nitmir/django-cas-server/blob/d106181b94c444f1946269da5c20f6c904840ad3/cas_server/views.py#L1219-L1282
nitmir/django-cas-server
cas_server/views.py
Proxy.get
def get(self, request): """ method called on GET request on this view :param django.http.HttpRequest request: The current request object: :return: The returned value of :meth:`process_proxy` if no error is raised, else the rendering of ``cas_server/serviceVal...
python
def get(self, request): """ method called on GET request on this view :param django.http.HttpRequest request: The current request object: :return: The returned value of :meth:`process_proxy` if no error is raised, else the rendering of ``cas_server/serviceVal...
method called on GET request on this view :param django.http.HttpRequest request: The current request object: :return: The returned value of :meth:`process_proxy` if no error is raised, else the rendering of ``cas_server/serviceValidateError.xml``. :rtype: django.htt...
https://github.com/nitmir/django-cas-server/blob/d106181b94c444f1946269da5c20f6c904840ad3/cas_server/views.py#L1295-L1318
nitmir/django-cas-server
cas_server/views.py
Proxy.process_proxy
def process_proxy(self): """ handle PT request :raises ValidateError: if the PGT is not found, or the target service not allowed or the user not allowed on the tardet service. :return: The rendering of ``cas_server/proxy.xml`` :rtype: django.http....
python
def process_proxy(self): """ handle PT request :raises ValidateError: if the PGT is not found, or the target service not allowed or the user not allowed on the tardet service. :return: The rendering of ``cas_server/proxy.xml`` :rtype: django.http....
handle PT request :raises ValidateError: if the PGT is not found, or the target service not allowed or the user not allowed on the tardet service. :return: The rendering of ``cas_server/proxy.xml`` :rtype: django.http.HttpResponse
https://github.com/nitmir/django-cas-server/blob/d106181b94c444f1946269da5c20f6c904840ad3/cas_server/views.py#L1320-L1369
nitmir/django-cas-server
cas_server/views.py
SamlValidateError.context
def context(self): """ :return: A dictionary to contextualize :attr:`template` :rtype: dict """ return { 'code': self.code, 'msg': self.msg, 'IssueInstant': timezone.now().isoformat(), 'ResponseID': utils.gen_saml_id() ...
python
def context(self): """ :return: A dictionary to contextualize :attr:`template` :rtype: dict """ return { 'code': self.code, 'msg': self.msg, 'IssueInstant': timezone.now().isoformat(), 'ResponseID': utils.gen_saml_id() ...
:return: A dictionary to contextualize :attr:`template` :rtype: dict
https://github.com/nitmir/django-cas-server/blob/d106181b94c444f1946269da5c20f6c904840ad3/cas_server/views.py#L1378-L1388
nitmir/django-cas-server
cas_server/views.py
SamlValidate.post
def post(self, request): """ method called on POST request on this view :param django.http.HttpRequest request: The current request object :return: the rendering of ``cas_server/samlValidate.xml`` if no error is raised, else the rendering of ``cas_server/saml...
python
def post(self, request): """ method called on POST request on this view :param django.http.HttpRequest request: The current request object :return: the rendering of ``cas_server/samlValidate.xml`` if no error is raised, else the rendering of ``cas_server/saml...
method called on POST request on this view :param django.http.HttpRequest request: The current request object :return: the rendering of ``cas_server/samlValidate.xml`` if no error is raised, else the rendering of ``cas_server/samlValidateError.xml``. :rtype: django.h...
https://github.com/nitmir/django-cas-server/blob/d106181b94c444f1946269da5c20f6c904840ad3/cas_server/views.py#L1398-L1444
nitmir/django-cas-server
cas_server/views.py
SamlValidate.process_ticket
def process_ticket(self): """ validate ticket from SAML XML body :raises: SamlValidateError: if the ticket is not found or not valid, or if we fail to parse the posted XML. :return: a ticket object :rtype: :class:`models.Ticket<cas_server.models.T...
python
def process_ticket(self): """ validate ticket from SAML XML body :raises: SamlValidateError: if the ticket is not found or not valid, or if we fail to parse the posted XML. :return: a ticket object :rtype: :class:`models.Ticket<cas_server.models.T...
validate ticket from SAML XML body :raises: SamlValidateError: if the ticket is not found or not valid, or if we fail to parse the posted XML. :return: a ticket object :rtype: :class:`models.Ticket<cas_server.models.Ticket>`
https://github.com/nitmir/django-cas-server/blob/d106181b94c444f1946269da5c20f6c904840ad3/cas_server/views.py#L1446-L1473
pipermerriam/flex
flex/cli.py
main
def main(source): """ For a given command line supplied argument, negotiate the content, parse the schema and then return any issues to stdout or if no schema issues, return success exit code. """ if source is None: click.echo( "You need to supply a file or url to a schema to...
python
def main(source): """ For a given command line supplied argument, negotiate the content, parse the schema and then return any issues to stdout or if no schema issues, return success exit code. """ if source is None: click.echo( "You need to supply a file or url to a schema to...
For a given command line supplied argument, negotiate the content, parse the schema and then return any issues to stdout or if no schema issues, return success exit code.
https://github.com/pipermerriam/flex/blob/233f8149fb851a6255753bcec948cb6fefb2723b/flex/cli.py#L12-L29
pipermerriam/flex
flex/loading/schema/host.py
host_validator
def host_validator(value, **kwargs): """ From: http://stackoverflow.com/questions/2532053/validate-a-hostname-string According to: http://en.wikipedia.org/wiki/Hostname#Restrictions_on_valid_host_names """ scheme, hostname, port, path = decompose_hostname(value) if len(hostname) > 255: ...
python
def host_validator(value, **kwargs): """ From: http://stackoverflow.com/questions/2532053/validate-a-hostname-string According to: http://en.wikipedia.org/wiki/Hostname#Restrictions_on_valid_host_names """ scheme, hostname, port, path = decompose_hostname(value) if len(hostname) > 255: ...
From: http://stackoverflow.com/questions/2532053/validate-a-hostname-string According to: http://en.wikipedia.org/wiki/Hostname#Restrictions_on_valid_host_names
https://github.com/pipermerriam/flex/blob/233f8149fb851a6255753bcec948cb6fefb2723b/flex/loading/schema/host.py#L39-L69
pipermerriam/flex
flex/functional.py
methodcaller
def methodcaller(name, *args): """ Upstream bug in python: https://bugs.python.org/issue26822 """ func = operator.methodcaller(name, *args) return lambda obj, **kwargs: func(obj)
python
def methodcaller(name, *args): """ Upstream bug in python: https://bugs.python.org/issue26822 """ func = operator.methodcaller(name, *args) return lambda obj, **kwargs: func(obj)
Upstream bug in python: https://bugs.python.org/issue26822
https://github.com/pipermerriam/flex/blob/233f8149fb851a6255753bcec948cb6fefb2723b/flex/functional.py#L55-L61
pipermerriam/flex
flex/core.py
load_source
def load_source(source): """ Common entry point for loading some form of raw swagger schema. Supports: - python object (dictionary-like) - path to yaml file - path to json file - file object (json or yaml). - json string. - yaml string. """ if isinsta...
python
def load_source(source): """ Common entry point for loading some form of raw swagger schema. Supports: - python object (dictionary-like) - path to yaml file - path to json file - file object (json or yaml). - json string. - yaml string. """ if isinsta...
Common entry point for loading some form of raw swagger schema. Supports: - python object (dictionary-like) - path to yaml file - path to json file - file object (json or yaml). - json string. - yaml string.
https://github.com/pipermerriam/flex/blob/233f8149fb851a6255753bcec948cb6fefb2723b/flex/core.py#L33-L78
pipermerriam/flex
flex/core.py
validate
def validate(raw_schema, target=None, **kwargs): """ Given the python representation of a JSONschema as defined in the swagger spec, validate that the schema complies to spec. If `target` is provided, that target will be validated against the provided schema. """ schema = schema_validator(raw_s...
python
def validate(raw_schema, target=None, **kwargs): """ Given the python representation of a JSONschema as defined in the swagger spec, validate that the schema complies to spec. If `target` is provided, that target will be validated against the provided schema. """ schema = schema_validator(raw_s...
Given the python representation of a JSONschema as defined in the swagger spec, validate that the schema complies to spec. If `target` is provided, that target will be validated against the provided schema.
https://github.com/pipermerriam/flex/blob/233f8149fb851a6255753bcec948cb6fefb2723b/flex/core.py#L103-L111
pipermerriam/flex
flex/core.py
validate_api_response
def validate_api_response(schema, raw_response, request_method='get', raw_request=None): """ Validate the response of an api call against a swagger schema. """ request = None if raw_request is not None: request = normalize_request(raw_request) response = None if raw_response is not ...
python
def validate_api_response(schema, raw_response, request_method='get', raw_request=None): """ Validate the response of an api call against a swagger schema. """ request = None if raw_request is not None: request = normalize_request(raw_request) response = None if raw_response is not ...
Validate the response of an api call against a swagger schema.
https://github.com/pipermerriam/flex/blob/233f8149fb851a6255753bcec948cb6fefb2723b/flex/core.py#L121-L138
pipermerriam/flex
flex/core.py
validate_api_call
def validate_api_call(schema, raw_request, raw_response): """ Validate the request/response cycle of an api call against a swagger schema. Request/Response objects from the `requests` and `urllib` library are supported. """ request = normalize_request(raw_request) with ErrorDict() as error...
python
def validate_api_call(schema, raw_request, raw_response): """ Validate the request/response cycle of an api call against a swagger schema. Request/Response objects from the `requests` and `urllib` library are supported. """ request = normalize_request(raw_request) with ErrorDict() as error...
Validate the request/response cycle of an api call against a swagger schema. Request/Response objects from the `requests` and `urllib` library are supported.
https://github.com/pipermerriam/flex/blob/233f8149fb851a6255753bcec948cb6fefb2723b/flex/core.py#L141-L168
pipermerriam/flex
flex/compat/validate_email.py
validate_email
def validate_email(email, check_mx=False, verify=False, debug=False, smtp_timeout=10): """Indicate whether the given string is a valid email address according to the 'addr-spec' portion of RFC 2822 (see section 3.4.1). Parts of the spec that are marked obsolete are *not* included in this test, and cert...
python
def validate_email(email, check_mx=False, verify=False, debug=False, smtp_timeout=10): """Indicate whether the given string is a valid email address according to the 'addr-spec' portion of RFC 2822 (see section 3.4.1). Parts of the spec that are marked obsolete are *not* included in this test, and cert...
Indicate whether the given string is a valid email address according to the 'addr-spec' portion of RFC 2822 (see section 3.4.1). Parts of the spec that are marked obsolete are *not* included in this test, and certain arcane constructions that depend on circular definitions in the spec may not pass, but...
https://github.com/pipermerriam/flex/blob/233f8149fb851a6255753bcec948cb6fefb2723b/flex/compat/validate_email.py#L112-L177
pipermerriam/flex
flex/parameters.py
find_parameter
def find_parameter(parameters, **kwargs): """ Given a list of parameters, find the one with the given name. """ matching_parameters = filter_parameters(parameters, **kwargs) if len(matching_parameters) == 1: return matching_parameters[0] elif len(matching_parameters) > 1: raise M...
python
def find_parameter(parameters, **kwargs): """ Given a list of parameters, find the one with the given name. """ matching_parameters = filter_parameters(parameters, **kwargs) if len(matching_parameters) == 1: return matching_parameters[0] elif len(matching_parameters) > 1: raise M...
Given a list of parameters, find the one with the given name.
https://github.com/pipermerriam/flex/blob/233f8149fb851a6255753bcec948cb6fefb2723b/flex/parameters.py#L25-L34
pipermerriam/flex
flex/parameters.py
merge_parameter_lists
def merge_parameter_lists(*parameter_definitions): """ Merge multiple lists of parameters into a single list. If there are any duplicate definitions, the last write wins. """ merged_parameters = {} for parameter_list in parameter_definitions: for parameter in parameter_list: ...
python
def merge_parameter_lists(*parameter_definitions): """ Merge multiple lists of parameters into a single list. If there are any duplicate definitions, the last write wins. """ merged_parameters = {} for parameter_list in parameter_definitions: for parameter in parameter_list: ...
Merge multiple lists of parameters into a single list. If there are any duplicate definitions, the last write wins.
https://github.com/pipermerriam/flex/blob/233f8149fb851a6255753bcec948cb6fefb2723b/flex/parameters.py#L37-L47
pipermerriam/flex
flex/validation/response.py
validate_status_code_to_response_definition
def validate_status_code_to_response_definition(response, operation_definition): """ Given a response, validate that the response status code is in the accepted status codes defined by this endpoint. If so, return the response definition that corresponds to the status code. """ status_code = re...
python
def validate_status_code_to_response_definition(response, operation_definition): """ Given a response, validate that the response status code is in the accepted status codes defined by this endpoint. If so, return the response definition that corresponds to the status code. """ status_code = re...
Given a response, validate that the response status code is in the accepted status codes defined by this endpoint. If so, return the response definition that corresponds to the status code.
https://github.com/pipermerriam/flex/blob/233f8149fb851a6255753bcec948cb6fefb2723b/flex/validation/response.py#L37-L60
pipermerriam/flex
flex/validation/response.py
generate_path_validator
def generate_path_validator(api_path, path_definition, parameters, context, **kwargs): """ Generates a callable for validating the parameters in a response object. """ path_level_parameters = dereference_parameter_list( path_definition.get('parameters', []), c...
python
def generate_path_validator(api_path, path_definition, parameters, context, **kwargs): """ Generates a callable for validating the parameters in a response object. """ path_level_parameters = dereference_parameter_list( path_definition.get('parameters', []), c...
Generates a callable for validating the parameters in a response object.
https://github.com/pipermerriam/flex/blob/233f8149fb851a6255753bcec948cb6fefb2723b/flex/validation/response.py#L115-L139
pipermerriam/flex
flex/validation/response.py
validate_response
def validate_response(response, request_method, schema): """ Response validation involves the following steps. 4. validate that the response status_code is in the allowed responses for the request method. 5. validate that the response content validates against any provided sche...
python
def validate_response(response, request_method, schema): """ Response validation involves the following steps. 4. validate that the response status_code is in the allowed responses for the request method. 5. validate that the response content validates against any provided sche...
Response validation involves the following steps. 4. validate that the response status_code is in the allowed responses for the request method. 5. validate that the response content validates against any provided schemas for the responses. 6. headers, content-types, etc..., ???
https://github.com/pipermerriam/flex/blob/233f8149fb851a6255753bcec948cb6fefb2723b/flex/validation/response.py#L194-L248
pipermerriam/flex
flex/validation/schema.py
construct_schema_validators
def construct_schema_validators(schema, context): """ Given a schema object, construct a dictionary of validators needed to validate a response matching the given schema. Special Cases: - $ref: These validators need to be Lazily evaluating so that circular validation dep...
python
def construct_schema_validators(schema, context): """ Given a schema object, construct a dictionary of validators needed to validate a response matching the given schema. Special Cases: - $ref: These validators need to be Lazily evaluating so that circular validation dep...
Given a schema object, construct a dictionary of validators needed to validate a response matching the given schema. Special Cases: - $ref: These validators need to be Lazily evaluating so that circular validation dependencies do not result in an infinitely deep vali...
https://github.com/pipermerriam/flex/blob/233f8149fb851a6255753bcec948cb6fefb2723b/flex/validation/schema.py#L199-L236
pipermerriam/flex
flex/validation/common.py
validate_type
def validate_type(value, types, **kwargs): """ Validate that the value is one of the provided primative types. """ if not is_value_of_any_type(value, types): raise ValidationError(MESSAGES['type']['invalid'].format( repr(value), get_type_for_value(value), types, ))
python
def validate_type(value, types, **kwargs): """ Validate that the value is one of the provided primative types. """ if not is_value_of_any_type(value, types): raise ValidationError(MESSAGES['type']['invalid'].format( repr(value), get_type_for_value(value), types, ))
Validate that the value is one of the provided primative types.
https://github.com/pipermerriam/flex/blob/233f8149fb851a6255753bcec948cb6fefb2723b/flex/validation/common.py#L56-L63
pipermerriam/flex
flex/validation/common.py
generate_type_validator
def generate_type_validator(type_, **kwargs): """ Generates a callable validator for the given type or iterable of types. """ if is_non_string_iterable(type_): types = tuple(type_) else: types = (type_,) # support x-nullable since Swagger 2.0 doesn't support null type # (see ...
python
def generate_type_validator(type_, **kwargs): """ Generates a callable validator for the given type or iterable of types. """ if is_non_string_iterable(type_): types = tuple(type_) else: types = (type_,) # support x-nullable since Swagger 2.0 doesn't support null type # (see ...
Generates a callable validator for the given type or iterable of types.
https://github.com/pipermerriam/flex/blob/233f8149fb851a6255753bcec948cb6fefb2723b/flex/validation/common.py#L67-L79
pipermerriam/flex
flex/validation/common.py
validate_multiple_of
def validate_multiple_of(value, divisor, **kwargs): """ Given a value and a divisor, validate that the value is divisible by the divisor. """ if not decimal.Decimal(str(value)) % decimal.Decimal(str(divisor)) == 0: raise ValidationError( MESSAGES['multiple_of']['invalid'].format(...
python
def validate_multiple_of(value, divisor, **kwargs): """ Given a value and a divisor, validate that the value is divisible by the divisor. """ if not decimal.Decimal(str(value)) % decimal.Decimal(str(divisor)) == 0: raise ValidationError( MESSAGES['multiple_of']['invalid'].format(...
Given a value and a divisor, validate that the value is divisible by the divisor.
https://github.com/pipermerriam/flex/blob/233f8149fb851a6255753bcec948cb6fefb2723b/flex/validation/common.py#L103-L111
pipermerriam/flex
flex/validation/common.py
validate_minimum
def validate_minimum(value, minimum, is_exclusive, **kwargs): """ Validator function for validating that a value does not violate it's minimum allowed value. This validation can be inclusive, or exclusive of the minimum depending on the value of `is_exclusive`. """ if is_exclusive: comp...
python
def validate_minimum(value, minimum, is_exclusive, **kwargs): """ Validator function for validating that a value does not violate it's minimum allowed value. This validation can be inclusive, or exclusive of the minimum depending on the value of `is_exclusive`. """ if is_exclusive: comp...
Validator function for validating that a value does not violate it's minimum allowed value. This validation can be inclusive, or exclusive of the minimum depending on the value of `is_exclusive`.
https://github.com/pipermerriam/flex/blob/233f8149fb851a6255753bcec948cb6fefb2723b/flex/validation/common.py#L120-L136
pipermerriam/flex
flex/validation/common.py
generate_minimum_validator
def generate_minimum_validator(minimum, exclusiveMinimum=False, **kwargs): """ Generator function returning a callable for minimum value validation. """ return functools.partial(validate_minimum, minimum=minimum, is_exclusive=exclusiveMinimum)
python
def generate_minimum_validator(minimum, exclusiveMinimum=False, **kwargs): """ Generator function returning a callable for minimum value validation. """ return functools.partial(validate_minimum, minimum=minimum, is_exclusive=exclusiveMinimum)
Generator function returning a callable for minimum value validation.
https://github.com/pipermerriam/flex/blob/233f8149fb851a6255753bcec948cb6fefb2723b/flex/validation/common.py#L139-L143
pipermerriam/flex
flex/validation/common.py
validate_maximum
def validate_maximum(value, maximum, is_exclusive, **kwargs): """ Validator function for validating that a value does not violate it's maximum allowed value. This validation can be inclusive, or exclusive of the maximum depending on the value of `is_exclusive`. """ if is_exclusive: comp...
python
def validate_maximum(value, maximum, is_exclusive, **kwargs): """ Validator function for validating that a value does not violate it's maximum allowed value. This validation can be inclusive, or exclusive of the maximum depending on the value of `is_exclusive`. """ if is_exclusive: comp...
Validator function for validating that a value does not violate it's maximum allowed value. This validation can be inclusive, or exclusive of the maximum depending on the value of `is_exclusive`.
https://github.com/pipermerriam/flex/blob/233f8149fb851a6255753bcec948cb6fefb2723b/flex/validation/common.py#L148-L164
pipermerriam/flex
flex/validation/common.py
generate_maximum_validator
def generate_maximum_validator(maximum, exclusiveMaximum=False, **kwargs): """ Generator function returning a callable for maximum value validation. """ return functools.partial(validate_maximum, maximum=maximum, is_exclusive=exclusiveMaximum)
python
def generate_maximum_validator(maximum, exclusiveMaximum=False, **kwargs): """ Generator function returning a callable for maximum value validation. """ return functools.partial(validate_maximum, maximum=maximum, is_exclusive=exclusiveMaximum)
Generator function returning a callable for maximum value validation.
https://github.com/pipermerriam/flex/blob/233f8149fb851a6255753bcec948cb6fefb2723b/flex/validation/common.py#L167-L171
pipermerriam/flex
flex/validation/common.py
validate_min_items
def validate_min_items(value, minimum, **kwargs): """ Validator for ARRAY types to enforce a minimum number of items allowed for the ARRAY to be valid. """ if len(value) < minimum: raise ValidationError( MESSAGES['min_items']['invalid'].format( minimum, len(value)...
python
def validate_min_items(value, minimum, **kwargs): """ Validator for ARRAY types to enforce a minimum number of items allowed for the ARRAY to be valid. """ if len(value) < minimum: raise ValidationError( MESSAGES['min_items']['invalid'].format( minimum, len(value)...
Validator for ARRAY types to enforce a minimum number of items allowed for the ARRAY to be valid.
https://github.com/pipermerriam/flex/blob/233f8149fb851a6255753bcec948cb6fefb2723b/flex/validation/common.py#L204-L214
pipermerriam/flex
flex/validation/common.py
validate_max_items
def validate_max_items(value, maximum, **kwargs): """ Validator for ARRAY types to enforce a maximum number of items allowed for the ARRAY to be valid. """ if len(value) > maximum: raise ValidationError( MESSAGES['max_items']['invalid'].format( maximum, len(value)...
python
def validate_max_items(value, maximum, **kwargs): """ Validator for ARRAY types to enforce a maximum number of items allowed for the ARRAY to be valid. """ if len(value) > maximum: raise ValidationError( MESSAGES['max_items']['invalid'].format( maximum, len(value)...
Validator for ARRAY types to enforce a maximum number of items allowed for the ARRAY to be valid.
https://github.com/pipermerriam/flex/blob/233f8149fb851a6255753bcec948cb6fefb2723b/flex/validation/common.py#L226-L236
pipermerriam/flex
flex/validation/common.py
validate_unique_items
def validate_unique_items(value, **kwargs): """ Validator for ARRAY types to enforce that all array items must be unique. """ # we can't just look at the items themselves since 0 and False are treated # the same as dictionary keys, and objects aren't hashable. counter = collections.Counter(( ...
python
def validate_unique_items(value, **kwargs): """ Validator for ARRAY types to enforce that all array items must be unique. """ # we can't just look at the items themselves since 0 and False are treated # the same as dictionary keys, and objects aren't hashable. counter = collections.Counter(( ...
Validator for ARRAY types to enforce that all array items must be unique.
https://github.com/pipermerriam/flex/blob/233f8149fb851a6255753bcec948cb6fefb2723b/flex/validation/common.py#L248-L264
pipermerriam/flex
flex/validation/common.py
validate_object
def validate_object(obj, field_validators=None, non_field_validators=None, schema=None, context=None): """ Takes a mapping and applies a mapping of validator functions to it collecting and reraising any validation errors that occur. """ if schema is None: schema = {} ...
python
def validate_object(obj, field_validators=None, non_field_validators=None, schema=None, context=None): """ Takes a mapping and applies a mapping of validator functions to it collecting and reraising any validation errors that occur. """ if schema is None: schema = {} ...
Takes a mapping and applies a mapping of validator functions to it collecting and reraising any validation errors that occur.
https://github.com/pipermerriam/flex/blob/233f8149fb851a6255753bcec948cb6fefb2723b/flex/validation/common.py#L365-L398
pipermerriam/flex
flex/validation/common.py
generate_value_processor
def generate_value_processor(type_, collectionFormat=None, items=None, **kwargs): """ Create a callable that will take the string value of a header and cast it to the appropriate type. This can involve: - splitting a header of type 'array' by its delimeters. - type casting the internal elements of...
python
def generate_value_processor(type_, collectionFormat=None, items=None, **kwargs): """ Create a callable that will take the string value of a header and cast it to the appropriate type. This can involve: - splitting a header of type 'array' by its delimeters. - type casting the internal elements of...
Create a callable that will take the string value of a header and cast it to the appropriate type. This can involve: - splitting a header of type 'array' by its delimeters. - type casting the internal elements of the array.
https://github.com/pipermerriam/flex/blob/233f8149fb851a6255753bcec948cb6fefb2723b/flex/validation/common.py#L434-L495
pipermerriam/flex
flex/validation/common.py
validate_request_method_to_operation
def validate_request_method_to_operation(request_method, path_definition): """ Given a request method, validate that the request method is valid for the api path. If so, return the operation definition related to this request method. """ try: operation_definition = path_definition[reque...
python
def validate_request_method_to_operation(request_method, path_definition): """ Given a request method, validate that the request method is valid for the api path. If so, return the operation definition related to this request method. """ try: operation_definition = path_definition[reque...
Given a request method, validate that the request method is valid for the api path. If so, return the operation definition related to this request method.
https://github.com/pipermerriam/flex/blob/233f8149fb851a6255753bcec948cb6fefb2723b/flex/validation/common.py#L498-L514
pipermerriam/flex
flex/validation/common.py
validate_path_to_api_path
def validate_path_to_api_path(path, paths, basePath='', context=None, **kwargs): """ Given a path, find the api_path it matches. """ if context is None: context = {} try: api_path = match_path_to_api_path( path_definitions=paths, target_path=path, ...
python
def validate_path_to_api_path(path, paths, basePath='', context=None, **kwargs): """ Given a path, find the api_path it matches. """ if context is None: context = {} try: api_path = match_path_to_api_path( path_definitions=paths, target_path=path, ...
Given a path, find the api_path it matches.
https://github.com/pipermerriam/flex/blob/233f8149fb851a6255753bcec948cb6fefb2723b/flex/validation/common.py#L517-L535
pipermerriam/flex
flex/validation/parameter.py
validate_path_parameters
def validate_path_parameters(target_path, api_path, path_parameters, context): """ Helper function for validating a request path """ base_path = context.get('basePath', '') full_api_path = re.sub(NORMALIZE_SLASH_REGEX, '/', base_path + api_path) parameter_values = get_path_parameter_values( ...
python
def validate_path_parameters(target_path, api_path, path_parameters, context): """ Helper function for validating a request path """ base_path = context.get('basePath', '') full_api_path = re.sub(NORMALIZE_SLASH_REGEX, '/', base_path + api_path) parameter_values = get_path_parameter_values( ...
Helper function for validating a request path
https://github.com/pipermerriam/flex/blob/233f8149fb851a6255753bcec948cb6fefb2723b/flex/validation/parameter.py#L75-L84
pipermerriam/flex
flex/validation/parameter.py
construct_parameter_validators
def construct_parameter_validators(parameter, context): """ Constructs a dictionary of validator functions for the provided parameter definition. """ validators = ValidationDict() if '$ref' in parameter: validators.add_validator( '$ref', ParameterReferenceValidator(parameter[...
python
def construct_parameter_validators(parameter, context): """ Constructs a dictionary of validator functions for the provided parameter definition. """ validators = ValidationDict() if '$ref' in parameter: validators.add_validator( '$ref', ParameterReferenceValidator(parameter[...
Constructs a dictionary of validator functions for the provided parameter definition.
https://github.com/pipermerriam/flex/blob/233f8149fb851a6255753bcec948cb6fefb2723b/flex/validation/parameter.py#L109-L129
pipermerriam/flex
flex/validation/parameter.py
construct_multi_parameter_validators
def construct_multi_parameter_validators(parameters, context): """ Given an iterable of parameters, returns a dictionary of validator functions for each parameter. Note that this expects the parameters to be unique in their name value, and throws an error if this is not the case. """ validators...
python
def construct_multi_parameter_validators(parameters, context): """ Given an iterable of parameters, returns a dictionary of validator functions for each parameter. Note that this expects the parameters to be unique in their name value, and throws an error if this is not the case. """ validators...
Given an iterable of parameters, returns a dictionary of validator functions for each parameter. Note that this expects the parameters to be unique in their name value, and throws an error if this is not the case.
https://github.com/pipermerriam/flex/blob/233f8149fb851a6255753bcec948cb6fefb2723b/flex/validation/parameter.py#L150-L167
pipermerriam/flex
flex/validation/path.py
generate_path_parameters_validator
def generate_path_parameters_validator(api_path, path_parameters, context): """ Generates a validator function that given a path, validates that it against the path parameters """ path_parameter_validator = functools.partial( validate_path_parameters, api_path=api_path, path_...
python
def generate_path_parameters_validator(api_path, path_parameters, context): """ Generates a validator function that given a path, validates that it against the path parameters """ path_parameter_validator = functools.partial( validate_path_parameters, api_path=api_path, path_...
Generates a validator function that given a path, validates that it against the path parameters
https://github.com/pipermerriam/flex/blob/233f8149fb851a6255753bcec948cb6fefb2723b/flex/validation/path.py#L8-L19
pipermerriam/flex
flex/paths.py
escape_regex_special_chars
def escape_regex_special_chars(api_path): """ Turns the non prametrized path components into strings subtable for using as a regex pattern. This primarily involves escaping special characters so that the actual character is matched in the regex. """ def substitute(string, replacements): ...
python
def escape_regex_special_chars(api_path): """ Turns the non prametrized path components into strings subtable for using as a regex pattern. This primarily involves escaping special characters so that the actual character is matched in the regex. """ def substitute(string, replacements): ...
Turns the non prametrized path components into strings subtable for using as a regex pattern. This primarily involves escaping special characters so that the actual character is matched in the regex.
https://github.com/pipermerriam/flex/blob/233f8149fb851a6255753bcec948cb6fefb2723b/flex/paths.py#L26-L36
pipermerriam/flex
flex/paths.py
construct_parameter_pattern
def construct_parameter_pattern(parameter): """ Given a parameter definition returns a regex pattern that will match that part of the path. """ name = parameter['name'] type = parameter['type'] repeated = '[^/]' if type == 'integer': repeated = '\d' return "(?P<{name}>{rep...
python
def construct_parameter_pattern(parameter): """ Given a parameter definition returns a regex pattern that will match that part of the path. """ name = parameter['name'] type = parameter['type'] repeated = '[^/]' if type == 'integer': repeated = '\d' return "(?P<{name}>{rep...
Given a parameter definition returns a regex pattern that will match that part of the path.
https://github.com/pipermerriam/flex/blob/233f8149fb851a6255753bcec948cb6fefb2723b/flex/paths.py#L44-L57
pipermerriam/flex
flex/paths.py
process_path_part
def process_path_part(part, parameters): """ Given a part of a path either: - If it is a parameter: parse it to a regex group - Otherwise: escape any special regex characters """ if PARAMETER_REGEX.match(part): parameter_name = part.strip('{}') try...
python
def process_path_part(part, parameters): """ Given a part of a path either: - If it is a parameter: parse it to a regex group - Otherwise: escape any special regex characters """ if PARAMETER_REGEX.match(part): parameter_name = part.strip('{}') try...
Given a part of a path either: - If it is a parameter: parse it to a regex group - Otherwise: escape any special regex characters
https://github.com/pipermerriam/flex/blob/233f8149fb851a6255753bcec948cb6fefb2723b/flex/paths.py#L60-L80
pipermerriam/flex
flex/paths.py
path_to_pattern
def path_to_pattern(api_path, parameters): """ Given an api path, possibly with parameter notation, return a pattern suitable for turing into a regular expression which will match request paths that conform to the parameter definitions and the api path. """ parts = re.split(PARAMETER_REGEX, api_...
python
def path_to_pattern(api_path, parameters): """ Given an api path, possibly with parameter notation, return a pattern suitable for turing into a regular expression which will match request paths that conform to the parameter definitions and the api path. """ parts = re.split(PARAMETER_REGEX, api_...
Given an api path, possibly with parameter notation, return a pattern suitable for turing into a regular expression which will match request paths that conform to the parameter definitions and the api path.
https://github.com/pipermerriam/flex/blob/233f8149fb851a6255753bcec948cb6fefb2723b/flex/paths.py#L87-L101
pipermerriam/flex
flex/paths.py
match_path_to_api_path
def match_path_to_api_path(path_definitions, target_path, base_path='', context=None): """ Match a request or response path to one of the api paths. Anything other than exactly one match is an error condition. """ if context is None: context = {} assert isinst...
python
def match_path_to_api_path(path_definitions, target_path, base_path='', context=None): """ Match a request or response path to one of the api paths. Anything other than exactly one match is an error condition. """ if context is None: context = {} assert isinst...
Match a request or response path to one of the api paths. Anything other than exactly one match is an error condition.
https://github.com/pipermerriam/flex/blob/233f8149fb851a6255753bcec948cb6fefb2723b/flex/paths.py#L140-L209
pipermerriam/flex
flex/validation/request.py
validate_request
def validate_request(request, schema): """ Request validation does the following steps. 1. validate that the path matches one of the defined paths in the schema. 2. validate that the request method conforms to a supported methods for the given path. 3. validate that the request parameters ...
python
def validate_request(request, schema): """ Request validation does the following steps. 1. validate that the path matches one of the defined paths in the schema. 2. validate that the request method conforms to a supported methods for the given path. 3. validate that the request parameters ...
Request validation does the following steps. 1. validate that the path matches one of the defined paths in the schema. 2. validate that the request method conforms to a supported methods for the given path. 3. validate that the request parameters conform to the parameter definitions for ...
https://github.com/pipermerriam/flex/blob/233f8149fb851a6255753bcec948cb6fefb2723b/flex/validation/request.py#L13-L65
pipermerriam/flex
flex/http.py
normalize_request
def normalize_request(request): """ Given a request, normalize it to the internal Request class. """ if isinstance(request, Request): return request for normalizer in REQUEST_NORMALIZERS: try: return normalizer(request) except TypeError: continue ...
python
def normalize_request(request): """ Given a request, normalize it to the internal Request class. """ if isinstance(request, Request): return request for normalizer in REQUEST_NORMALIZERS: try: return normalizer(request) except TypeError: continue ...
Given a request, normalize it to the internal Request class.
https://github.com/pipermerriam/flex/blob/233f8149fb851a6255753bcec948cb6fefb2723b/flex/http.py#L279-L292
pipermerriam/flex
flex/http.py
normalize_response
def normalize_response(response, request=None): """ Given a response, normalize it to the internal Response class. This also involves normalizing the associated request object. """ if isinstance(response, Response): return response if request is not None and not isinstance(request, Requ...
python
def normalize_response(response, request=None): """ Given a response, normalize it to the internal Response class. This also involves normalizing the associated request object. """ if isinstance(response, Response): return response if request is not None and not isinstance(request, Requ...
Given a response, normalize it to the internal Response class. This also involves normalizing the associated request object.
https://github.com/pipermerriam/flex/blob/233f8149fb851a6255753bcec948cb6fefb2723b/flex/http.py#L474-L490
pipermerriam/flex
flex/http.py
Request.data
def data(self): """ TODO: What is the right way to do this? """ if not self.body: return self.body elif self.body is EMPTY: return EMPTY elif self.content_type and self.content_type.startswith('application/json'): try: i...
python
def data(self): """ TODO: What is the right way to do this? """ if not self.body: return self.body elif self.body is EMPTY: return EMPTY elif self.content_type and self.content_type.startswith('application/json'): try: i...
TODO: What is the right way to do this?
https://github.com/pipermerriam/flex/blob/233f8149fb851a6255753bcec948cb6fefb2723b/flex/http.py#L93-L115