I think you are wanting the "import" command.  Do not include the  
".py" on the file name. For example, if the file is named myhandler.py  
then use:

import myhandler
myobj = myhandler.ObjectName()

Or,
from myhandler import TheObject
myobj = TheObject()

If you have code in directories by sure to include an "__init__.py"  
file in each one, it can be blank. Then to use:

from dir1.subdir2.filename import AnObject

anobj = AnObject()

Search for python modules. I think there is a section in the dive into  
python book about it.

Robert

On Dec 9, 2009, at 2:25, PatHaugen <[email protected]> wrote:

> Sorry if this seems simple, but all Google searches for 'Google App
> Engine include require PHP' or any of the variants went to websites
> complaining about lack of PHP support in GAE.
>
> Here is my question:
>
> In PHP, I use include/require to break apart code into separate files
> for simplicity and multiple developer situations. I'm at that point in
> GAE, and was wondering if there is something I could use.
>
> As an example, if GAE were PHP I'd do something like:
>
> ====
>
> main.py
> include header.py
> include datastore.py
> class MainPage(webapp.RequestHandler):
>  def get(self):
>    include mainpage.py
>  def post(self):
>    include post.py
> include footer.py
>
> footer.py
> application = webapp.WSGIApplication(...
>  etc..
> def main(): run_wsgi_app(application)
> if __name__ == "__main__": main()
>
> header.py
> import xxx
> from xxx
> etc..
>
> datastore.py
> class xxx(db.Model)..
> etc..
>
> ====
>
> Just a quick example.
>
> Thoughts?
>
> --
>
> You received this message because you are subscribed to the Google  
> Groups "Google App Engine" group.
> To post to this group, send email to google- 
> [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 
> .
>
>

--

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