Skip to content

Commit 2d169bd

Browse files
committed
cleanup
1 parent 25e8701 commit 2d169bd

File tree

1 file changed

+8
-6
lines changed

1 file changed

+8
-6
lines changed

src/pyff/resource.py

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,7 @@ def i_handle(self, t, url=None, response=None, exception=None, last_fetched=None
117117
else:
118118
self.icon_store.update(url, None, info=dict(exception=exception))
119119
except BaseException as ex:
120-
log.warn(ex)
120+
log.warning(ex)
121121

122122

123123
class ResourceHandler(URLHandler):
@@ -135,7 +135,7 @@ def i_handle(self, t, url=None, response=None, exception=None, last_fetched=None
135135
children = t.parse(lambda u: response)
136136
self.i_schedule(children)
137137
except BaseException as ex:
138-
log.warn(ex)
138+
log.warning(ex)
139139
t.info['Exception'] = ex
140140

141141

@@ -299,11 +299,13 @@ def load_backup(self):
299299
if config.local_copy_dir is None:
300300
return None
301301

302+
log.warning(
303+
"Got status={:d} while getting {}. Attempting fallback to local copy.".format(r.status_code, self.url)
304+
)
302305
try:
303306
return resource_string(self.local_copy_fn)
304-
log.warn("Got status={:d} while getting {}. Fallback to local copy.".format(r.status_code, self.url))
305307
except IOError as ex:
306-
log.warn(
308+
log.warning(
307309
"Caught an exception trying to load local backup for {} via {}: {}".format(
308310
self.url, self.local_copy_fn, ex
309311
)
@@ -315,7 +317,7 @@ def save_backup(self, data):
315317
try:
316318
safe_write(self.local_copy_fn, data, True)
317319
except IOError as ex:
318-
log.warn("unable to save backup copy of {}: {}".format(self.url, ex))
320+
log.warning("unable to save backup copy of {}: {}".format(self.url, ex))
319321

320322
def load_resource(self, getter):
321323
data: Optional[str] = None
@@ -349,7 +351,7 @@ def load_resource(self, getter):
349351

350352
except IOError as ex:
351353
if self.local_copy_fn is not None:
352-
log.warn("caught exception from {} - trying local backup: {}".format(self.url, ex))
354+
log.warning("caught exception from {} - trying local backup: {}".format(self.url, ex))
353355
data = self.load_backup()
354356
if data is not None and len(data) > 0:
355357
info['Reason'] = "Retrieved from local cache because exception: {}".format(ex)

0 commit comments

Comments
 (0)