def unlinkSprint(self, sprint): """See ISpecification.""" from lp.blueprints.model.sprintspecification import ( SprintSpecification) for sprint_link in self.sprint_links: # sprints have unique names if sprint_link.sprint.name == sprint.name: SprintSpecification.delete(sprint_link.id) return sprint_link
def linkSprint(self, sprint, user): """See ISpecification.""" from lp.blueprints.model.sprintspecification import ( SprintSpecification) for sprint_link in self.sprint_links: # sprints have unique names if sprint_link.sprint.name == sprint.name: return sprint_link sprint_link = SprintSpecification(specification=self, sprint=sprint, registrant=user) if sprint.isDriver(user): sprint_link.acceptBy(user) return sprint_link
def getSpecificationLink(self, speclink_id): """See `ISprint`. NB: we expose the horrible speclink.id because there is no unique way to refer to a specification outside of a product or distro context. Here we are a sprint that could cover many products and/or distros. """ speclink = SprintSpecification.get(speclink_id) assert (speclink.sprint.id == self.id) return speclink
def unlinkSpecification(self, spec): """See `ISprint`.""" for speclink in self.spec_links: if speclink.spec.id == spec.id: SprintSpecification.delete(speclink.id) return speclink
def linkSpecification(self, spec): """See `ISprint`.""" for speclink in self.spec_links: if speclink.spec.id == spec.id: return speclink return SprintSpecification(sprint=self, specification=spec)