def cb(): try: callback(requests) except Exception as e: pyfalog.critical("Execution of callback from getPrices failed.") pyfalog.critical(e) db.commit()
def cb(): try: callback(requests) except Exception as e: pyfalog.critical("Callback failed.") pyfalog.critical(e) db.commit()
def cb(): try: callback(requests) except (KeyboardInterrupt, SystemExit): raise except Exception as e: pyfalog.critical("Execution of callback from getPrices failed.") pyfalog.critical(e) db.commit()
def importPatterns(self, text): lookup = {} current = self.getTargetResistsList() for pattern in current: lookup[pattern.name] = pattern imports, num = es_TargetResists.importPatterns(text) for pattern in imports: if pattern.name in lookup: match = lookup[pattern.name] match.__dict__.update(pattern.__dict__) else: db.save(pattern) db.commit() lenImports = len(imports) if lenImports == 0: raise ImportError("No patterns found for import") if lenImports != num: raise ImportError("%d patterns imported from clipboard; %d had errors" % (num, num - lenImports))
def importPatterns(self, text): lookup = {} current = self.getTargetResistsList() for pattern in current: lookup[pattern.name] = pattern imports, num = es_TargetResists.importPatterns(text) for pattern in imports: if pattern.name in lookup: match = lookup[pattern.name] match.__dict__.update(pattern.__dict__) else: db.save(pattern) db.commit() lenImports = len(imports) if lenImports == 0: raise ImportError("No patterns found for import") if lenImports != num: raise ImportError( "%d patterns imported from clipboard; %d had errors" % (num, num - lenImports))