Пример #1
0
 def get(self, query_id):
     query = get_object_or_404(models.Query.get_by_id_and_org, query_id, self.current_org)
     require_access(query.data_source, current_user, view_only)
     try:
         return dropdown_values(query_id, self.current_org)
     except QueryDetachedFromDataSourceError as e:
         abort(400, message=e.message)
Пример #2
0
    def get(self, query_id, dropdown_query_id):
        query = get_object_or_404(models.Query.get_by_id_and_org, query_id, self.current_org)

        related_queries_ids = [p['queryId'] for p in query.parameters if p['type'] == 'query']
        if int(dropdown_query_id) not in related_queries_ids:
            abort(403)

        return dropdown_values(dropdown_query_id, should_require_access=False)
Пример #3
0
    def get(self, query_id, dropdown_query_id):
        query = get_object_or_404(models.Query.get_by_id_and_org, query_id, self.current_org)

        related_queries_ids = [p['queryId'] for p in query.parameters if p['type'] == 'query']
        if int(dropdown_query_id) not in related_queries_ids:
            abort(403)

        return dropdown_values(dropdown_query_id, should_require_access=False)
Пример #4
0
    def get(self, query_id, dropdown_query_id):
        query = get_object_or_404(models.Query.get_by_id_and_org, query_id, self.current_org)
        require_access(query, current_user, view_only)

        related_queries_ids = [p['queryId'] for p in query.parameters if p['type'] == 'query']
        if int(dropdown_query_id) not in related_queries_ids:
            dropdown_query = get_object_or_404(models.Query.get_by_id_and_org, dropdown_query_id, self.current_org)
            require_access(dropdown_query.data_source, current_user, view_only)

        return dropdown_values(dropdown_query_id, self.current_org)
Пример #5
0
    def get(self, query_id, dropdown_query_id):
        query = get_object_or_404(models.Query.get_by_id_and_org, query_id, self.current_org)
        require_access(query, current_user, view_only)

        related_queries_ids = [p['queryId'] for p in query.parameters if p['type'] == 'query']
        if int(dropdown_query_id) not in related_queries_ids:
            dropdown_query = get_object_or_404(models.Query.get_by_id_and_org, dropdown_query_id, self.current_org)
            require_access(dropdown_query.data_source, current_user, view_only)

        return dropdown_values(dropdown_query_id)
Пример #6
0
 def get(self, query_id):
     return dropdown_values(query_id)
Пример #7
0
 def get(self, query_id):
     return dropdown_values(query_id)
Пример #8
0
 def test_dropdown_supports_upper_cased_columns(self, _):
     values = dropdown_values(1)
     self.assertEquals(values, [{"name": 5, "value": "5"}])
Пример #9
0
 def test_dropdown_values_compromises_for_first_column(self, _):
     values = dropdown_values(1)
     self.assertEquals(values, [{"name": 5, "value": "5"}])
Пример #10
0
 def test_dropdown_values_prefers_name_and_value_columns(self, _):
     values = dropdown_values(1)
     self.assertEquals(values, [{"name": "John", "value": "John Doe"}])
Пример #11
0
 def get(self, query_id):
     query = get_object_or_404(models.Query.get_by_id_and_org, query_id, self.current_org)
     require_access(query.data_source, current_user, view_only)
     return dropdown_values(query_id)
Пример #12
0
 def get(self, query_id):
     query = get_object_or_404(models.Query.get_by_id_and_org, query_id, self.current_org)
     require_access(query.data_source, current_user, view_only)
     return dropdown_values(query_id)
Пример #13
0
 def test_dropdown_values_raises_when_query_is_detached_from_data_source(self, _):
     with pytest.raises(QueryDetachedFromDataSourceError):
         dropdown_values(1, None)
Пример #14
0
 def test_dropdown_supports_upper_cased_columns(self, _):
     values = dropdown_values(1)
     self.assertEquals(values, [{"name": 5, "value": "5"}])
Пример #15
0
 def test_dropdown_values_compromises_for_first_column(self, _):
     values = dropdown_values(1)
     self.assertEquals(values, [{"name": 5, "value": "5"}])
Пример #16
0
 def test_dropdown_values_prefers_name_and_value_columns(self, _):
     values = dropdown_values(1)
     self.assertEquals(values, [{"name": "John", "value": "John Doe"}])