pynetdicom.utils.validate_ae_title¶
-
pynetdicom.utils.
validate_ae_title
(ae_title, use_short=False)[source]¶ Return a valid AE title from ae_title, if possible.
An AE title:
Must be no more than 16 characters
Leading and trailing spaces are not significant
The characters should belong to the Default Character Repertoire excluding
0x5C
(backslash) and all control characters
If the supplied ae_title is greater than 16 characters once non-significant spaces have been removed then the returned AE title will be truncated to remove the excess characters.
If the supplied ae_title is less than 16 characters once non-significant spaces have been removed, the spare trailing characters will be set to space (
0x20
) provided use_short isFalse
.Changed in version 1.1: Changed to only return
bytes
for Python 3.Changed in version 1.5: Added use_short keyword parameter.
- Parameters
- Returns
A valid AE title truncated to 16 characters if necessary. If Python 3 then only returns
bytes
, if Python 2 then returnsstr
.- Return type
- Raises
ValueError – If ae_title is an empty string, contains only spaces or contains control characters or backslash.