Closed DylanWhite2 closed 5 years ago
Hi Dylan.
I think it would be odd that '5' isn't found as this should correspond to 'Complete' I wonder if you get the same result with a string:
at.picklist['Ticket']['Status'].reverse_lookup('5')
I'm still having a problem with this issue in the latest version. As noted, using a string lookup works, but documentation indicates an integer will work. Example:
>>> # Does not work
>>> at.picklist['Ticket']['Status'].reverse_lookup(1)
>>> # This does work
>>> at.picklist['Ticket']['Status'].reverse_lookup('1')
The root of the problem surrounds the types that are returned from a Ticket query versus the pick list type. Example:
>>> type(at.picklist['Ticket']['Status']['New'])
<class 'suds.sax.text.Text'>
>>> type(ticket)
<class 'suds.sudsobject.Ticket'>
>>> type(ticket.Status)
<class 'int'>
I put in a temporary workaround for my codebase on reverse_lookup by casting "value" to a string, but this may not be ideal and they are actually integers (but seems to work for now):
def reverse_lookup(self, value, condition=is_active):
''' take a field_name_id and return the label '''
label = get_value_label(str(value), self._picklist, condition=condition)
return label
I'm okay with that.. and me a pull request.
On Wed, 4 Dec 2019, 9:29 AM Matthew Ingersoll, notifications@github.com wrote:
I'm still having a problem with this issue in the latest version. As noted, using a string lookup works, but documentation indicates an integer will work. Example:
Does not work
at.picklist['Ticket']['Status'].reverse_lookup(1)
This does work
at.picklist['Ticket']['Status'].reverse_lookup('1')
The root of the problem surrounds the types that are returned from a Ticket query versus the pick list type. Example:
type(at.picklist['Ticket']['Status']['New']) <class 'suds.sax.text.Text'>
type(ticket) <class 'suds.sudsobject.Ticket'> type(ticket.Status) <class 'int'>
I put in a temporary workaround for my codebase on reverse_lookup by casting "value" to a string, but this may not be ideal and they are actually integers (but seems to work for now):
def reverse_lookup(self, value, condition=is_active): ''' take a field_name_id and return the label ''' label = get_value_label(str(value), self._picklist, condition=condition) return label
— You are receiving this because you modified the open/close state. Reply to this email directly, view it on GitHub https://github.com/MattParr/python-atws/issues/53?email_source=notifications&email_token=ABIM745ZCUPOCPHCLWD66HDQW26T5A5CNFSM4GVIEREKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEF2WX5I#issuecomment-561343477, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABIM745RDCCOGL3EYLOUZZDQW26T5ANCNFSM4GVIEREA .
See code ran and traceback below.