From witten at alum.mit.edu Thu Nov 10 13:26:38 2016 From: witten at alum.mit.edu (Michael Witten) Date: Thu, 10 Nov 2016 18:26:38 -0000 Subject: [Tracker-discuss] Reviving a [mostly] dead account Message-ID: <9ea85e2d31c8425eabddc76e7c9de785-witten@alum.mit.edu> I suspect that this email is inappropriate for this list, yet I am unaware of a forum that would be more appropriate. In short, I registered the account `mfwitten' on Wed, 22 Oct 2008, at approximately 19:44:02 -0000; I still have the registration email, including the `key', if that matters. This account is associated with the following email address: mfwitten at mit.edu Alas, I have not had access to that email address for a very long time indeed, and even if I have managed to remember the password for my tracker account, it may have been obliterated when the system was told that I had forgotten my password. If possible, I would like to have the `mfwitten' account's primary email address reset to the one on this email, namely: witten at alum.mit.edu Alternatively, it would probably be enough to have the password-reset email sent to that address, so that I may configure things on my own. Thanks for you help, Michael Witten From ezio.melotti at gmail.com Thu Nov 10 13:43:28 2016 From: ezio.melotti at gmail.com (Ezio Melotti) Date: Thu, 10 Nov 2016 19:43:28 +0100 Subject: [Tracker-discuss] Reviving a [mostly] dead account In-Reply-To: <9ea85e2d31c8425eabddc76e7c9de785-witten@alum.mit.edu> References: <9ea85e2d31c8425eabddc76e7c9de785-witten@alum.mit.edu> Message-ID: I updated the email address. Let me know if it works. Best Regards, Ezio Melotti On Thu, Nov 10, 2016 at 7:26 PM, Michael Witten wrote: > I suspect that this email is inappropriate for this list, yet I am > unaware of a forum that would be more appropriate. > > In short, I registered the account `mfwitten' on Wed, 22 Oct 2008, at > approximately 19:44:02 -0000; I still have the registration email, > including the `key', if that matters. This account is associated with > the following email address: > > mfwitten at mit.edu > > Alas, I have not had access to that email address for a very long time > indeed, and even if I have managed to remember the password for my > tracker account, it may have been obliterated when the system was told > that I had forgotten my password. > > If possible, I would like to have the `mfwitten' account's primary email > address reset to the one on this email, namely: > > witten at alum.mit.edu > > Alternatively, it would probably be enough to have the password-reset email > sent to that address, so that I may configure things on my own. > > Thanks for you help, > Michael Witten > _______________________________________________ > Tracker-discuss mailing list > Tracker-discuss at python.org > https://mail.python.org/mailman/listinfo/tracker-discuss > Code of Conduct: https://www.python.org/psf/codeofconduct/ From witten at alum.mit.edu Thu Nov 10 14:40:45 2016 From: witten at alum.mit.edu (Michael Witten) Date: Thu, 10 Nov 2016 19:40:45 -0000 Subject: [Tracker-discuss] Reviving a [mostly] dead account In-Reply-To: References: <9ea85e2d31c8425eabddc76e7c9de785-witten@alum.mit.edu> Message-ID: <129685d61072407da64df36e1b8aa5bd-witten@alum.mit.edu> On Thu, 10 Nov 2016 19:43:28 +0100, Ezio Melotti wrote: > On Thu, Nov 10, 2016 at 7:26 PM, Michael Witten wrote: > >> If possible, I would like to have the `mfwitten' account's primary email >> address reset to the one on this email, namely: >> >> witten at alum.mit.edu >> >> ... > > I updated the email address. > Let me know if it works. Thank you kindly! That did the trick. From metatracker at psf.upfronthosting.co.za Wed Nov 16 15:03:47 2016 From: metatracker at psf.upfronthosting.co.za (Jim Nasby) Date: Wed, 16 Nov 2016 20:03:47 +0000 Subject: [Tracker-discuss] [issue608] Unable to associate additional Google OpenID (python bug tracker) Message-ID: <1479326627.53.0.383405708557.issue608@psf.upfronthosting.co.za> New submission from Jim Nasby: After logging into the python bug tracker and hitting "Your Details", I'm trying to associate another Google OpenID with my account, but the Associate box provides zero information on how to do this. I've attempted to use my gmail email address as well as https://accounts.google.com/{google account number}, neither of which worked. ---------- messages: 3190 nosy: Jim Nasby priority: bug status: unread title: Unable to associate additional Google OpenID (python bug tracker) _______________________________________________________ PSF Meta Tracker _______________________________________________________ From metatracker at psf.upfronthosting.co.za Fri Nov 18 03:34:56 2016 From: metatracker at psf.upfronthosting.co.za (Berker Peksag) Date: Fri, 18 Nov 2016 08:34:56 +0000 Subject: [Tracker-discuss] [issue594] Fix ImportError: cannot import name rndstr in oic_login.py In-Reply-To: <1465452688.2.0.953419813695.issue594@psf.upfronthosting.co.za> Message-ID: <1479458096.91.0.112900011951.issue594@psf.upfronthosting.co.za> Berker Peksag added the comment: The patch also helped Ezio so I just committed it in https://hg.python.org/tracker/python-dev/rev/46237fce3bfe and pinged him. ---------- status: unread -> resolved _______________________________________________________ PSF Meta Tracker _______________________________________________________ From metatracker at psf.upfronthosting.co.za Sun Nov 20 08:35:23 2016 From: metatracker at psf.upfronthosting.co.za (Ezio Melotti) Date: Sun, 20 Nov 2016 13:35:23 +0000 Subject: [Tracker-discuss] [issue586] Add GitHub Pull Request URL on issue page In-Reply-To: <1468311341.73.0.296282421587.issue586@psf.upfronthosting.co.za> Message-ID: <1479648923.34.0.937518681159.issue586@psf.upfronthosting.co.za> Ezio Melotti added the comment: I've looked at the latest patch (2016-07-21.16:13:52) and the only major issue I've found so far is that any user can unlink (remove) any PR, even the ones created by other users. This is likely because of wrong permissions in schema.py. There are also a few minor low-priority issues and feature requests that can be addressed later: 1) it's possible to add the same PR multiple times to the same issue (I also tested with http/https). 2) it would be good to support the username/repo#pr_num syntax, perhaps even just the PR number and default on the CPython repo; 3) I would prefer the "remove" button to be on the pull_request page. This will make it consistent with the files (they have an "unlink" button), avoid unnecessary clutter, and prevent accidental removal of linked PRs; 4) all the i18n:translate="" can be removed; 5) the "Author" column might be misleading, since it refers to whoever linked the PR, not the author of the PR. ---------- nosy: +ezio.melotti _______________________________________________________ PSF Meta Tracker _______________________________________________________ From metatracker at psf.upfronthosting.co.za Mon Nov 21 18:21:18 2016 From: metatracker at psf.upfronthosting.co.za (Maciej Szulik) Date: Mon, 21 Nov 2016 23:21:18 +0000 Subject: [Tracker-discuss] [issue586] Add GitHub Pull Request URL on issue page In-Reply-To: <1468311341.73.0.296282421587.issue586@psf.upfronthosting.co.za> Message-ID: <1479770478.69.0.970694470227.issue586@psf.upfronthosting.co.za> Maciej Szulik added the comment: Addressed 1, 2, 4, 5. I'll handle 3rd along with title as a followup issue. _______________________________________________________ PSF Meta Tracker _______________________________________________________ -------------- next part -------------- diff --git a/detectors/pull_request.py b/detectors/pull_request.py new file mode 100644 --- /dev/null +++ b/detectors/pull_request.py @@ -0,0 +1,49 @@ +# Auditor for GitHub URLs +# Check if it is a valid GitHub Pull Request URL and extract PR number + +import re +import urlparse + + +def validate_pull_requests(db, cl, nodeid, newvalues): + newprs = set(newvalues.get('pull_requests',())) + oldprs = set() + if nodeid: + oldprs = set(db.issue.get(nodeid, 'pull_requests')) + newprs -= oldprs + newurl = '' + for prid in newprs: + newurl = parse_url(db.pull_request.get(prid, 'url')) + if newurl != '': + for prid in oldprs: + if newurl == db.pull_request.get(prid, 'url'): + raise ValueError("GitHub PR already added to issue") + +def validate_url(db, cl, nodeid, newvalues): + newurl = parse_url(newvalues.get('url', '')) + if newurl != '': + newvalues['url'] = newurl + # TODO: read PR title here + +def parse_url(url): + if url == '': + return + # TODO: transform following forms: + # - username/repo#prno + # - repo/#prno + parsed_url = urlparse.urlparse(url) + if parsed_url.scheme == '': + url = 'https://' + url + parsed_url = urlparse.urlparse(url) + if parsed_url.scheme not in ('http', 'https'): + raise ValueError("Invalid URL scheme in GitHub PR") + if 'github.com' not in parsed_url.netloc or 'pull' not in parsed_url.path: + raise ValueError("Invalid GitHub PR") + return parsed_url.geturl().strip('/') + + +def init(db): + db.issue.audit('create', validate_pull_requests) + db.issue.audit('set', validate_pull_requests) + db.pull_request.audit('create', validate_url) + db.pull_request.audit('set', validate_url) diff --git a/html/issue.item.html b/html/issue.item.html --- a/html/issue.item.html +++ b/html/issue.item.html @@ -220,6 +220,14 @@ + + GitHub PR: + + + + + + @@ -273,6 +281,31 @@
+ + + + + + + + + + + + +
Pull Requests
URLLinkedEdit
+ + URL + + + creator's name, + creation date + + edit +
+

