Beispiel #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)
Beispiel #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)
Beispiel #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)
Beispiel #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)
Beispiel #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)
Beispiel #6
0
 def get(self, query_id):
     return dropdown_values(query_id)
Beispiel #7
0
 def get(self, query_id):
     return dropdown_values(query_id)
 def test_dropdown_supports_upper_cased_columns(self, _):
     values = dropdown_values(1)
     self.assertEquals(values, [{"name": 5, "value": "5"}])
 def test_dropdown_values_compromises_for_first_column(self, _):
     values = dropdown_values(1)
     self.assertEquals(values, [{"name": 5, "value": "5"}])
 def test_dropdown_values_prefers_name_and_value_columns(self, _):
     values = dropdown_values(1)
     self.assertEquals(values, [{"name": "John", "value": "John Doe"}])
Beispiel #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)
Beispiel #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)
Beispiel #13
0
 def test_dropdown_values_raises_when_query_is_detached_from_data_source(self, _):
     with pytest.raises(QueryDetachedFromDataSourceError):
         dropdown_values(1, None)
 def test_dropdown_supports_upper_cased_columns(self, _):
     values = dropdown_values(1)
     self.assertEquals(values, [{"name": 5, "value": "5"}])
 def test_dropdown_values_compromises_for_first_column(self, _):
     values = dropdown_values(1)
     self.assertEquals(values, [{"name": 5, "value": "5"}])
 def test_dropdown_values_prefers_name_and_value_columns(self, _):
     values = dropdown_values(1)
     self.assertEquals(values, [{"name": "John", "value": "John Doe"}])