Пример #1
0
 def _lookup(self, sub_resource, *remainder):
     if sub_resource == 'acl':
         return acls.SecretACLsController(self.secret), remainder
     elif sub_resource == 'metadata':
         if len(remainder) == 0 or remainder == ('', ):
             return secretmeta.SecretMetadataController(self.secret), \
                 remainder
         else:
             return secretmeta.SecretMetadatumController(self.secret), \
                 remainder
     else:
         # only 'acl' and 'metadata' as sub-resource is supported
         pecan.abort(405)
Пример #2
0
    def _lookup(self, sub_resource, *remainder):
        if sub_resource == 'acl':
            return acls.SecretACLsController(self.secret), remainder
        elif sub_resource == 'metadata':
            if len(remainder) == 0 or remainder == ('', ):
                return secretmeta.SecretMetadataController(self.secret), \
                    remainder
            else:
                request_method = pecan.request.method
                allowed_methods = ['GET', 'PUT', 'DELETE']

                if request_method in allowed_methods:
                    return secretmeta.SecretMetadatumController(self.secret), \
                        remainder
                else:
                    # methods cannot be handled at controller level
                    pecan.abort(405)
        else:
            # only 'acl' and 'metadata' as sub-resource is supported
            pecan.abort(404)