diff --git a/html/pull_request.item.html b/html/pull_request.item.html new file mode 100644 --- /dev/null +++ b/html/pull_request.item.html @@ -0,0 +1,72 @@ + +File display - <span + i18n:name="tracker" tal:replace="config/TRACKER_NAME" /> +Pull Request + + + +

+ You are not allowed to view this page.

+ +

+ Please login with your username and password.

+ +
+ + + + + + + + + + + + + + + +
URL
Title
+   + + + + submit button here
+
+ +

+ File has been classified as spam.

+ +
+ + + +

This PR is linked to : +

+
+ + +

This PR has been unlinked from : +

+ + + + + + + + + diff --git a/schema.py b/schema.py --- a/schema.py +++ b/schema.py @@ -173,6 +173,11 @@ patchbranch=String(), ) +pull_request = Class(db, "pull_request", + url=String(), + title=String(), + ) + # IssueClass automatically gets these properties in addition to the Class ones: # title = String() # messages = Multilink("msg") @@ -194,7 +199,8 @@ stage=Link('stage'), nosy_count=Number(), message_count=Number(), - hgrepos=Multilink('hgrepo')) + hgrepos=Multilink('hgrepo'), + pull_requests=Multilink('pull_request')) # # TRACKER SECURITY SETTINGS @@ -222,7 +228,7 @@ for cl in ('issue_type', 'severity', 'component', 'version', 'priority', 'stage', 'status', 'resolution', - 'issue', 'keyword', 'hgrepo'): + 'issue', 'keyword', 'hgrepo', 'pull_request'): db.security.addPermissionToRole('User', 'View', cl) db.security.addPermissionToRole('Anonymous', 'View', cl) @@ -233,6 +239,13 @@ properties=['url', 'patchbranch']) db.security.addPermissionToRole('User', p) +def may_edit_pull_request(db, userid, itemid): + return userid == db.pull_request.get(itemid, "creator") +db.security.addPermissionToRole('User', 'Create', 'pull_request') +p = db.security.addPermission(name='Edit', klass='pull_request', + check=may_edit_pull_request, properties=['url', 'title']) +db.security.addPermissionToRole('User', p) + class may_view_spam: def __init__(self, klassname): self.klassname = klassname @@ -292,7 +305,7 @@ properties=('title', 'type', 'components', 'versions', 'severity', - 'messages', 'files', 'nosy', 'hgrepos'), + 'messages', 'files', 'nosy', 'hgrepos', 'pull_requests'), description='User can report and discuss issues') db.security.addPermissionToRole('User', p) @@ -300,7 +313,7 @@ properties=('title', 'type', 'components', 'versions', 'severity', - 'messages', 'files', 'nosy', 'hgrepos'), + 'messages', 'files', 'nosy', 'hgrepos', 'pull_requests'), description='User can report and discuss issues') db.security.addPermissionToRole('User', p) @@ -335,7 +348,7 @@ ########################## for cl in ('issue_type', 'severity', 'component', 'version', 'priority', 'stage', 'status', 'resolution', 'issue', - 'file', 'msg', 'hgrepo'): + 'file', 'msg', 'hgrepo', 'pull_request'): db.security.addPermissionToRole('Coordinator', 'View', cl) db.security.addPermissionToRole('Coordinator', 'Edit', cl) db.security.addPermissionToRole('Coordinator', 'Create', cl) From metatracker at psf.upfronthosting.co.za Mon Nov 21 19:12:14 2016 From: metatracker at psf.upfronthosting.co.za (Maciej Szulik) Date: Tue, 22 Nov 2016 00:12:14 +0000 Subject: [Tracker-discuss] [issue586] Add GitHub Pull Request URL on issue page In-Reply-To: <1468311341.73.0.296282421587.issue586@psf.upfronthosting.co.za> Message-ID: <1479773534.64.0.0570846668293.issue586@psf.upfronthosting.co.za> Maciej Szulik added the comment: Apparently I can't leave title set to none, I had to explicitly set it to empty if none is set. _______________________________________________________ PSF Meta Tracker _______________________________________________________ -------------- next part -------------- diff --git a/detectors/pull_request.py b/detectors/pull_request.py new file mode 100644 --- /dev/null +++ b/detectors/pull_request.py @@ -0,0 +1,55 @@ +# Auditor for GitHub URLs +# Check if it is a valid GitHub Pull Request URL and extract PR number + +import re +import urlparse + + +def validate_pull_requests(db, cl, nodeid, newvalues): + newprs = set(newvalues.get('pull_requests',())) + oldprs = set() + if nodeid: + oldprs = set(db.issue.get(nodeid, 'pull_requests')) + newprs -= oldprs + newurl = '' + for prid in newprs: + newurl = parse_url(db.pull_request.get(prid, 'url')) + if newurl != '': + for prid in oldprs: + if newurl == db.pull_request.get(prid, 'url'): + raise ValueError("GitHub PR already added to issue") + +def validate_url(db, cl, nodeid, newvalues): + try: + newurl = parse_url(newvalues['url']) + if newurl != '': + newvalues['url'] = newurl + except KeyError: + pass + try: + newvalues['title'] + except KeyError: + newvalues['title'] = '' + +def parse_url(url): + if url == '': + return + # TODO: transform following forms: + # - username/repo#prno + # - repo/#prno + parsed_url = urlparse.urlparse(url) + if parsed_url.scheme == '': + url = 'https://' + url + parsed_url = urlparse.urlparse(url) + if parsed_url.scheme not in ('http', 'https'): + raise ValueError("Invalid URL scheme in GitHub PR") + if 'github.com' not in parsed_url.netloc or 'pull' not in parsed_url.path: + raise ValueError("Invalid GitHub PR") + return parsed_url.geturl().strip('/') + + +def init(db): + db.issue.audit('create', validate_pull_requests) + db.issue.audit('set', validate_pull_requests) + db.pull_request.audit('create', validate_url) + db.pull_request.audit('set', validate_url) diff --git a/html/issue.item.html b/html/issue.item.html --- a/html/issue.item.html +++ b/html/issue.item.html @@ -220,6 +220,14 @@ + + GitHub PR: + + + + + + @@ -273,6 +281,31 @@
+ + + + + + + + + + + + +
Pull Requests
URLLinkedEdit
+ + URL + + + creator's name, + creation date + + edit +
+

