Example #1
0
 def test_inheritedMethod(self):
     """
     L{prefixedMethodNames} returns a list included methods with the given
     prefix defined on base classes of the class passed to it.
     """
     class Child(Separate):
         pass
     self.assertEqual(["method"], prefixedMethodNames(Child, "good_"))
Example #2
0
    def test_inheritedMethod(self):
        """
        L{prefixedMethodNames} returns a list included methods with the given
        prefix defined on base classes of the class passed to it.
        """
        class Child(Separate):
            pass

        self.assertEqual(["method"], prefixedMethodNames(Child, "good_"))
Example #3
0
def _computeAllowedMethods(resource):
    """
    Compute the allowed methods on a C{Resource} based on defined render_FOO
    methods. Used when raising C{UnsupportedMethod} but C{Resource} does
    not define C{allowedMethods} attribute.
    """
    allowedMethods = []
    for name in prefixedMethodNames(resource.__class__, "render_"):
        # Potentially there should be an API for encode('ascii') in this
        # situation - an API for taking a Python native string (bytes on Python
        # 2, text on Python 3) and returning a socket-compatible string type.
        allowedMethods.append(name.encode('ascii'))
    return allowedMethods
Example #4
0
def _computeAllowedMethods(resource):
    """
    Compute the allowed methods on a C{Resource} based on defined render_FOO
    methods. Used when raising C{UnsupportedMethod} but C{Resource} does
    not define C{allowedMethods} attribute.
    """
    allowedMethods = []
    for name in prefixedMethodNames(resource.__class__, "render_"):
        # Potentially there should be an API for encode('ascii') in this
        # situation - an API for taking a Python native string (bytes on Python
        # 2, text on Python 3) and returning a socket-compatible string type.
        allowedMethods.append(name.encode('ascii'))
    return allowedMethods
Example #5
0
 def test_method(self):
     """
     L{prefixedMethodNames} returns a list including methods with the given
     prefix defined on the class passed to it.
     """
     self.assertEqual(["method"], prefixedMethodNames(Separate, "good_"))
Example #6
0
 def test_method(self):
     """
     L{prefixedMethodNames} returns a list including methods with the given
     prefix defined on the class passed to it.
     """
     self.assertEqual(["method"], prefixedMethodNames(Separate, "good_"))