From 0b799ea9162ef8bcfb31d65e21f42cd3ca5e526b Mon Sep 17 00:00:00 2001 From: pedohorse Date: Wed, 8 Apr 2020 23:13:43 -0400 Subject: [PATCH 1/3] typing hint added --- python2.7libs/hpaste/nethelper.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/python2.7libs/hpaste/nethelper.py b/python2.7libs/hpaste/nethelper.py index 6a602be..7bd2fe8 100644 --- a/python2.7libs/hpaste/nethelper.py +++ b/python2.7libs/hpaste/nethelper.py @@ -17,6 +17,7 @@ def read(self): def urlopen_nt(req, fallback_cert=0): + # type: (urllib2.Request, int) -> None """ wrapper around urllib2.urlopen that does not throw HTTPError and does some additional things like falling back on SSL certs @@ -26,6 +27,7 @@ def urlopen_nt(req, fallback_cert=0): """ code = -1 rep = None + # print req.get_full_url(), req.get_data(), fallback_cert try: if fallback_cert == 0: rep = urllib2.urlopen(req) From a20f7bd60788715713553e085927d9930d650f3b Mon Sep 17 00:00:00 2001 From: pedohorse Date: Wed, 8 Apr 2020 23:14:56 -0400 Subject: [PATCH 2/3] added dummy parameter "checked" to all triggers to cover qt 5.14 change --- .../hpaste/hcollections/collectionwidget.py | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/python2.7libs/hpaste/hcollections/collectionwidget.py b/python2.7libs/hpaste/hcollections/collectionwidget.py index 1180a6d..2912a53 100644 --- a/python2.7libs/hpaste/hcollections/collectionwidget.py +++ b/python2.7libs/hpaste/hcollections/collectionwidget.py @@ -449,24 +449,24 @@ def __removeItem(self,index): # TODO: why did i make it private with protected def _itemContextMenu(self, index, sidemenu): item = index.internalPointer() newaction = sidemenu.addAction('info') - newaction.triggered.connect(lambda x=index: self._itemInfo(x)) + newaction.triggered.connect(lambda checked=False, x=index: self._itemInfo(x)) if (not item.readonly()): sidemenu.addSeparator() newaction = sidemenu.addAction('rename') - newaction.triggered.connect(lambda x=index: self._renameItem(x)) + newaction.triggered.connect(lambda checked=False, x=index: self._renameItem(x)) newaction = sidemenu.addAction('change access') - newaction.triggered.connect(lambda x=index: self._changeAccess(x)) + newaction.triggered.connect(lambda checked=False, x=index: self._changeAccess(x)) newaction = sidemenu.addAction('replace content') - newaction.triggered.connect(lambda x=index: self._replaceContent(x)) + newaction.triggered.connect(lambda checked=False, x=index: self._replaceContent(x)) newaction = sidemenu.addAction('upload icon') - newaction.triggered.connect(lambda x=index: self._uploadIcon(x)) + newaction.triggered.connect(lambda checked=False, x=index: self._uploadIcon(x)) newaction = sidemenu.addAction('remove icon') - newaction.triggered.connect(lambda obj=self, x=index: obj._removeIcon(x)) + newaction.triggered.connect(lambda checked=False, obj=self, x=index: obj._removeIcon(x)) # newaction.setEnabled(False) # TODO: automatically enable stuff if subclass overrides item methods! sidemenu.addSeparator() newaction = sidemenu.addAction('remove item') - newaction.triggered.connect(lambda x=index: self.__removeItem(x)) + newaction.triggered.connect(lambda checked=False, x=index: self.__removeItem(x)) ####Slots @Slot(QPoint) @@ -484,7 +484,7 @@ def showContextMenu(self,pos): else: newaction=colmenu.addAction('add selected nodes') newaction.setData((col)) - newaction.triggered.connect(lambda x=col: self._addItem(x)) + newaction.triggered.connect(lambda checked=False, x=col: self._addItem(x)) menu.addSeparator() if(self.ui.mainView.currentIndex().isValid()): From 584825fbb530abcacc4162abe346a67ed4e681ea Mon Sep 17 00:00:00 2001 From: pedohorse Date: Wed, 8 Apr 2020 23:16:12 -0400 Subject: [PATCH 3/3] bugfix: added ver metadata to all newly created or upgraded items --- python2.7libs/hpaste/hcollections/githubcollection.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/python2.7libs/hpaste/hcollections/githubcollection.py b/python2.7libs/hpaste/hcollections/githubcollection.py index 5f1ee0c..f163ac3 100644 --- a/python2.7libs/hpaste/hcollections/githubcollection.py +++ b/python2.7libs/hpaste/hcollections/githubcollection.py @@ -294,6 +294,7 @@ def updateItemIfNeeded(self, item): item._name = newname item._meta['raw_url'] = gist['files'][newfilename]['raw_url'] item._meta['nettype'] = nettype + item._meta['ver'] = list(currentVersion) item._id = '%s@%s' % (gist['id'], newfilename) item._access = CollectionItem.AccessType.public if gist['public'] else CollectionItem.AccessType.private item._readonly = False @@ -503,6 +504,8 @@ def addItem(self,desiredName,description,content, access=CollectionItem.AccessTy newname = newfilename.split(':',1)[1] if metadata is None: metadata={} + if 'ver' not in metadata: + metadata['ver'] = list(currentVersion) metadata['raw_url'] = gist['files'][newfilename]['raw_url'] desc = gist['description'] nettype = ''