diff --git a/html/pull_request.item.html b/html/pull_request.item.html new file mode 100644 --- /dev/null +++ b/html/pull_request.item.html @@ -0,0 +1,72 @@ + +Pull Request - <span + i18n:name="tracker" tal:replace="config/TRACKER_NAME" /> +Pull Request + + + +

+ You are not allowed to view this page.

+ +

+ Please login with your username and password.

+ +
+ + + + + + + + + + + + + + + +
URL
Title
+   + + + + submit button here
+
+ +

+ File has been classified as spam.

+ +
+ + + +

This PR is linked to : +

+ + + +

This PR has been unlinked from : +

+ + + + + + + + + diff --git a/schema.py b/schema.py --- a/schema.py +++ b/schema.py @@ -173,6 +173,11 @@ patchbranch=String(), ) +pull_request = Class(db, "pull_request", + url=String(), + title=String(), + ) + # IssueClass automatically gets these properties in addition to the Class ones: # title = String() # messages = Multilink("msg") @@ -194,7 +199,8 @@ stage=Link('stage'), nosy_count=Number(), message_count=Number(), - hgrepos=Multilink('hgrepo')) + hgrepos=Multilink('hgrepo'), + pull_requests=Multilink('pull_request')) # # TRACKER SECURITY SETTINGS @@ -222,7 +228,7 @@ for cl in ('issue_type', 'severity', 'component', 'version', 'priority', 'stage', 'status', 'resolution', - 'issue', 'keyword', 'hgrepo'): + 'issue', 'keyword', 'hgrepo', 'pull_request'): db.security.addPermissionToRole('User', 'View', cl) db.security.addPermissionToRole('Anonymous', 'View', cl) @@ -233,6 +239,13 @@ properties=['url', 'patchbranch']) db.security.addPermissionToRole('User', p) +def may_edit_pull_request(db, userid, itemid): + return userid == db.pull_request.get(itemid, "creator") +db.security.addPermissionToRole('User', 'Create', 'pull_request') +p = db.security.addPermission(name='Edit', klass='pull_request', + check=may_edit_pull_request, properties=['url', 'title']) +db.security.addPermissionToRole('User', p) + class may_view_spam: def __init__(self, klassname): self.klassname = klassname @@ -292,7 +305,7 @@ properties=('title', 'type', 'components', 'versions', 'severity', - 'messages', 'files', 'nosy', 'hgrepos'), + 'messages', 'files', 'nosy', 'hgrepos', 'pull_requests'), description='User can report and discuss issues') db.security.addPermissionToRole('User', p) @@ -300,7 +313,7 @@ properties=('title', 'type', 'components', 'versions', 'severity', - 'messages', 'files', 'nosy', 'hgrepos'), + 'messages', 'files', 'nosy', 'hgrepos', 'pull_requests'), description='User can report and discuss issues') db.security.addPermissionToRole('User', p) @@ -335,7 +348,7 @@ ########################## for cl in ('issue_type', 'severity', 'component', 'version', 'priority', 'stage', 'status', 'resolution', 'issue', - 'file', 'msg', 'hgrepo'): + 'file', 'msg', 'hgrepo', 'pull_request'): db.security.addPermissionToRole('Coordinator', 'View', cl) db.security.addPermissionToRole('Coordinator', 'Edit', cl) db.security.addPermissionToRole('Coordinator', 'Create', cl) From metatracker at psf.upfronthosting.co.za Mon Nov 21 19:22:44 2016 From: metatracker at psf.upfronthosting.co.za (Maciej Szulik) Date: Tue, 22 Nov 2016 00:22:44 +0000 Subject: [Tracker-discuss] [issue586] Add GitHub Pull Request URL on issue page In-Reply-To: <1468311341.73.0.296282421587.issue586@psf.upfronthosting.co.za> Message-ID: <1479774164.94.0.55011719222.issue586@psf.upfronthosting.co.za> Maciej Szulik added the comment: Permissions problem should be addressed as well, since I've added option to unlink, rather than remove. Similarly to what is available for files. _______________________________________________________ PSF Meta Tracker _______________________________________________________ From metatracker at psf.upfronthosting.co.za Thu Nov 24 03:54:06 2016 From: metatracker at psf.upfronthosting.co.za (Maciej Szulik) Date: Thu, 24 Nov 2016 08:54:06 +0000 Subject: [Tracker-discuss] [issue586] Add GitHub Pull Request URL on issue page In-Reply-To: <1468311341.73.0.296282421587.issue586@psf.upfronthosting.co.za> Message-ID: <1479977646.51.0.301501635949.issue586@psf.upfronthosting.co.za> Maciej Szulik added the comment: I've added slight changes to previous patch, fixing the look of the PRs table and the class in hgrepos table header (it had typo, Header vs header). _______________________________________________________ PSF Meta Tracker _______________________________________________________ -------------- next part -------------- diff --git a/detectors/pull_request.py b/detectors/pull_request.py new file mode 100644 --- /dev/null +++ b/detectors/pull_request.py @@ -0,0 +1,55 @@ +# Auditor for GitHub URLs +# Check if it is a valid GitHub Pull Request URL and extract PR number + +import re +import urlparse + + +def validate_pull_requests(db, cl, nodeid, newvalues): + newprs = set(newvalues.get('pull_requests',())) + oldprs = set() + if nodeid: + oldprs = set(db.issue.get(nodeid, 'pull_requests')) + newprs -= oldprs + newurl = '' + for prid in newprs: + newurl = parse_url(db.pull_request.get(prid, 'url')) + if newurl != '': + for prid in oldprs: + if newurl == db.pull_request.get(prid, 'url'): + raise ValueError("GitHub PR already added to issue") + +def validate_url(db, cl, nodeid, newvalues): + try: + newurl = parse_url(newvalues['url']) + if newurl != '': + newvalues['url'] = newurl + except KeyError: + pass + try: + newvalues['title'] + except KeyError: + newvalues['title'] = '' + +def parse_url(url): + if url == '': + return + # TODO: transform following forms: + # - username/repo#prno + # - repo/#prno + parsed_url = urlparse.urlparse(url) + if parsed_url.scheme == '': + url = 'https://' + url + parsed_url = urlparse.urlparse(url) + if parsed_url.scheme not in ('http', 'https'): + raise ValueError("Invalid URL scheme in GitHub PR") + if 'github.com' not in parsed_url.netloc or 'pull' not in parsed_url.path: + raise ValueError("Invalid GitHub PR") + return parsed_url.geturl().strip('/') + + +def init(db): + db.issue.audit('create', validate_pull_requests) + db.issue.audit('set', validate_pull_requests) + db.pull_request.audit('create', validate_url) + db.pull_request.audit('set', validate_url) diff --git a/html/issue.item.html b/html/issue.item.html --- a/html/issue.item.html +++ b/html/issue.item.html @@ -220,6 +220,14 @@ + + GitHub PR: + + + + + + @@ -273,6 +281,31 @@
+ + + + + + + + + + + + +
Pull Requests
URLLinkedEdit
+ + URL + + + creator's name, + creation date + + edit +
+

@@ -284,7 +317,7 @@ once it's done your name will have a * next to it.)

- + + + diff --git a/schema.py b/schema.py --- a/schema.py +++ b/schema.py @@ -173,6 +173,11 @@ patchbranch=String(), ) +pull_request = Class(db, "pull_request", + url=String(), + title=String(), + ) + # IssueClass automatically gets these properties in addition to the Class ones: # title = String() # messages = Multilink("msg") @@ -194,7 +199,8 @@ stage=Link('stage'), nosy_count=Number(), message_count=Number(), - hgrepos=Multilink('hgrepo')) + hgrepos=Multilink('hgrepo'), + pull_requests=Multilink('pull_request')) # # TRACKER SECURITY SETTINGS @@ -222,7 +228,7 @@ for cl in ('issue_type', 'severity', 'component', 'version', 'priority', 'stage', 'status', 'resolution', - 'issue', 'keyword', 'hgrepo'): + 'issue', 'keyword', 'hgrepo', 'pull_request'): db.security.addPermissionToRole('User', 'View', cl) db.security.addPermissionToRole('Anonymous', 'View', cl) @@ -233,6 +239,13 @@ properties=['url', 'patchbranch']) db.security.addPermissionToRole('User', p) +def may_edit_pull_request(db, userid, itemid): + return userid == db.pull_request.get(itemid, "creator") +db.security.addPermissionToRole('User', 'Create', 'pull_request') +p = db.security.addPermission(name='Edit', klass='pull_request', + check=may_edit_pull_request, properties=['url', 'title']) +db.security.addPermissionToRole('User', p) + class may_view_spam: def __init__(self, klassname): self.klassname = klassname @@ -292,7 +305,7 @@ properties=('title', 'type', 'components', 'versions', 'severity', - 'messages', 'files', 'nosy', 'hgrepos'), + 'messages', 'files', 'nosy', 'hgrepos', 'pull_requests'), description='User can report and discuss issues') db.security.addPermissionToRole('User', p) @@ -300,7 +313,7 @@ properties=('title', 'type', 'components', 'versions', 'severity', - 'messages', 'files', 'nosy', 'hgrepos'), + 'messages', 'files', 'nosy', 'hgrepos', 'pull_requests'), description='User can report and discuss issues') db.security.addPermissionToRole('User', p) @@ -335,7 +348,7 @@ ########################## for cl in ('issue_type', 'severity', 'component', 'version', 'priority', 'stage', 'status', 'resolution', 'issue', - 'file', 'msg', 'hgrepo'): + 'file', 'msg', 'hgrepo', 'pull_request'): db.security.addPermissionToRole('Coordinator', 'View', cl) db.security.addPermissionToRole('Coordinator', 'Edit', cl) db.security.addPermissionToRole('Coordinator', 'Create', cl) From metatracker at psf.upfronthosting.co.za Thu Nov 24 08:55:55 2016 From: metatracker at psf.upfronthosting.co.za (Ezio Melotti) Date: Thu, 24 Nov 2016 13:55:55 +0000 Subject: [Tracker-discuss] [issue593] Small improvements to issue.item.html In-Reply-To: <1465451224.3.0.969789688095.issue593@psf.upfronthosting.co.za> Message-ID: <1479995755.57.0.678334511111.issue593@psf.upfronthosting.co.za> Ezio Melotti added the comment: > 1. Add a 't' mark to mark our triagers If we want to add this, I think we should rethink it a bit, since now we have a * for people show signed the cla, an image for committers, and a letter for triagers. Perhaps we could have a black&white python symbol for triagers and the regular one for committers (either one or the other is displayed)? > 2. List only core developers in the 'assigned to' field Not sure about this, but would it make sense to build the list using an util, rather than raw sql? > 3. Fix style of the 'Submit Changes' button Is this just replacing the table with a div? In that case I think it's ok, if it doesn't break anything else. I think the 3 suggestions should have 3 separate patches, perhaps 3 separate issues too. _______________________________________________________ PSF Meta Tracker _______________________________________________________ From metatracker at psf.upfronthosting.co.za Thu Nov 24 17:26:02 2016 From: metatracker at psf.upfronthosting.co.za (Maciej Szulik) Date: Thu, 24 Nov 2016 22:26:02 +0000 Subject: [Tracker-discuss] [issue586] Add GitHub Pull Request URL on issue page In-Reply-To: <1468311341.73.0.296282421587.issue586@psf.upfronthosting.co.za> Message-ID: <1480026362.53.0.328758810582.issue586@psf.upfronthosting.co.za> Maciej Szulik added the comment: The alternate version with pr number and repository fields. _______________________________________________________ PSF Meta Tracker _______________________________________________________ -------------- next part -------------- diff --git a/detectors/pull_request.py b/detectors/pull_request.py new file mode 100644 --- /dev/null +++ b/detectors/pull_request.py @@ -0,0 +1,79 @@ +# Auditor for GitHub URLs +# Check if it is a valid GitHub Pull Request URL and extract PR number + +import re + + +just_number_re = re.compile(r'\d+') +repo_number_re = re.compile(r'(?P\w+)?#(?P\d+)') +url_re = re.compile(r'github\.com/cpython/(?P\w+)/(?P\d+)') + +default_repository = 'python' + +def validate_pull_requests(db, cl, nodeid, newvalues): + newprs = set(newvalues.get('pull_requests',())) + if not newprs: + return + oldprs = set() + if nodeid: + oldprs = set(db.issue.get(nodeid, 'pull_requests')) + newprs -= oldprs + try: + prid = newprs.pop() + except KeyError: + return + repository = db.pull_request.get(prid, 'repository') + number = db.pull_request.get(prid, 'number') + for oldpr in oldprs: + oldrepository = db.pull_request.get(oldpr, 'repository') + oldnumber = db.pull_request.get(oldpr, 'number') + if repository == oldrepository and number == oldnumber: + raise ValueError("GitHub PR already added to issue") + +def validate_url(db, cl, nodeid, newvalues): + try: + repository, number = parse_url(newvalues['url']) + if repository and number: + newvalues['repository'] = repository + newvalues['number'] = number + del newvalues['url'] + except KeyError: + pass + try: + newvalues['title'] + except KeyError: + newvalues['title'] = '' + +def parse_url(url): + """ + Transform following forms: + - full url + - repository#number + - #number + - number + and returns tuple repository name and pull request number. + """ + # first try just the number + just_number_match = just_number_re.search(url) + if just_number_match: + return default_repository, just_number_match.group() + # then try repository#number (repository part can be omitted here) + repo_number_match = repo_number_re.search(url) + if repo_number_match: + repository = repo_number_match.group('repository') + if repository is None: + repository = default_repository + return repository, repo_number_match.group('number') + # finally parse the url + url_match = url_re.search(url) + if url_match: + return url_match.group('repository'), url_match.group('number') + # if nothing else raise error + raise ValueError("Unknown PR format, acceptable formats are: full github URL, repository#pr_number, #pr_number, pr_number") + + +def init(db): + db.issue.audit('create', validate_pull_requests) + db.issue.audit('set', validate_pull_requests) + db.pull_request.audit('create', validate_url) + db.pull_request.audit('set', validate_url) diff --git a/extensions/pull_request.py b/extensions/pull_request.py new file mode 100644 --- /dev/null +++ b/extensions/pull_request.py @@ -0,0 +1,9 @@ + +def get_pr_url(repository, number): + """Transforms pull_request object into working URL.""" + baseurl = 'https://github.com/cpython/' + return "%s%s/%d" % (baseurl, repository, number) + +def init(instance): + instance.registerUtil('get_pr_url', get_pr_url) + diff --git a/html/issue.item.html b/html/issue.item.html --- a/html/issue.item.html +++ b/html/issue.item.html @@ -220,6 +220,14 @@ + + + + +
Repositories containing patches
Repositories containing patches
+Pull Request - <span + i18n:name="tracker" tal:replace="config/TRACKER_NAME" /> +Pull Request + + + +

