[PATCH 1/3] Start moving code from the controller to the logic

Pierre-Yves Chibon pingou at pingoured.fr
Wed Jan 23 12:19:09 UTC 2013


On Wed, 2013-01-23 at 06:58 -0500, Bohuslav Kabrda wrote:
> - I tend to add "user" (who is doing the operation) as argument to all
> *Logic methods, since this may be needed for some authorization
> checking etc. Although your methods don't need that, would you please
> add the argument for consistency?
> - I would prefer seeing db.session.commit() in views, not *Logic
> methods. The reason is that if you're doing three logic functions and
> each one of them commits, it's three separate DB queries - I don't
> think we want that. That might turn out to be slow (and also with
> single commit, you either do the _whole_ transaction or nothing of
> it).

Will do (for both).

> - The add_build method should use flask.g.user as a build submitted to
> be more general and usable from other views, too.

I'm not quite sure to see what you have in mind here.

From a general perspective, I would not "import flask" in the logic, as
I see it the logic should be pretty much a generic python module which
is not linked to the framework (I'm trying to prevent a coupling so
tight with the framework which might mean that changing framework =
rewrite the application).

Pierre


More information about the copr-devel mailing list