Howdy!

I'm getting odd behavior when I attempt to import a subpackage
containing all my request handlers.

First off, here's part of my app tree:
__init__.py
controller.py - Handles all requests, delegating to the sub
controllers
controllers/
    __init__.py
    about.py
    create.py
    main.py
    worker.py
    ...

As far as I'm aware controllers/ is in standard package form.
__init__.py is an empty file. The other files all have request
handlers in them. However, when I attempt something like:

import controllers
...
urls = [('/', controllers.main.Index)]

it throws "AttributeError: 'module' object has no attribute 'main'".
The weird part, for me, is that changing the import to "import
controllers.main" works just fine. Unfortunately, this means importing
every request handler for each request which seems a bit superfluous
to me.

I should also note that Komodo Edit shows auto completion when I'm
importing (e.g. "controllers.ma" offers to complete "main") but not if
I try "import controllers; controllers.ma". Although, I'm not sure
what implications that has. Additionally, I've tried adding each
submodule to __all__ in __init__, which doesn't help; importing each
submodule in __init__, which does work but has the same issue as
"import controllers.main"; "from controllers import *" which has the
same aforementioned problem; and adding each submodule to it's own
package, which doesn't work.

I would really prefer to have app.yaml direct all requests to a single
file and delegate out, but judging from this I'm not sure how
plausible that is. I appreciate any suggestions on either how to
workaround this or a better way of organizing request handlers.

Thanks for looking,
Patrick
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Google App Engine" 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/google-appengine?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to