[Getan-commits] [PATCH 23 of 32] Move setting the ProjectList and EntryList instances into the controller

Wald Commits scm-commit at wald.intevation.org
Fri Oct 11 14:34:07 CEST 2013


# HG changeset patch
# User Björn Ricks <bjoern.ricks at intevation.de>
# Date 1381493523 -7200
# Node ID 27fc5f43a69ba9ceae35239c6c3589101c399376
# Parent  dc7c1a894e21312c08b220b78804165ec3e945d8
Move setting the ProjectList and EntryList instances into the controller

It doesn't make sense to pass classes for both to the GetanController
constructor. Be don't have different implementations for these classes.

diff -r dc7c1a894e21 -r 27fc5f43a69b getan/controller.py
--- a/getan/controller.py	Fri Oct 11 14:08:44 2013 +0200
+++ b/getan/controller.py	Fri Oct 11 14:12:03 2013 +0200
@@ -14,7 +14,7 @@
 
 from datetime import datetime
 
-from getan.view import GetanView
+from getan.view import GetanView, ProjectList, EntryList
 from getan.states import PausedProjectsState
 from getan.utils import format_time
 from getan.config import Config
@@ -24,10 +24,7 @@
 
 class GetanController(object):
 
-    def __init__(self, backend, pv_class, ev_class):
-        self.ev_class = ev_class
-        self.pv_class = pv_class
-
+    def __init__(self, backend):
         self.config = Config()
 
         self.backend = backend
@@ -36,8 +33,8 @@
         self.running = []
 
         self.view = None
-        self.entries_view = ev_class(entries)
-        self.project_view = pv_class(self, self.projects)
+        self.entries_view = EntryList(entries)
+        self.project_view = ProjectList(self, self.projects)
 
         self.view = GetanView(self, self.project_view, self.entries_view)
         self.state = PausedProjectsState(self, self.project_view)
diff -r dc7c1a894e21 -r 27fc5f43a69b getan/main.py
--- a/getan/main.py	Fri Oct 11 14:08:44 2013 +0200
+++ b/getan/main.py	Fri Oct 11 14:12:03 2013 +0200
@@ -20,7 +20,6 @@
 import getan.config as config
 
 from getan.backend import DEFAULT_DATABASE, Backend
-from getan.view import ProjectList, EntryList
 from getan.controller import GetanController
 
 logger = logging.getLogger()
@@ -61,7 +60,7 @@
         backend = Backend(database)
         logging.info("Use database '%s'." % database)
 
-    controller = GetanController(backend, ProjectList, EntryList)
+    controller = GetanController(backend)
 
     try:
         controller.main()


More information about the Getan-commits mailing list