Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

getLinkedItems() #124

Closed
davehorner opened this issue Jul 27, 2023 · 18 comments
Closed

getLinkedItems() #124

davehorner opened this issue Jul 27, 2023 · 18 comments
Labels

Comments

@davehorner
Copy link

Hello,
Thanks for the very nice library. I am wanting to get a list of the linked items and see no way of doing so currently with python-polarion. I'm asking if this might be possible and if so some guidance on implementing such functionality? I can help with a PR if I do find a way.
Thanks.

@jesper-raemaekers
Copy link
Owner

Hi,

I thought this was in there, but it turns out there was no direct method to do this. Have a look at the commit above to get started. This will be in the package some time soon.

@davehorner
Copy link
Author

tried to use this today. I cloned the latest code and verified the new methods were there. I did a pip install -e .

I now see.

client = polarion.Polarion(purl, puser, ppass)
zeep.exceptions.LookupError: No type 'PdfProperties' in namespace http://ws.polarion.com/TrackerWebService-types. Available types are: {http://ws.polarion.com/TrackerWebService-types}EnumOptionId, {http://ws.polarion.com/TrackerWebService-types}Baseline, {http://ws.polarion.com/TrackerWebService-types}Folder, {http://ws.polarion.com/TrackerWebService-types}Approval, {http://ws.polarion.com/TrackerWebService-types}ArrayOfApproval, {http://ws.polarion.com/TrackerWebService-types}Attachment, {http://ws.polarion.com/TrackerWebService-types}ArrayOfAttachment, {http://ws.polarion.com/TrackerWebService-types}Category, {http://ws.polarion.com/TrackerWebService-types}ArrayOfCategory, {http://ws.polarion.com/TrackerWebService-types}ArrayOfEnumOptionId, {http://ws.polarion.com/TrackerWebService-types}Comment, {http://ws.polarion.com/TrackerWebService-types}ArrayOfComment, {http://ws.polarion.com/TrackerWebService-types}ExternallyLinkedWorkItem, {http://ws.polarion.com/TrackerWebService-types}ArrayOfExternallyLinkedWorkItem, {http://ws.polarion.com/TrackerWebService-types}Hyperlink, {http://ws.polarion.com/TrackerWebService-types}ArrayOfHyperlink, {http://ws.polarion.com/TrackerWebService-types}LinkedOslcResource, {http://ws.polarion.com/TrackerWebService-types}ArrayOfLinkedOslcResource, {http://ws.polarion.com/TrackerWebService-types}LinkedWorkItem, {http://ws.polarion.com/TrackerWebService-types}ArrayOfLinkedWorkItem, {http://ws.polarion.com/TrackerWebService-types}Custom, {http://ws.polarion.com/TrackerWebService-types}ArrayOfCustom, {http://ws.polarion.com/TrackerWebService-types}PlanningConstraint, {http://ws.polarion.com/TrackerWebService-types}ArrayOfPlanningConstraint, {http://ws.polarion.com/TrackerWebService-types}PriorityOptionId, {http://ws.polarion.com/TrackerWebService-types}TimePoint, {http://ws.polarion.com/TrackerWebService-types}WorkRecord, {http://ws.polarion.com/TrackerWebService-types}ArrayOfWorkRecord, {http://ws.polarion.com/TrackerWebService-types}WorkItem, {http://ws.polarion.com/TrackerWebService-types}FieldDiff, {http://ws.polarion.com/TrackerWebService-types}Change, {http://ws.polarion.com/TrackerWebService-types}ActivityCustomValue, {http://ws.polarion.com/TrackerWebService-types}ActivityCustomValueEntry, {http://ws.polarion.com/TrackerWebService-types}ActivityComment, {http://ws.polarion.com/TrackerWebService-types}ContextId, {http://ws.polarion.com/TrackerWebService-types}Activity, {http://ws.polarion.com/TrackerWebService-types}EnumOption, {http://ws.polarion.com/TrackerWebService-types}WorkflowAction, {http://ws.polarion.com/TrackerWebService-types}CustomField, {http://ws.polarion.com/TrackerWebService-types}CustomFieldType, {http://ws.polarion.com/TrackerWebService-types}LanguageDefinition, {http://ws.polarion.com/TrackerWebService-types}LinkedResource, {http://ws.polarion.com/TrackerWebService-types}ImportedComment, {http://ws.polarion.com/TrackerWebService-types}ModuleComment, {http://ws.polarion.com/TrackerWebService-types}ArrayOfModuleComment, {http://ws.polarion.com/TrackerWebService-types}Module, {http://ws.polarion.com/TrackerWebService-types}WikiPageAttachment, {http://ws.polarion.com/TrackerWebService-types}ArrayOfWikiPageAttachment, {http://ws.polarion.com/TrackerWebService-types}WikiPage, {http://ws.polarion.com/TrackerWebService-types}ActivitySource, {http://ws.polarion.com/TrackerWebService-types}ArrayOfPriorityOptionId, {http://ws.polarion.com/TrackerWebService-types}PriorityOpt, {http://ws.polarion.com/TrackerWebService-types}EnumCustomFieldType

zeep.exception. Maybe there are some other modifications in main that are problematic? I can wait for the next release, just wanted to give it a go. thanks.

@bigblondewolf
Copy link

bigblondewolf commented Aug 14, 2023

I am also interested in getLInkedItems(), so I installed the module from the github repo and tried it. I cannot reproduce your error. Here's what I did, maybe you can try to replicate. I did this in a virtualenv to keep my system clean - make sure to source venv/bin/activate - this will change your prompt to (venv), do not proceed if not, otherwise you may break something else:

mkdir test_linked_wi
cd test_linked_wi
virtualenv venv
source venv/bin/activate
pip install --upgrade pip
pip install git+https://github.com/jesper-raemaekers/python-polarion.git#egg=polarion

I used the following simple script to test (change all MY_ labels to your needs):

#!/usr/bin/env python3

from polarion import polarion

pol = polarion.Polarion("https://MY_POLARION_ADDRESS", MY_USERNAME, MY_TOKEN)
prj = pol.getProject("MY_PROJECT")
wi = prj.getWorkitem("MY_WORKITEM_ID")
print(wi)
for lwi in wi.getLinkedItem():
    print("\t{}".format(lwi))

@davehorner
Copy link
Author

davehorner commented Aug 16, 2023

@bigblondewolf thanks for the additional detail, glad to hear it is working for you.

I didn't use virtual environments when testing, I did so now.

conda create -n myenv
conda activate --stack myenv
conda install -n myenv pip
pip install git+https://github.com/jesper-raemaekers/python-polarion.git#egg=polarion

Installs fine, still getting an error self.PdfProperties = self.getTypeFromService('Tracker', 'ns2:PdfProperties')

raise exceptions.LookupError(
zeep.exceptions.LookupError: No type 'PdfProperties' in namespace http://ws.polarion.com/TrackerWebService-types.

Probably my environment, but I'm not sure.
Looks related to 096a2ed Available types are displayed from the TrackerWebService-types; I did not see the pdf in the list. Maybe my server is older and doesn't include the pdf functionality?

@bigblondewolf
Copy link

bigblondewolf commented Aug 16, 2023

Yes, that looks like added in the commit you mention. Your TrackerWebService probably doesn't have the PdfProperties, but I don't know whether it's version or config.

Can you go to https://<your-polarion-server>/ws/services/TrackerWebService?wsdl and check if PdfProperties is in the list? I won't be very helpful if it is not, but you can always comment out line#174 from polarion.py and check the rest of the functionality you're interested in.

@davehorner
Copy link
Author

thanks. I was able to get it working when I commented out the line 174 as you suggested.

the wsdl does not contain "pdf" in the entire document.

096a2ed
would be a breaking change for those of us with no PdfProperties

@jesper-raemaekers
Copy link
Owner

Just checking in, what is your polarion version?

@jesper-raemaekers
Copy link
Owner

I also made a patch, see 705337f
Can you try this and see if this resolves the issue?

@davehorner
Copy link
Author

davehorner commented Aug 16, 2023

checked out the origin/PDF_properties_optional branch and found that the code works without modification. thank you.

@bigblondewolf
Copy link

I also made a patch, see 705337f
Can you try this and see if this resolves the issue?

Grammar police here, typo in comment on line#184 :)

@davehorner
Copy link
Author

@bigblondewolf lol nice catch.

@davehorner
Copy link
Author

davehorner commented Aug 16, 2023

It is working for many; but I have found myself in an exception.

Workitem not retrieved from Polarion (line 131 workitem.py)

self._polarion_item is all None when the exception occurs.

image

I think there may be an issue if the work item links to other projects. this has a parent and relates to. two different projects. it is using a project that is different than the linked_item.workItemURI's specified project.

It's nice to return a WorkItem but ('link type', 'PRJ-###') would be a fine interface too.

@jesper-raemaekers
Copy link
Owner

I also made a patch, see 705337f
Can you try this and see if this resolves the issue?

Grammar police here, typo in comment on line#184 :)

Will update it later.

It is working for many; but I have found myself in an exception.

Workitem not retrieved from Polarion (line 131 workitem.py)

self._polarion_item is all None when the exception occurs.

image

I think there may be an issue if the work item links to other projects. this has a parent and relates to. two different projects. it is using a project that is different than the linked_item.workItemURI's specified project.

It's nice to return a WorkItem but ('link type', 'PRJ-###') would be a fine interface too.

I will also take a look at this. I will test it with links across projects but i also agree with you that the interface could not fetch them all. This can take some time for work item that have many links. Most likely I will implement both variants of this.

@davehorner
Copy link
Author

Last night I have a work item that was changed while doing reporting. The item was changed in a way that I don't understand. It shows a "Test Steps" field was changed in event email. The thing is, we don't use Test Steps and its not visible on the item. Strange. I know I didn't edit the edit via the web interface and it happened while I was testing.

@github-actions
Copy link

This issue is stale because it has been open for 30 days with no activity.

@github-actions github-actions bot added the stale label Sep 17, 2023
@github-actions
Copy link

github-actions bot commented Oct 1, 2023

This issue was closed because it has been inactive for 14 days since being marked as stale.

@github-actions github-actions bot closed this as completed Oct 1, 2023
@jesper-raemaekers
Copy link
Owner

So, i guess 2 months qualifies as 'I'll look at it later' :)

So it works just fine retrieving workitems across projects. I did add a check in 42c2b61 to prevent that exception that you had. I'll go ahead and merge these changes discussed here to main so that is will be released at some point.

@davehorner for that email notification, I'm not to sure how to start debugging it. Added tests steps is not done the same way as other properties of a workitem so that should not occur when not changing it.

@davehorner
Copy link
Author

@jesper-raemaekers thank you for addressing my concern with the modification and "Test Steps" field.

Added tests steps is not done the same way as other properties of a workitem so that should not occur when not changing it.

Whatever that different way is, it changed an item. I just looked now and I think I may have another candidate, this one removed a test step. I'm not certain how to corral this issue.

Thank you for getting these features into further release. It is very handy.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants