Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //WITHOUT DEPENDENCY INJECTION
- class MyClass:
- def __init__():
- pass
- def Method1(self):
- if (session['key1'] == 'whatiexpect?'):
- do something
- //WITH DEPENDENCY INJECTION
- class MyClass:
- def __init__(session):
- this.session = session
- def Method1(self):
- if (this.session['key1'] == 'whatiexpect?'):
- do something
- //CALLER CLASS
- realsession = session
- var c = MyClass(realsession)
- //test
- session['key1'] = 'valuetotest'
- var c = MyClass(session)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement