From 03d4b520bc12388564bb50aebfd7e4ba044e728a Mon Sep 17 00:00:00 2001 From: Nathan Woodrow Date: Thu, 27 Sep 2018 14:22:42 +1000 Subject: [PATCH 1/5] [FIX] - Fix typo in publish widget --- src/configmanager/ui/nodewidgets/ui_publishwidget.ui | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/configmanager/ui/nodewidgets/ui_publishwidget.ui b/src/configmanager/ui/nodewidgets/ui_publishwidget.ui index 292793670..2f28bae97 100644 --- a/src/configmanager/ui/nodewidgets/ui_publishwidget.ui +++ b/src/configmanager/ui/nodewidgets/ui_publishwidget.ui @@ -25,7 +25,7 @@ Include the projects_data folder when doing a publish - Inlcude data folder + Include data folder true From 319073f250c3fbc15facaa23039abb0b172bc4cd Mon Sep 17 00:00:00 2001 From: Nathan Woodrow Date: Thu, 27 Sep 2018 15:06:02 +1000 Subject: [PATCH 2/5] [FIX] - Remember publish data setting --- src/configmanager/ui/widgets/publishwidget.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/configmanager/ui/widgets/publishwidget.py b/src/configmanager/ui/widgets/publishwidget.py index c5793b134..2c87ac476 100644 --- a/src/configmanager/ui/widgets/publishwidget.py +++ b/src/configmanager/ui/widgets/publishwidget.py @@ -68,6 +68,7 @@ def set_data(self, data): self.dataservice = DataService(self.config) self.reload_projects() self.deployLocationText.setText(self.config.get('global_publish_path', "")) + self.includeDataCheck.setChecked(self.config.get('include_data', True)) self.refresh() def reload_projects(self): @@ -90,6 +91,7 @@ def write_config(self): projects = self.get_project_depoly_settings(True) self.config['global_publish_path'] = self.deployLocationText.text() self.config['projects'] = projects + self.config['include_data'] = self.includeDataCheck.isChecked() self.config.save() super(PublishWidget, self).write_config() From 714e85ee653c2c9bd5f9b92276a3761d826907c4 Mon Sep 17 00:00:00 2001 From: Nathan Woodrow Date: Thu, 27 Sep 2018 15:06:27 +1000 Subject: [PATCH 3/5] [FIX] - Better error handle errors in project update code --- src/roam/updater.py | 38 ++++++++++++++++++++++++++++++++++---- 1 file changed, 34 insertions(+), 4 deletions(-) diff --git a/src/roam/updater.py b/src/roam/updater.py index 36a847c0f..e61ea9e67 100644 --- a/src/roam/updater.py +++ b/src/roam/updater.py @@ -23,6 +23,10 @@ import roam.config +class UpdateExpection(Exception): + pass + + def add_slash(url): if not url.endswith("/"): url += "/" @@ -103,7 +107,16 @@ def download_file(url, fileout): Will open and write to fileout """ roam.utils.debug("Opening URL: {}".format(url)) - result = urllib2.urlopen(url) + try: + result = urllib2.urlopen(url) + except urllib2.HTTPError as ex: + if ex.code == 404: + roam.utils.warning("Can't find URL: {}".format(url)) + else: + roam.utils.exception("HTTP Error: {}".format(ex)) + yield "Error in download" + raise UpdateExpection("Error in downloading file.") + length = result.headers['content-length'] length = int(length) / 1024 / 1024 @@ -184,6 +197,13 @@ def __init__(self, basefolder): self.basefolder = basefolder self.projectUpdateStatus.connect(self.status_updated) + def check_url_found(self, url): + try: + result = urllib2.urlopen(url) + return result.code == 200 + except urllib2.HTTPError as ex: + return False + def fetch_data(self, rootfolder, filename, serverurl): """ Download the update zip file for the project from the server @@ -197,9 +217,19 @@ def fetch_data(self, rootfolder, filename, serverurl): filename = "{}.zip".format(filename) url = urlparse.urljoin(serverurl, "projects/{}".format(filename)) zippath = os.path.join(tempfolder, filename) - roam.utils.info("Downloading project zip {}".format(url)) - for status in download_file(url, zippath): - yield status + if not self.check_url_found(url): + yield "Skipping data download" + yield "Done" + return + + roam.utils.info("Downloading data zip from {}".format(url)) + try: + for status in download_file(url, zippath): + yield status + except UpdateExpection as ex: + roam.utils.exception("Error in update for project") + yield "Error in downloading data" + return yield "Extracting data.." with zipfile.ZipFile(zippath, "r") as z: From ac1649a1d849e8a2358e85c0ba9e17cff4174e70 Mon Sep 17 00:00:00 2001 From: Nathan Woodrow Date: Thu, 27 Sep 2018 15:29:46 +1000 Subject: [PATCH 4/5] [FIX] - Fix crash with info dock --- src/roam/infodock.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/roam/infodock.py b/src/roam/infodock.py index cb86d96aa..bf1cc30db 100644 --- a/src/roam/infodock.py +++ b/src/roam/infodock.py @@ -377,7 +377,8 @@ def update(self, cursor): self.deleteFeatureButton.setVisible(deletefeature) self.quickInspectButton.setVisible('inspection' in tools) self.editButton.setVisible(editattributes) - geom = cursor.feature.geometry() + feature = cursor.feature + geom = feature.geometry() geomtype = geom.type() if geomtype == QGis.Polygon and geom.isMultipart(): editgeom = False From a1c57dc3f82301c0f32d423b50bab9e49c031141 Mon Sep 17 00:00:00 2001 From: Nathan Woodrow Date: Thu, 27 Sep 2018 15:53:36 +1000 Subject: [PATCH 5/5] Dump version to 2.7.1 --- src/roam/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/roam/__init__.py b/src/roam/__init__.py index c62d82f88..f8b654f43 100644 --- a/src/roam/__init__.py +++ b/src/roam/__init__.py @@ -1,4 +1,4 @@ -NUM_VERSION = (2, 7, 0) +NUM_VERSION = (2, 7, 1) import sip import os