I think that large python files turn difficult to read (specially if
you are contributing to the code)

Here are some recommendations for big sites/apps (in spanish) by
Martín Mulone:

http://www.slideshare.net/martinpm/web2py-pensando-en-grande-9448110

On Dec 5, 4:57 am, Ryan DowlingSoka <[email protected]> wrote:
> Hi there! I started creating a website for a game at my college with
> web2py last winter, and this winter I am cleaning up a lot of the
> things I did rushed, and making it something that others can use...
>
> IE: not so reliant on me creating one time use controllers, or going
> straight to the shell to fix things.
>
> With that in mind, my default controller has become what appears to be
> a bloated beast of a python file and I'm wondering if I am right that
> I need to do something about it, or if I should just clean it up where
> I can and keep it all together.
>
> A big part of me loves compartmentalized modules, with a couple of
> functions in each, and I feel like for what I am doing it seems weird
> that I am writing what i would consider utility functions in the
> controller that also does page logic.
>
> For example, in the game the site is for a database has to often be
> checked to see what team the user is on, this can change rapidly and
> is needed in lots of places, so I created a utility function called
> "zombieTest()" with an optional argument for an inputted id number.
>
> In my mind I want this to be in the 'modules' folder and imported in.
> In practice this raised a bit of problems for me. When I finally
> started doing just that i realized a couple of things: first off db's
> have to be passed in, so it just adds another layer to using the
> zombieTest. It seems like I would always be putting in zombieTest(db),
> and if I want to test the current user id zombieTest(db, auth)
> Or maybe always requiring auth.user.id to be passed in directly for
> the id number.
> And while I could do that it just seems like a step backwards....
>
> ...
>
> So I come to the much more experienced people at this than myself, and
> ask:
>
> "Is the default controller being around 100kb a real issue?"
> "Is it wrong to create utility like functions like the one above that
> aren't ever meant to support views in the controller?"
>
> and if so-
>
> "How do I keep similar functionality, but put them in the correct
> place, or seperate the controllers."
>
> and if not:
>
> "When should I seperate the controllers- or should I only do that for
> parts of the site that are practically seperate for eachother?"
>
> Thanks! I just realized that I might be making my life harder rather
> than easier so I thought I would ask before I go much farther.

Reply via email to