def find_object(self, url): """Find object with URI @url and select it in the first pane""" sc = GetSourceController() qf = qfurl.qfurl(url=url) found = qf.resolve_in_catalog(sc.sources) if found and not found == self.source_pane.get_selection(): self._insert_object(SourcePane, found)
def get_unique_id(obj): if obj is None: return None if hasattr(obj, "qf_id"): return str(qfurl.qfurl(obj)) if getattr(obj, SERIALIZABLE_ATTRIBUTE, None) is not None: try: return SerializedObject(obj) except pickle.PicklingError, exc: pretty.print_error(__name__, type(exc).__name__, exc) return None
def _find_obj_in_catalog(puid, catalog): if puid.startswith(qfurl.QFURL_SCHEME): qfu = qfurl.qfurl(url=puid) return qfu.resolve_in_catalog(catalog) for src in catalog: if _is_currently_excluding(src): continue with _exclusion(src): for obj in src.get_leaves(): if repr(obj) == puid: return obj return None
def get_qfurl(leaf): try: return qfurl.qfurl(leaf) except qfurl.QfurlError: pass