Ejemplo n.º 1
0
    def __init__(self, username, password, serializer=None):
        self.serializer = serializer
        self.username = username
        self.password = password

        if not self.serializer:
            self.serializer = LimsSerializer()

        super(ApiClient, self).__init__(enforce_csrf_checks=False,
                                        SERVER_NAME='localhost')
Ejemplo n.º 2
0
 class Meta:
     queryset = Reaction.objects.all() #.order_by('facility_id')
     authentication = MultiAuthentication(BasicAuthentication(), 
                                          SessionAuthentication())
     always_return_data = True
     authorization= SuperUserAuthorization()        
     resource_name = 'reaction'
     
     ordering = []
     filtering = {}
     serializer = LimsSerializer()
Ejemplo n.º 3
0
 class Meta:
     queryset = ExpressionHost.objects.all()
     authentication = MultiAuthentication(BasicAuthentication(), 
                                          SessionAuthentication())
     authorization= SuperUserAuthorization()        
     resource_name = 'expressionhost'
     
     always_return_data = True
     ordering = []
     filtering = {}
     serializer = LimsSerializer()
Ejemplo n.º 4
0
    class Meta:
        queryset = SmallMolecule.objects.all() #.order_by('facility_id')
        authentication = MultiAuthentication(BasicAuthentication(), 
                                             SessionAuthentication())
        authorization= SuperUserAuthorization()        
        resource_name = 'smallmolecule'
        
        # NOTE: in order to patch_list, wherein 'resource_uri' is not set, 
        # the method 'put' is required.  TODO: figure out better allowed methods
#         allowed_methods = ['get', 'patch', 'delete', 'put', 'post']
#         list_allowed_methods = ['get','patch','put','delete']
        
        always_return_data = True
        ordering = []
        filtering = {}
        serializer = LimsSerializer()
Ejemplo n.º 5
0
    def top_level(self, request, api_name=None):
        '''
        A view that returns a serialized list of all resources registers
        to the API.
        '''
        fullschema = parse_val(request.GET.get('fullschema', False),
                               'fullschema', 'boolean')

        available_resources = {}

        if api_name is None:
            api_name = self.api_name

        for name, resource in self._registry.items():
            if not fullschema:
                schema = self._build_reverse_url('api_get_schema',
                                                 kwargs={
                                                     'api_name': api_name,
                                                     'resource_name': name,
                                                 })
            else:
                schema = resource.build_schema()

            available_resources[name] = {
                'list_endpoint':
                self._build_reverse_url('api_dispatch_list',
                                        kwargs={
                                            'api_name': api_name,
                                            'resource_name': name,
                                        }),
                'schema':
                schema,
            }

        serializer = LimsSerializer()
        content_type = serializer.get_accept_content_type(request)
        serialized = serializer.serialize(available_resources, content_type)
        return HttpResponse(content=serialized, content_type=content_type)