Esempio n. 1
0
    def get_methods(self, include_default=False, available_only=False):

        methods = ["read", "create", "update", "delete"]
        if available_only: 
            methods = [
                m for m in methods 
                if get_http_name(m) in self.handler.allowed_methods
            ]

        for method in methods:
            met = getattr(self.handler, method, None)

            if not met:
                continue
                
            stale = inspect.getmodule(met.im_func) is not inspect.getmodule(self.handler)

            if not self.handler.is_anonymous:
                if met and (not stale or include_default):
                    yield HandlerMethod(met, stale)
            else:
                if not stale or met.__name__ == "read" \
                    and 'GET' in self.allowed_methods:
                    
                    yield HandlerMethod(met, stale)
Esempio n. 2
0
 def http_name(self):
     return get_http_name(self.name)