+ You are not allowed to view this page.

+ +

+ Please login with your username and password.

+ +
+ + + + + + + + + + + + + + + +
URL
Title
+   + + + + submit button here
+
+ +

+ File has been classified as spam.

+ +
+ + + +

This PR is linked to : +

+
+ + +

This PR has been unlinked from : +

+ + + + + + +
GitHub PR: + + +
@@ -273,6 +281,31 @@
+ + + + + + + + + + + + +
Pull Requests
URLLinkedEdit
+ + URL + + + creator's name, + creation date + + edit +
+

@@ -284,7 +317,7 @@ once it's done your name will have a * next to it.)

- + + + diff --git a/schema.py b/schema.py --- a/schema.py +++ b/schema.py @@ -173,6 +173,13 @@ patchbranch=String(), ) +pull_request = Class(db, "pull_request", + url=String(), + repository=String(), + number=Number(), + title=String(), + ) + # IssueClass automatically gets these properties in addition to the Class ones: # title = String() # messages = Multilink("msg") @@ -194,7 +201,8 @@ stage=Link('stage'), nosy_count=Number(), message_count=Number(), - hgrepos=Multilink('hgrepo')) + hgrepos=Multilink('hgrepo'), + pull_requests=Multilink('pull_request')) # # TRACKER SECURITY SETTINGS @@ -222,7 +230,7 @@ for cl in ('issue_type', 'severity', 'component', 'version', 'priority', 'stage', 'status', 'resolution', - 'issue', 'keyword', 'hgrepo'): + 'issue', 'keyword', 'hgrepo', 'pull_request'): db.security.addPermissionToRole('User', 'View', cl) db.security.addPermissionToRole('Anonymous', 'View', cl) @@ -233,6 +241,13 @@ properties=['url', 'patchbranch']) db.security.addPermissionToRole('User', p) +def may_edit_pull_request(db, userid, itemid): + return userid == db.pull_request.get(itemid, "creator") +db.security.addPermissionToRole('User', 'Create', 'pull_request') +p = db.security.addPermission(name='Edit', klass='pull_request', + check=may_edit_pull_request, properties=['url', 'repository', 'number', 'title']) +db.security.addPermissionToRole('User', p) + class may_view_spam: def __init__(self, klassname): self.klassname = klassname @@ -292,7 +307,7 @@ properties=('title', 'type', 'components', 'versions', 'severity', - 'messages', 'files', 'nosy', 'hgrepos'), + 'messages', 'files', 'nosy', 'hgrepos', 'pull_requests'), description='User can report and discuss issues') db.security.addPermissionToRole('User', p) @@ -300,7 +315,7 @@ properties=('title', 'type', 'components', 'versions', 'severity', - 'messages', 'files', 'nosy', 'hgrepos'), + 'messages', 'files', 'nosy', 'hgrepos', 'pull_requests'), description='User can report and discuss issues') db.security.addPermissionToRole('User', p) @@ -335,7 +350,7 @@ ########################## for cl in ('issue_type', 'severity', 'component', 'version', 'priority', 'stage', 'status', 'resolution', 'issue', - 'file', 'msg', 'hgrepo'): + 'file', 'msg', 'hgrepo', 'pull_request'): db.security.addPermissionToRole('Coordinator', 'View', cl) db.security.addPermissionToRole('Coordinator', 'Edit', cl) db.security.addPermissionToRole('Coordinator', 'Create', cl) From metatracker at psf.upfronthosting.co.za Fri Nov 25 07:33:32 2016 From: metatracker at psf.upfronthosting.co.za (Maciej Szulik) Date: Fri, 25 Nov 2016 12:33:32 +0000 Subject: [Tracker-discuss] [issue586] Add GitHub Pull Request URL on issue page In-Reply-To: <1468311341.73.0.296282421587.issue586@psf.upfronthosting.co.za> Message-ID: <1480077212.51.0.654955399651.issue586@psf.upfronthosting.co.za> Maciej Szulik added the comment: Uploading final version using just the number. _______________________________________________________ PSF Meta Tracker _______________________________________________________ -------------- next part -------------- diff --git a/detectors/pull_request.py b/detectors/pull_request.py new file mode 100644 --- /dev/null +++ b/detectors/pull_request.py @@ -0,0 +1,68 @@ +# Auditor for GitHub URLs +# Check if it is a valid GitHub Pull Request URL and extract PR number + +import re + + +repo_number_re = re.compile(r'^#?(?P\d+)$') +url_re = re.compile(r'(https?:\\)?github\.com/cpython/python/(?P\d+)') + +def validate_pr_uniqueness(db, cl, nodeid, newvalues): + """ + Verifies if newly added PR isn't already attached to an issue. + This process is a 2-level action, first a pull_request object is created, which + goes through validate_pr_number to extract the PR number in case an URL is passed, + only then we validate PR uniqueness withing single issue. + """ + newprs = set(newvalues.get('pull_requests',())) + if not newprs: + return + oldprs = set() + if nodeid: + # if this is an existing issue get the list of existing prs + oldprs = set(db.issue.get(nodeid, 'pull_requests')) + newprs -= oldprs + try: + # get the newly created PR number + number = db.pull_request.get(newprs.pop(), 'number') + except KeyError: + return + # and compare with those already attached to an issue + for oldpr in oldprs: + oldnumber = db.pull_request.get(oldpr, 'number') + if number == oldnumber: + raise ValueError("GitHub PR already added to issue") + +def validate_pr_number(db, cl, nodeid, newvalues): + try: + number = extract_number(newvalues['number']) + if number: + newvalues['number'] = number + except KeyError: + pass + +def extract_number(input): + """ + Extracts PR number from the following forms: + - #number + - number + - full url + and returns its number. + """ + # try matching just the number + repo_number_match = repo_number_re.search(input) + if repo_number_match: + return repo_number_match.group('number') + # fallback to parsing the entire url + url_match = url_re.search(input) + if url_match: + return url_match.group('number') + # if nothing else raise error + raise ValueError("Unknown PR format, acceptable formats are: full github URL, #pr_number, pr_number") + + +def init(db): + db.issue.audit('create', validate_pr_uniqueness) + db.issue.audit('set', validate_pr_uniqueness) + db.pull_request.audit('create', validate_pr_number) + db.pull_request.audit('set', validate_pr_number) diff --git a/extensions/pull_request.py b/extensions/pull_request.py new file mode 100644 --- /dev/null +++ b/extensions/pull_request.py @@ -0,0 +1,11 @@ + +baseurl = 'https://github.com/cpython/python/' + +def get_pr_url(pr): + """Transforms pr into a working URL.""" + return 'PR %s' % (baseurl, pr.number, pr.title, pr.number) + + +def init(instance): + instance.registerUtil('get_pr_url', get_pr_url) + diff --git a/html/issue.item.html b/html/issue.item.html --- a/html/issue.item.html +++ b/html/issue.item.html @@ -220,6 +220,14 @@ + + + + +
Repositories containing patches
Repositories containing patches
+Pull Request - <span + i18n:name="tracker" tal:replace="config/TRACKER_NAME" /> +Pull Request + + + +

+ You are not allowed to view this page.

+ +

+ Please login with your username and password.

+ +
+ + + + + + + + + + + + + + + +
URL
Title
+   + + + + submit button here
+
+ +

+ File has been classified as spam.

+ +
+ + + +

This PR is linked to : +

+
+ + +

This PR has been unlinked from : +

+ + + + + + +
GitHub PR: + + +
@@ -273,6 +281,34 @@
+ + + + + + + + + + + + + +
Pull Requests
URLLinkedEdit
+ creator's name, + creation date + + edit + +
+ + + +
+
+

@@ -284,7 +320,7 @@ once it's done your name will have a * next to it.)

- + + + diff --git a/schema.py b/schema.py --- a/schema.py +++ b/schema.py @@ -173,6 +173,11 @@ patchbranch=String(), ) +pull_request = Class(db, "pull_request", + number=String(), + title=String(), + ) + # IssueClass automatically gets these properties in addition to the Class ones: # title = String() # messages = Multilink("msg") @@ -194,7 +199,8 @@ stage=Link('stage'), nosy_count=Number(), message_count=Number(), - hgrepos=Multilink('hgrepo')) + hgrepos=Multilink('hgrepo'), + pull_requests=Multilink('pull_request')) # # TRACKER SECURITY SETTINGS @@ -222,7 +228,7 @@ for cl in ('issue_type', 'severity', 'component', 'version', 'priority', 'stage', 'status', 'resolution', - 'issue', 'keyword', 'hgrepo'): + 'issue', 'keyword', 'hgrepo', 'pull_request'): db.security.addPermissionToRole('User', 'View', cl) db.security.addPermissionToRole('Anonymous', 'View', cl) @@ -233,6 +239,13 @@ properties=['url', 'patchbranch']) db.security.addPermissionToRole('User', p) +def may_edit_pull_request(db, userid, itemid): + return userid == db.pull_request.get(itemid, "creator") +db.security.addPermissionToRole('User', 'Create', 'pull_request') +p = db.security.addPermission(name='Edit', klass='pull_request', + check=may_edit_pull_request, properties=['number', 'title']) +db.security.addPermissionToRole('User', p) + class may_view_spam: def __init__(self, klassname): self.klassname = klassname @@ -292,7 +305,7 @@ properties=('title', 'type', 'components', 'versions', 'severity', - 'messages', 'files', 'nosy', 'hgrepos'), + 'messages', 'files', 'nosy', 'hgrepos', 'pull_requests'), description='User can report and discuss issues') db.security.addPermissionToRole('User', p) @@ -300,7 +313,7 @@ properties=('title', 'type', 'components', 'versions', 'severity', - 'messages', 'files', 'nosy', 'hgrepos'), + 'messages', 'files', 'nosy', 'hgrepos', 'pull_requests'), description='User can report and discuss issues') db.security.addPermissionToRole('User', p) @@ -335,7 +348,7 @@ ########################## for cl in ('issue_type', 'severity', 'component', 'version', 'priority', 'stage', 'status', 'resolution', 'issue', - 'file', 'msg', 'hgrepo'): + 'file', 'msg', 'hgrepo', 'pull_request'): db.security.addPermissionToRole('Coordinator', 'View', cl) db.security.addPermissionToRole('Coordinator', 'Edit', cl) db.security.addPermissionToRole('Coordinator', 'Create', cl) From metatracker at psf.upfronthosting.co.za Sun Nov 27 14:11:25 2016 From: metatracker at psf.upfronthosting.co.za (Maciej Szulik) Date: Sun, 27 Nov 2016 19:11:25 +0000 Subject: [Tracker-discuss] [issue586] Add GitHub Pull Request URL on issue page In-Reply-To: <1468311341.73.0.296282421587.issue586@psf.upfronthosting.co.za> Message-ID: <1480273885.33.0.573033844004.issue586@psf.upfronthosting.co.za> Maciej Szulik added the comment: Uploading fixed patch with Ezio's changes. _______________________________________________________ PSF Meta Tracker _______________________________________________________ -------------- next part -------------- diff --git a/detectors/pull_request.py b/detectors/pull_request.py new file mode 100644 --- /dev/null +++ b/detectors/pull_request.py @@ -0,0 +1,69 @@ +# Auditor for GitHub URLs +# Check if it is a valid GitHub Pull Request URL and extract PR number + +import re + + +repo_number_re = re.compile(r'^#?(?P\d+)$') +url_re = re.compile(r'(https?:\\)?github\.com/python/cpython/pull/(?P\d+)') + +def validate_pr_uniqueness(db, cl, nodeid, newvalues): + """ + Verifies if newly added PR isn't already attached to an issue. + This process is a 2-level action, first a pull_request object is created, which + goes through validate_pr_number to extract the PR number in case an URL is passed, + only then we validate PR uniqueness within a single issue. + """ + newprs = set(newvalues.get('pull_requests',())) + if not newprs: + return + oldprs = set() + if nodeid: + # if this is an existing issue, get the list of existing prs + oldprs = set(db.issue.get(nodeid, 'pull_requests')) + newprs -= oldprs + try: + # get the newly created PR number + number = db.pull_request.get(newprs.pop(), 'number') + except KeyError: + return + # and compare with those already attached to an issue + for oldpr in oldprs: + oldnumber = db.pull_request.get(oldpr, 'number') + if number == oldnumber: + raise ValueError("GitHub PR already added to issue") + +def validate_pr_number(db, cl, nodeid, newvalues): + try: + number = extract_number(newvalues['number']) + if number: + newvalues['number'] = number + except KeyError: + pass + +def extract_number(input): + """ + Extracts PR number from the following forms: + - #number + - number + - full url + and returns its number. + """ + # try matching just the number + repo_number_match = repo_number_re.search(input) + if repo_number_match: + return repo_number_match.group('number') + # fallback to parsing the entire url + url_match = url_re.search(input) + if url_match: + return url_match.group('number') + # if nothing else raise error + raise ValueError("Unknown PR format, acceptable formats are: " + "full github URL, #pr_number, pr_number") + + +def init(db): + db.issue.audit('create', validate_pr_uniqueness) + db.issue.audit('set', validate_pr_uniqueness) + db.pull_request.audit('create', validate_pr_number) + db.pull_request.audit('set', validate_pr_number) diff --git a/extensions/pull_request.py b/extensions/pull_request.py new file mode 100644 --- /dev/null +++ b/extensions/pull_request.py @@ -0,0 +1,11 @@ + +baseurl = 'https://github.com/python/cpython/' + +def get_pr_url(pr): + """Transforms pr into a working URL.""" + return 'PR %s' % (baseurl, pr.number, pr.title, pr.number) + + +def init(instance): + instance.registerUtil('get_pr_url', get_pr_url) + diff --git a/html/issue.item.html b/html/issue.item.html --- a/html/issue.item.html +++ b/html/issue.item.html @@ -220,6 +220,14 @@ + + + + +
Repositories containing patches
Repositories containing patches
+Pull Request - <span + i18n:name="tracker" tal:replace="config/TRACKER_NAME" /> +Pull Request + + + +

