Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
self.add_document(file_path, title, locale=self.locale)
elif self.doc_manager.is_doc_modified(relative_path, self.path):
self.update_content(relative_path)
else:
return
except KeyboardInterrupt:
for observer in self.observers:
observer.stop()
except ConnectionError:
print("Could not connect to remote server.")
restart()
except ValueError:
print(sys.exc_info()[1])
restart()
doc = self.doc_manager.get_doc_by_prop('file_name', relative_path)
if doc:
document_id = doc['id']
else:
return
if self.locale_delimiter:
try:
# curr_locale = title.split(self.locale_delimiter)[1]
# todo locale detection needs to be more robust
curr_locale = title.split(self.locale_delimiter)[-2]
fixed_locale = map_locale(curr_locale)
if fixed_locale:
print ("fixed locale: ", fixed_locale)
# self.watch_locales.add(fixed_locale)
self.detected_locales[document_id] = fixed_locale
else:
#testing
#self.polled_list.add(relative_path) #test that this doesn't break other areas of watch
#end testing
self.add_document(file_path, title, locale=self.locale)
elif self.doc_manager.is_doc_modified(relative_path, self.path):
self.update_content(relative_path)
else:
return
except KeyboardInterrupt:
for observer in self.observers:
observer.stop()
except ConnectionError:
print("Could not connect to remote server.")
restart()
except ValueError:
print(sys.exc_info()[1])
restart()
doc = self.doc_manager.get_doc_by_prop('file_name', relative_path)
if doc:
document_id = doc['id']
else:
return
if self.locale_delimiter:
try:
# curr_locale = title.split(self.locale_delimiter)[1]
# todo locale detection needs to be more robust
curr_locale = title.split(self.locale_delimiter)[-2]
fixed_locale = map_locale(curr_locale)
if fixed_locale:
print ("fixed locale: ", fixed_locale)
def handleError(self):
if self.watch:
logger.warning("Could not connect to Lingotek")
restart("Restarting watch", self.timeout)
else:
raise ConnectionFailed("Could not connect to Lingotek")
#self.update_document_action(os.path.join(self.path, fn))
#logger.info('Updating remote content: {0}'.format(fn))
try:
self.polled_list.remove(fn)
except Exception:
pass
self.update_content(fn)
except KeyboardInterrupt:
for observer in self.observers:
observer.stop()
except ConnectionError:
print("Could not connect to remote server.")
restart()
except ValueError:
print(sys.exc_info()[1])
restart()
except KeyboardInterrupt:
for observer in self.observers:
observer.stop()
except Exception as err:
restart("Error on modified: "+str(err)+"\nRestarting watch.")
def handleError(self):
if self.watch:
logger.warning("Could not connect to Lingotek")
restart("Restarting watch", self.timeout)
else:
raise ConnectionFailed("Could not connect to Lingotek")
def handleError(self):
if self.watch:
logger.warning("Could not connect to Lingotek")
restart("Restarting watch", self.timeout)
else:
raise ConnectionFailed("Could not connect to Lingotek")