def get_node(self, path, rev=None): """Return a StoreNode subclass appropriate to handle the resource at path and rev.""" # Case 1: Root if not path or path == "/": return self.root parts = path.split("/") if parts[0] == "": parts = parts[1:] # Workaround to deal with us wanting to use None revisions # in places where unicode() is used if rev == "None": rev = None if len(parts) == 1: # Case 2: /BundleName bundle = BundleNode.with_name(self, parts[0], rev) if bundle != None: return bundle # Case 3: /PackageName package = PackageNode.with_name(self, parts[0], rev) if package != None: return package else: # Case 4: /PackageName/Fully.Qualified.ClassName package = PackageNode.with_name(self, parts[-2], rev) if package != None: subnode = package.subnode_named(parts[-1]) if subnode != None: return subnode raise NoSuchNode(path, rev)
def get_entries(self): """Generator method for the PackageNodes and/or BundleNodes contained within this view of the repository. """ for bundle_name in self.bundle_names: if bundle_name == 'ALL': for bnode in BundleNode.all(self.repos): yield bnode elif bundle_name != None: yield BundleNode.with_name(self.repos, bundle_name) for package_prefix in self.package_prefixes: if package_prefix == 'ALL': for pkg in PackageNode.all(self.repos): yield pkg elif package_prefix != None: for pkg in PackageNode.named_like(self.repos, package_prefix + '%'): yield pkg