Commits

Andriy Kornatskyy  committed 12fd07c

Use factory method for session instance.

  • Participants
  • Parent commits 3d69e0c

Comments (0)

Files changed (1)

File demos/template/src/factory.py

 
     def __init__(self, context, session_name='ro'):
         self.context = context
-        self.session = sessions[session_name]
+        self.session = sessions[session_name]()
         self.repository = RepositoryFactory(self.session)
 
     def __enter__(self):
     from wheezy.core.db import NullSession
     from membership.repository.mock import MembershipRepository \
         as MembershipPersistence
-    sessions = {'ro': NullSession(), 'rw': NullSession()}
+    sessions = {'ro': NullSession, 'rw': NullSession}
 else:
     raise NotImplementedError(mode)
 del mode