+ You are not allowed to view this page.

+ +

+ Please login with your username and password.

+ +
+ + + + + + + + + + + + + + + +
URL
Title
+   + + + submit button here
+
+ +

+ File has been classified as spam.

+ +
+ + + +

This PR is linked to : +

+
+ + +

This PR has been unlinked from : +

+ + + + + + +
GitHub PR: + + +
@@ -273,6 +281,34 @@
+ + + + + + + + + + + + + +
Pull Requests
URLLinkedEdit
+ creator's name, + creation date + + edit + +
+ + + +
+
+

@@ -284,7 +320,7 @@ once it's done your name will have a * next to it.)

- + + + diff --git a/schema.py b/schema.py --- a/schema.py +++ b/schema.py @@ -173,6 +173,12 @@ patchbranch=String(), ) +pull_request = Class(db, "pull_request", + number=String(), + title=String(), + ) +pull_request.setlabelprop('id') + # IssueClass automatically gets these properties in addition to the Class ones: # title = String() # messages = Multilink("msg") @@ -194,7 +200,8 @@ stage=Link('stage'), nosy_count=Number(), message_count=Number(), - hgrepos=Multilink('hgrepo')) + hgrepos=Multilink('hgrepo'), + pull_requests=Multilink('pull_request')) # # TRACKER SECURITY SETTINGS @@ -222,7 +229,7 @@ for cl in ('issue_type', 'severity', 'component', 'version', 'priority', 'stage', 'status', 'resolution', - 'issue', 'keyword', 'hgrepo'): + 'issue', 'keyword', 'hgrepo', 'pull_request'): db.security.addPermissionToRole('User', 'View', cl) db.security.addPermissionToRole('Anonymous', 'View', cl) @@ -233,6 +240,13 @@ properties=['url', 'patchbranch']) db.security.addPermissionToRole('User', p) +def may_edit_pull_request(db, userid, itemid): + return userid == db.pull_request.get(itemid, "creator") +db.security.addPermissionToRole('User', 'Create', 'pull_request') +p = db.security.addPermission(name='Edit', klass='pull_request', + check=may_edit_pull_request, properties=['number', 'title']) +db.security.addPermissionToRole('User', p) + class may_view_spam: def __init__(self, klassname): self.klassname = klassname @@ -292,7 +306,7 @@ properties=('title', 'type', 'components', 'versions', 'severity', - 'messages', 'files', 'nosy', 'hgrepos'), + 'messages', 'files', 'nosy', 'hgrepos', 'pull_requests'), description='User can report and discuss issues') db.security.addPermissionToRole('User', p) @@ -300,7 +314,7 @@ properties=('title', 'type', 'components', 'versions', 'severity', - 'messages', 'files', 'nosy', 'hgrepos'), + 'messages', 'files', 'nosy', 'hgrepos', 'pull_requests'), description='User can report and discuss issues') db.security.addPermissionToRole('User', p) @@ -335,7 +349,7 @@ ########################## for cl in ('issue_type', 'severity', 'component', 'version', 'priority', 'stage', 'status', 'resolution', 'issue', - 'file', 'msg', 'hgrepo'): + 'file', 'msg', 'hgrepo', 'pull_request'): db.security.addPermissionToRole('Coordinator', 'View', cl) db.security.addPermissionToRole('Coordinator', 'Edit', cl) db.security.addPermissionToRole('Coordinator', 'Create', cl) From metatracker at psf.upfronthosting.co.za Wed Nov 30 18:05:29 2016 From: metatracker at psf.upfronthosting.co.za (Ezio Melotti) Date: Wed, 30 Nov 2016 23:05:29 +0000 Subject: [Tracker-discuss] [issue586] Add GitHub Pull Request URL on issue page In-Reply-To: <1468311341.73.0.296282421587.issue586@psf.upfronthosting.co.za> Message-ID: <1480547129.2.0.221683054357.issue586@psf.upfronthosting.co.za> Ezio Melotti added the comment: I committed the latest patch with a few changes (fixed a bug in the url generation and removed the [remove] buttons) in https://hg.python.org/tracker/python-dev/rev/f2fa6e43904a I'll leave the issue open for another day in case something comes up. Thanks Anish and Maciej for the patches! ---------- assignedto: anish.shah -> ezio.melotti status: in-progress -> testing _______________________________________________________ PSF Meta Tracker _______________________________________________________
Repositories containing patches
Repositories containing patches
+Pull Request - <span + i18n:name="tracker" tal:replace="config/TRACKER_NAME" /> +Pull Request + + + +

+ You are not allowed to view this page.

+ +

+ Please login with your username and password.

+ +
+ + + + + + + + + + + + + + + +
URL
Title
+   + + + submit button here
+
+ +

+ File has been classified as spam.

+ +
+ + + +

This PR is linked to : +

+
+ + +

This PR has been unlinked from : +

+ + + + + + +