source: TI12-security/trunk/NDG_XACML/ndg/xacml/core/functions/v1/anyuri_equal.py @ 6793

Subversion URL: http://proj.badc.rl.ac.uk/svn/ndg/TI12-security/trunk/NDG_XACML/ndg/xacml/core/functions/v1/anyuri_equal.py@6793
Revision 6793, 1.2 KB checked in by pjkersha, 10 years ago (diff)
RevLine 
[6782]1"""NDG XACML URI equal matching function module
2
3NERC DataGrid Project
4"""
5__author__ = "P J Kershaw"
6__date__ = "26/03/10"
7__copyright__ = ""
8__license__ = "BSD - see LICENSE file in top-level directory"
9__contact__ = "Philip.Kershaw@stfc.ac.uk"
10__revision__ = '$Id: $'
11from ndg.xacml.core.functions import AbstractFunction
12
13
[6790]14class AnyURIEqual(AbstractFunction):
[6782]15    """Any URI equal matching function -
16   
17    urn:oasis:names:tc:xacml:1.0:function:anyURI-equal
18    """
19    FUNCTION_NS = 'urn:oasis:names:tc:xacml:1.0:function:anyURI-equal'
20   
21    def evaluate(self, uri1, uri2):
22        """Match input URIs
23       
24        @param uri1: first of two URIs to match
25        @type uri1: basestring
26        @param uri2: second URI
27        @type uri2: basestring
28        @return: True if URIs match, False otherwise
29        @rtype: bool
30        """
31        if not isinstance(uri1, basestring):
32            raise TypeError('Expecting %r derived type for "uri1"; got %r' %
33                            (basestring, type(uri1)))
34           
35        if not isinstance(uri2, basestring):
36            raise TypeError('Expecting %r derived type for "uri2"; got %r' %
37                            (basestring, type(uri2)))
38           
39        return uri1 == uri2
40
Note: See TracBrowser for help on using the repository browser.