def id(self): if getattr(self, "_id", None): return self._id if not self._useDb: return None # avoid recursive calls. those might happen because # calcNewSongId or getSongId will again access Song attribs. if getattr(self, "_recursive_id_call", False): return None self._recursive_id_call = True import songdb self._id = songdb.getSongId(self) if not self._id: self._id = songdb.calcNewSongId(self) self._recursive_id_call = False return self._id
def id(self): if getattr(self, "_id", None): return self._id if not self._useDb: return None # avoid recursive calls. those might happen because # calcNewSongId or getSongId will again access Song attribs. if getattr(self, "_recursive_id_call", False): return None self._recursive_id_call = True try: import songdb self._id = songdb.getSongId(self) if not self._id: self._id = songdb.calcNewSongId(self) except Exception: print "errors while getting song id" import sys sys.excepthook(*sys.exc_info()) self._recursive_id_call = False return self._id