@@ -188,31 +188,31 @@ def updateLayers(self):
188188 response = self .http .request (url )
189189 self .layers = json .loads (response [1 ])
190190
191- def updateSingleApplication (self , id ):
192- url = self .baseurl + "rest/applications/" + str (id )
191+ def updateSingleApplication (self , _id ):
192+ url = self .baseurl + "rest/applications/" + str (_id )
193193 response = self .http .request (url )
194194 updatedApplication = json .loads (response [1 ])
195195 for app in enumerate (self .applications ):
196- if app [1 ]["id" ] == id :
196+ if app [1 ]["id" ] == _id :
197197 self .layers [app [0 ]] = updatedApplication
198198 return updatedApplication
199199
200- def updateSingleLayer (self , id ):
201- url = self .baseurl + "rest/layers/" + str (id )
200+ def updateSingleLayer (self , _id ):
201+ url = self .baseurl + "rest/layers/" + str (_id )
202202 response = self .http .request (url )
203203 updatedLayer = json .loads (response [1 ])
204204 for layer in enumerate (self .layers ):
205- if layer [1 ]["id" ] == id :
205+ if layer [1 ]["id" ] == _id :
206206 self .layers [layer [0 ]] = updatedLayer
207207 return updatedLayer
208208
209209 # one method for retrieving user and groups permissions (permissionType)
210210 # for layers or applications (objectType)
211- def getObjectPermissions (self , id , objectType , permissionType ):
211+ def getObjectPermissions (self , _id , objectType , permissionType ):
212212 url = self .baseurl + "rest/entitypermission/Project" + objectType
213213 # objectType = 'Application' or 'Layer'
214214 # permissionType = 'User' or 'UserGroup'
215- url += "/" + str (id ) + "/Project" + permissionType + "?"
215+ url += "/" + str (_id ) + "/Project" + permissionType + "?"
216216 response = self .http .request (url )
217217 return json .loads (response [1 ])
218218
@@ -224,13 +224,13 @@ def updateExtentsAndMapConfigs(self):
224224 response = self .http .request (url )
225225 self .mapconfigs = json .loads (response [1 ])
226226
227- def getHomeviewByIds (self , mapconfigid , extentid ):
227+ def getHomeviewByIds (self , mapconfigid , extent_id ):
228228 homeview = {}
229229 for mapcf in self .mapconfigs :
230230 if mapcf ["id" ] == mapconfigid :
231231 homeview ["mapconfig" ] = mapcf
232232 for ext in self .extents :
233- if ext ["id" ] == extentid :
233+ if ext ["id" ] == extent_id :
234234 homeview ["extent" ] = ext
235235 return homeview
236236
@@ -244,14 +244,14 @@ def getLayerIdsAndNames(self, reload=False):
244244 self .updateLayers ()
245245 return [(x ["id" ], x ["name" ], x ["dataType" ], x ["source" ]) for x in self .layers ]
246246
247- def getApplicationAttrsById (self , id ):
247+ def getApplicationAttrsById (self , _id ):
248248 for x in self .applications :
249- if x ["id" ] == id :
249+ if x ["id" ] == _id :
250250 return x
251251
252- def getLayerAttrsById (self , id ):
252+ def getLayerAttrsById (self , _id ):
253253 for x in self .layers :
254- if x ["id" ] == id :
254+ if x ["id" ] == _id :
255255 return x
256256
257257 def getGroupNames (self ):
@@ -343,9 +343,9 @@ def uploadStyle(self, qgisLayerItem):
343343 def prepareIconForUpload (self , svgIconName ):
344344 svgPaths = QgsApplication .svgPaths ()
345345 svgIconPath = None
346- for dir in svgPaths :
347- if os .path .isfile (os .path .join (dir , svgIconName )):
348- svgIconPath = os .path .join (dir , svgIconName )
346+ for _dir in svgPaths :
347+ if os .path .isfile (os .path .join (_dir , svgIconName )):
348+ svgIconPath = os .path .join (_dir , svgIconName )
349349 if svgIconPath is None or not svgIconPath .endswith ("svg" ):
350350 return False
351351 name = os .path .splitext (svgIconName )[0 ]
@@ -361,8 +361,8 @@ def prepareIconForUpload(self, svgIconName):
361361 return False
362362
363363 # # NOTE: the following method is still not used:
364- # def downloadIconThumbnail(self, id ):
365- # iconPath = os.path.join(self.icondir, str(icon['id ']) + '.png')
364+ # def downloadIconThumbnail(self, _id ):
365+ # iconPath = os.path.join(self.icondir, str(icon['_id ']) + '.png')
366366 # if os.path.isfile(iconPath):
367367 # return iconPath
368368 # else:
@@ -388,8 +388,7 @@ def uploadImage(self, pathToImage):
388388 if response [0 ]["status" ] > 199 and response [0 ]["status" ] < 210 :
389389 # if icon upload was successfull, server returns id of the new icon
390390 # in it's database
391- id = json .loads (response [1 ])["data" ]["id" ]
392- return id
391+ return json .loads (response [1 ])["data" ]["id" ]
393392 else :
394393 return False
395394
@@ -448,7 +447,7 @@ def requestCrsUpdateOnLayer(self, importJobId):
448447 "&taskId=0&fileProjection=EPSG%3A3857&layerName=&dataType=Vector"
449448 )
450449 h = {"Content-type" : "application/x-www-form-urlencoded; charset=UTF-8" }
451- response = self .http .request (url , method = "POST" , body = data , headers = h )
450+ self .http .request (url , method = "POST" , body = data , headers = h )
452451
453452 def getFieldNamesFromWfs (self , layerRessourceName ):
454453 url = (
@@ -467,25 +466,25 @@ def getFieldNamesFromWfs(self, layerRessourceName):
467466 return fieldNames
468467 return False
469468
470- def deleteLayer (self , id ):
471- url = self .baseurl + "rest/projectlayers/" + str (id )
469+ def deleteLayer (self , _id ):
470+ url = self .baseurl + "rest/projectlayers/" + str (_id )
472471 response = self .http .request (url , method = "DELETE" )
473472 self .userInfo (response [0 ]["status" ], "Layer" , "deleted" )
474473
475- def deleteApplication (self , id ):
476- url = self .baseurl + "rest/projectapps/" + str (id )
474+ def deleteApplication (self , _id ):
475+ url = self .baseurl + "rest/projectapps/" + str (_id )
477476 response = self .http .request (url , method = "DELETE" )
478477 self .userInfo (response [0 ]["status" ], "Application" , "deleted" )
479478
480- def copyApplication (self , id , applicationName ):
479+ def copyApplication (self , _id , applicationName ):
481480 url = self .baseurl + "projectapps/copy.action"
482- data = "appId=" + str (id ) + "&appName=" + applicationName + "-Copy"
481+ data = "appId=" + str (_id ) + "&appName=" + applicationName + "-Copy"
483482 h = {"Content-type" : "application/x-www-form-urlencoded; charset=UTF-8" }
484483 response = self .http .request (url , method = "POST" , body = data , headers = h )
485484 self .userInfo (response [0 ]["status" ], "Application" , "copied" )
486485
487- def viewApplicationOnline (self , id ):
488- url = self .baseurl + "client/?id=" + str (id )
486+ def viewApplicationOnline (self , _id ):
487+ url = self .baseurl + "client/?id=" + str (_id )
489488 webbrowser .open (url )
490489
491490 def createLayerTreeItem (self , data ):
@@ -502,9 +501,9 @@ def updateLayerTreeItem(self, layerTreeItemId, data):
502501 response = self .http .request (url , method = "PUT" , body = body , headers = h )
503502 return response [0 ]["status" ]
504503
505- def deleteLayerTreeItem (self , layerTreeItemIdd ):
506- url = self .baseurl + "rest/layertree/" + str (layerTreeItemIdd )
504+ def deleteLayerTreeItem (self , layerTreeItemId ):
505+ url = self .baseurl + "rest/layertree/" + str (layerTreeItemId )
507506 h = {"Content-type" : "application/json" }
508- body = json .dumps ({"id" : layerTreeItemIdd })
507+ body = json .dumps ({"id" : layerTreeItemId })
509508 response = self .http .request (url , method = "DELETE" , body = body , headers = h )
510509 return response [0 ]["status" ]
0 commit comments