Fixes #305
A couple comments:
hubs/views
hubs/app.py
hubs/views/__init__.py
Also, I've added a before_request hook that stores the database session in the flask.g.db variable, and modified the views to use it instead of importing the session from the hubs/app.py file. I did this because otherwise the unit tests would fail when the session was imported, for the following reason: in the setUp method of the main unit test class in hubs/tests/__init__.py, the app is imported and then the session variable is replaced in hubs.app by a dummy database. However, at that point the views have already imported the session from hubs.app, and don't see the replacement, they are thus using the non-dummy database, and tests fail. Using the shared flask.g.db variable solves this problem.
before_request
flask.g.db
setUp
hubs/tests/__init__.py
hubs.app
Apart from that, I haven't changed the views.
Looks good to me.
On what basis do we break the views? either similar functionality or area of functionality right?
Currently it's a bit arbitrary, I'd say by area of functionality. I've regrouped the views that are below a hub id in the URL in the same module.
Thanks for reviewing it Sayan. I have a little improvement in the way we discover widget routes, I'll squeeze that in and merge it if it's OK with you all (it's really simple, and add a unit test, yay ;-) ).
1 new commit added
Pull-Request has been merged by abompard
:clap:
Fixes #305