This adds a new widget called pullrequests that replaces the githubpr and pagurepr widgets. It consolodates these into a single widget that draws the repos from the team hub config
rebased onto 2b0a875dfee75068e00b66fe6915896da3faf5ba
Actually I have defined the main pagure instance URL in hubs.utils.pagure. I'm not quite sure it's going to be very useful for us but it's there in case someone wants to install Hubs and connect to a different Pagure install.
hubs.utils.pagure
If you think there are useful functions that could be re-used by other widgets, feel free to move them to hubs.utils.pagure.
Since we have currently two pagure instances, do we want to integrate from both of them?
I think that for now we'll stick with pagure.io. But it would be cool to be able to declare Pagure projects on other instances in the future.
Thanks @abompard! Updated the PR to use the URL in hub.utils.pagure. Also noticed that the github links werent implemented properly, so also added that. Also abracted some of the pagure logic to the utils too.
rebased onto 97762eafbf2ac4abc7488b1bebcea49aca45dc79
Would this widget be useful on a stream hub? Maybe post-MVP, because it makes getting the config more complex.
I think there should be 2 cached functions, on for GitHub and one for Pagure. This way we wouldn't have to rebuild the cache of both when only one is updated. The two function's outputs could be combined here in the view.
This is not very explicit... I was lacking the github api key in my config and it just showed a traceback. By the way, are you sure that the api key is necessary? I don't think we're trying to support private repos anyway.
OKies, updated the commit:
Also, yeah i think adapting this for the stream hub is a good post 1.0 task.
rebased onto d11a9c1369ed3a4378ec6ff32fd42b132376acc0
rebased onto 5eb704f33a7ca826249f1410be527040e412b533
rebased onto 7fcd5b9967fc9194e1a84158acc257cfd95ef026
If there are no pull requests, the box is just empty and I think we should display a message. Ideally, the message would be different if no project is configured for the hub.
rebased onto 3c160c3964f1fe8768a774ba800e40d3baed7047
A message is now displayed if there are no pull-requests. Also a message is displayed if there is no projects configured.
It seems wrong to have this <div> tag inside a ul tag, could you do the testing outside the ul?
<div>
ul
whoops! yeah my mistake there!
fixed this one up now!
rebased onto ad22cda2ef38e63a6f296eda686dc44c3677d5ed
Maybe I'm being a bit too nitpicky, but let's consider the case of a hub.updated message about a pagure change, but not on that hub. Then this test will be false and the code will fall through to the end of the function and return None. It will work since None is interpreted as False, but I'd rather not rely on that so we can change it in the future.
hub.updated
pagure
None
False
For example here you could write: return hub_id == self.instance.hub.id
return hub_id == self.instance.hub.id
(also, the indentation of the if condition above is a bit weird)
And this applies to the other cached function too.
@abompard no problemo! thanks for being thorough!
i think i got it fixed now!
rebased onto b9757c05d282bc12f18b21258221dc8d0081825c
Running tox -e lint gives me these errors:
tox -e lint
./hubs/tests/widgets/test_pullrequests.py:18:80: E501 line too long (81 > 79 characters) func = self.widget.module.get_cached_functions()['GetPagurePullRequests'] ^ ./hubs/tests/widgets/test_pullrequests.py:22:80: E501 line too long (81 > 79 characters) func = self.widget.module.get_cached_functions()['GetGithubPullRequests'] ^ ./hubs/tests/widgets/test_pullrequests.py:31:5: E303 too many blank lines (2) def test_should_invalidate_good_match_pagure(self): ^
Almost there! :-D
woo! okies fixed the linting issues -- sorry about that!
rebased onto 47039090db3f5ee0e7f5bdbbfb28f02c719de98b
Pull-Request has been merged by abompard
This adds a new widget called pullrequests that replaces the
githubpr and pagurepr widgets. It consolodates these into a
single widget that draws the repos from the team hub config