devopshq / tfs

Microsoft TFS API Python client
https://devopshq.github.io/tfs/
MIT License
110 stars 28 forks source link

Cannot get "System.Tags" data for Work Items #66

Closed TrevorDBrown closed 5 years ago

TrevorDBrown commented 5 years ago

When trying to use the Work Item attribute "Tags" (or "System.Tags"), I get the following error:

Traceback (most recent call last):
  File ".\get-tfs-data.py", line 35, in <module>
    main()
  File ".\get-tfs-data.py", line 32, in main
    parseTFSQueryData(client, readyToGroomDesign)
  File ".\get-tfs-data.py", line 22, in parseTFSQueryData
    print("%s, %s, %s, %s, %s, %s" % (workitem['Id'], workitem['WorkItemType'], workitem['System.Title'], workitem['AssignedTo'], workitem['State'], workitem['tags']))
  File "C:\Python37\lib\site-packages\tfs\resources.py", line 107, in __getitem__
    return self.fields[key]
  File "C:\Python37\lib\site-packages\requests\structures.py", line 52, in __getitem__
    return self._store[key.lower()][1]
KeyError: 'system.tags'

I've verified other attributes work as expected (i.e. Title (System.Title))

Boltyk commented 5 years ago

Do you have any tags on this work item?

TrevorDBrown commented 5 years ago

Hello, @Boltyk,

The instance above did not. I tried a work item with at least one tag, and it worked. Sorry for not testing that beforehand.

So, I assume it'll always fail if the particular work item does not have the specified key-value pair?

Boltyk commented 5 years ago

Looks like a valid bug for me. Thanks @TrevorDBrown

TrevorDBrown commented 5 years ago

Tested the develop branch with the changes. Worked great! Thank you, @Boltyk!