def __init__( self, # pylint: disable=too-many-arguments user, application_factory=None, unit_factory=None, youth_factory=None): """Dependency-injectable init Args: user: User object, used to determine permissions application_factory: Youth Application factory object unit_factory: Unit factory object youth_factory: Youth factory object """ self.user = user if application_factory: self.factory = application_factory else: self.factory = Youth.ApplicationFactory() self.persister = self.factory.get_persister() if unit_factory: self.unit_factory = unit_factory else: self.unit_factory = Unit.Factory() if youth_factory: self.youth_factory = youth_factory else: youth_factory = Youth.YouthFactory()
def __init__( self, # pylint: disable=too-many-arguments user, district_factory=None, subdistrict_factory=None, sporg_factory=None, unit_factory=None, organization_persister=None): self.user = user if district_factory: self.district_factory = district_factory else: self.district_factory = District.Factory() if subdistrict_factory: self.subdistrict_factory = subdistrict_factory else: self.subdistrict_factory = Subdistrict.Factory() if sporg_factory: self.sporg_factory = sporg_factory else: self.sporg_factory = SponsoringOrganization.Factory() if unit_factory: self.unit_factory = unit_factory else: self.unit_factory = Unit.Factory() if organization_persister: self.organization_persister = organization_persister else: self.organization_persister = Organization.Persister()