i think you should create dirs in modules and add __init__.py to each
one. Then:
def load():
if session.project_a == True:
from applications.your_app.a.upload import Upload
elif session.project_b == True:
from applications.your_app.b.upload import Upload
u = Upload()
return dict(u=u)
of course you can remove doing:
def load():
Upload = __import__('applications.your_app.%s.upload' %
session.project)
u = Upload()
return dict(u=u)
and logging you has to set session.project = 'a' or 'b'
Regards.
On Aug 12, 4:38 pm, mdipierro <[email protected]> wrote:
> At this time we do not support subdirectory in controllers/
>
> Massimo
>
> On Aug 12, 11:15 am, pam <[email protected]> wrote:
>
> > I was wondering if anyone has tried to have a single application with
> > a directory structure within the main controllers folder such that
> > depending on a login option the application searches for controllers
> > out of the corresponding options controller folder.
>
> > For example:
>
> > Imagine you have 2 very similar projects with similar database
> > structures lets call them project A and project B.
> > This is what I am looking to try and create.
>
> > controllers/
> > login.py
> > A/
> > upload.py
> > home.py
> > query.py
> > B/
> > upload.py
> > home.py
> > query.py
>
> > once the user logs in specifying either project A or B all future
> > controller/function are contained with in the A and B sub-directories.
>
> > I am trying to avoid huge if/else blocks in controller code as in the
> > future I anticipate adding more projects C,D,etc.
>
> > Any ideas, Suggestions, or am I totally off my rocker ???
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"web2py-users" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/web2py?hl=en
-~----------~----~----~----~------~----~------~--~---