For context, this project is a personal budget program I am working on while I try to learn to use MVC patterns effectively.
There is a SessionController that passes user commands to a MonthController. Each controller has a Parser that maps commands to controller methods.
Currently, the controller has a Month object as an attribute, and directly calls the model methods. It looks like this:
class MonthController(Controller): def __init__(self, budget, *args, **kwargs): Controller.__init__(self, *args, **kwargs) self.month = budget.get_current_month() def add_transaction(self, params): # get user data, do parameter validation here self.month.add_transaction(params)
Is this normal implementation of MVC? Are there pitfalls to letting the Control "own" a Model object I should look out for?
Also, I plan to have the SessionController "own" a number of Views. One of those views will also have a Month attribute (but only call read-only methods). I can't pin down why, but this feels wrong. Am I off track, or is this standard MVC?