rt 3.1.4__tar.gz → 3.2.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (39) hide show
  1. {rt-3.1.4 → rt-3.2.0}/CHANGELOG.md +4 -0
  2. {rt-3.1.4 → rt-3.2.0}/PKG-INFO +1 -1
  3. {rt-3.1.4 → rt-3.2.0}/doc/changelog.rst +12 -0
  4. {rt-3.1.4 → rt-3.2.0}/rt/rest2.py +10 -4
  5. {rt-3.1.4 → rt-3.2.0}/rt.egg-info/PKG-INFO +1 -1
  6. {rt-3.1.4 → rt-3.2.0}/tests/test_basic.py +7 -0
  7. {rt-3.1.4 → rt-3.2.0}/tests/test_basic_async.py +7 -0
  8. {rt-3.1.4 → rt-3.2.0}/.codespell_ignore +0 -0
  9. {rt-3.1.4 → rt-3.2.0}/.editorconfig +0 -0
  10. {rt-3.1.4 → rt-3.2.0}/AUTHORS +0 -0
  11. {rt-3.1.4 → rt-3.2.0}/LICENSE +0 -0
  12. {rt-3.1.4 → rt-3.2.0}/MANIFEST.in +0 -0
  13. {rt-3.1.4 → rt-3.2.0}/README.rst +0 -0
  14. {rt-3.1.4 → rt-3.2.0}/doc/Makefile +0 -0
  15. {rt-3.1.4 → rt-3.2.0}/doc/conf.py +0 -0
  16. {rt-3.1.4 → rt-3.2.0}/doc/exceptions.rst +0 -0
  17. {rt-3.1.4 → rt-3.2.0}/doc/glossary.rst +0 -0
  18. {rt-3.1.4 → rt-3.2.0}/doc/index.rst +0 -0
  19. {rt-3.1.4 → rt-3.2.0}/doc/rest1.rst +0 -0
  20. {rt-3.1.4 → rt-3.2.0}/doc/rest2.rst +0 -0
  21. {rt-3.1.4 → rt-3.2.0}/doc/usage.rst +0 -0
  22. {rt-3.1.4 → rt-3.2.0}/noxfile.py +0 -0
  23. {rt-3.1.4 → rt-3.2.0}/pyproject.toml +0 -0
  24. {rt-3.1.4 → rt-3.2.0}/rt/__init__.py +0 -0
  25. {rt-3.1.4 → rt-3.2.0}/rt/exceptions.py +0 -0
  26. {rt-3.1.4 → rt-3.2.0}/rt/py.typed +0 -0
  27. {rt-3.1.4 → rt-3.2.0}/rt/rest1.py +0 -0
  28. {rt-3.1.4 → rt-3.2.0}/rt.egg-info/SOURCES.txt +0 -0
  29. {rt-3.1.4 → rt-3.2.0}/rt.egg-info/dependency_links.txt +0 -0
  30. {rt-3.1.4 → rt-3.2.0}/rt.egg-info/requires.txt +0 -0
  31. {rt-3.1.4 → rt-3.2.0}/rt.egg-info/top_level.txt +0 -0
  32. {rt-3.1.4 → rt-3.2.0}/run_nox.sh +0 -0
  33. {rt-3.1.4 → rt-3.2.0}/setup.cfg +0 -0
  34. {rt-3.1.4 → rt-3.2.0}/setup.py +0 -0
  35. {rt-3.1.4 → rt-3.2.0}/tests/__init__.py +0 -0
  36. {rt-3.1.4 → rt-3.2.0}/tests/conftest.py +0 -0
  37. {rt-3.1.4 → rt-3.2.0}/tests/test_rest1.py +0 -0
  38. {rt-3.1.4 → rt-3.2.0}/tests/test_tickets.py +0 -0
  39. {rt-3.1.4 → rt-3.2.0}/tests/test_tickets_async.py +0 -0
@@ -3,6 +3,10 @@ All notable changes to this project will be documented in this file.
3
3
 
4
4
  This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
5
5
 
6
+ ## [v3.2.0], 2024-09-06
7
+ ## Added
8
+ - Added option for custom list of fields to be populated for search "query_format" param to avoid unnecessary round trips to get fields like Told, Starts, Resolved, etc by returning the required fields during search. (see #97 @nerdfirefighter)
9
+
6
10
  ## [v3.1.4], 2024-02-16
7
11
  ### Fixes
8
12
  - Add a workaround for a breaking change introduced in RT5.0.5 which returns undefined pages variable for non-superusers (see #93 #94).
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: rt
3
- Version: 3.1.4
3
+ Version: 3.2.0
4
4
  Summary: Python interface to Request Tracker API
5
5
  Author-email: Georges Toth <georges.toth@govcert.etat.lu>
6
6
  License: GNU General Public License v3 (GPLv3)
@@ -1,6 +1,18 @@
1
1
  Change Log
2
2
  ==========
3
3
 
4
+ Version 3.2.0 (2024-09-06)
5
+ ----------------------------
6
+ Added
7
+ ^^^^^
8
+ - Added option for custom list of fields to be populated for search "query_format" param to avoid unnecessary round trips to get fields like Told, Starts, Resolved, etc by returning the required fields during search. (see #97 @nerdfirefighter)
9
+
10
+ Version 3.1.4 (2024-02-16)
11
+ ----------------------------
12
+ Fixes
13
+ ^^^^^
14
+ - Add a workaround for a breaking change introduced in RT5.0.5 which returns undefined pages variable for non-superusers (see #93 #94).
15
+
4
16
  Version 3.1.3 (2023-10-10)
5
17
  ----------------------------
6
18
  Fixes
@@ -445,7 +445,7 @@ class Rt:
445
445
  queue: typing.Optional[typing.Union[str, object]] = None,
446
446
  order: typing.Optional[str] = None,
447
447
  raw_query: typing.Optional[str] = None,
448
- query_format: str = 'l',
448
+ query_format: typing.Union[str, typing.List[str]] = 'l',
449
449
  **kwargs: typing.Any,
450
450
  ) -> typing.Iterator[dict]:
451
451
  r"""Search arbitrary needles in given fields and queue.
@@ -472,6 +472,7 @@ class Rt:
472
472
  - i: only *id* fields are populated
473
473
  - s: only *id* and *subject* fields are populated
474
474
  - l: multi-line format, all fields are populated
475
+ - [field1, field2]: list of fields to be populated
475
476
  :param kwargs: Other arguments possible to set if not passing raw_query:
476
477
 
477
478
  Requestors, Subject, Cc, AdminCc, Owner, Status,
@@ -536,7 +537,9 @@ class Rt:
536
537
  else:
537
538
  get_params['orderby'] = order
538
539
 
539
- if query_format == 'l':
540
+ if isinstance(query_format, list):
541
+ get_params['fields'] = ','.join(query_format)
542
+ elif query_format == 'l':
540
543
  get_params[
541
544
  'fields'
542
545
  ] = 'Owner,Status,Created,Subject,Queue,CustomFields,Requestor,Cc,AdminCc,Started,Created,TimeEstimated,Due,Type,InitialPriority,Priority,TimeLeft,LastUpdated'
@@ -1937,7 +1940,7 @@ class AsyncRt:
1937
1940
  queue: typing.Optional[typing.Union[str, object]] = None,
1938
1941
  order: typing.Optional[str] = None,
1939
1942
  raw_query: typing.Optional[str] = None,
1940
- query_format: str = 'l',
1943
+ query_format: typing.Union[str, typing.List[str]] = 'l',
1941
1944
  **kwargs: typing.Any,
1942
1945
  ) -> collections.abc.AsyncIterator:
1943
1946
  r"""Search arbitrary needles in given fields and queue.
@@ -1964,6 +1967,7 @@ class AsyncRt:
1964
1967
  - i: only *id* fields are populated
1965
1968
  - s: only *id* and *subject* fields are populated
1966
1969
  - l: multi-line format, all fields are populated
1970
+ - [field1, field2]: list of fields to be populated
1967
1971
  :param kwargs: Other arguments possible to set if not passing raw_query:
1968
1972
 
1969
1973
  Requestors, Subject, Cc, AdminCc, Owner, Status,
@@ -2029,7 +2033,9 @@ class AsyncRt:
2029
2033
  else:
2030
2034
  get_params['orderby'] = order
2031
2035
 
2032
- if query_format == 'l':
2036
+ if isinstance(query_format, list):
2037
+ get_params['fields'] = ','.join(query_format)
2038
+ elif query_format == 'l':
2033
2039
  get_params[
2034
2040
  'fields'
2035
2041
  ] = 'Owner,Status,Created,Subject,Queue,CustomFields,Requestor,Cc,AdminCc,Started,Created,TimeEstimated,Due,Type,InitialPriority,Priority,TimeLeft,LastUpdated'
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: rt
3
- Version: 3.1.4
3
+ Version: 3.2.0
4
4
  Summary: Python interface to Request Tracker API
5
5
  Author-email: Georges Toth <georges.toth@govcert.etat.lu>
6
6
  License: GNU General Public License v3 (GPLv3)
@@ -75,6 +75,13 @@ def test_ticket_operations(rt_connection: rt.rest2.Rt):
75
75
  assert search_result[0]['id'] == str(ticket_id)
76
76
  assert search_result[0]['Status'] == 'new'
77
77
 
78
+ # search with query_format field list
79
+ search_result = list(rt_connection.search(Subject=ticket_subject, query_format=['Status','Subject']))
80
+ assert len(search_result) == 1
81
+ assert search_result[0]['Subject'] == str(ticket_subject)
82
+ assert search_result[0]['Status'] == 'new'
83
+ assert 'Requestor' not in search_result[0].keys()
84
+
78
85
  # raw search
79
86
  search_result = list(rt_connection.search(raw_query=f'Subject="{ticket_subject}"'))
80
87
  assert len(search_result) == 1
@@ -78,6 +78,13 @@ async def test_ticket_operations(async_rt_connection: rt.rest2.AsyncRt):
78
78
  assert search_result[0]['id'] == str(ticket_id)
79
79
  assert search_result[0]['Status'] == 'new'
80
80
 
81
+ # search with query_format field list
82
+ search_result = [item async for item in async_rt_connection.search(Subject=ticket_subject, query_format=['Status','Subject'])]
83
+ assert len(search_result) == 1
84
+ assert search_result[0]['Subject'] == str(ticket_subject)
85
+ assert search_result[0]['Status'] == 'new'
86
+ assert 'Requestor' not in search_result[0].keys()
87
+
81
88
  # raw search
82
89
  search_result = [item async for item in async_rt_connection.search(raw_query=f'Subject="{ticket_subject}"')]
83
90
  assert len(search_result) == 1
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes