My favorites | Sign in
Project Logo
                
Search
for
Updated Dec 11, 2007 by cstejerean
Documentation  
Documentation for using py-ioc

Introduction

Brief documentation. For more details see the code.

Installation

easy_install IoC

Usage

from IoC import *

# somewhere in your code determine which class provides which features
sl = ServiceLocator()
sl.provide("some_feature", SomeClassOfYours)


# somewhere else in your code ask for the managed requirement, it will be resolved dynamically
#
class SomeOtherClass(object):
    def __init__(self):
        self.some_feature = ManagedRequirement("some_feature")


## when you do

soc = SomeOtherClass()
soc.some_feature.blah()

# the ServiceLocator will be used to find the right implementation


Sign in to add a comment
Hosted by Google Code