Re: App portability

2006-09-07 Thread Jay Parlar
On 9/7/06, Nate Straz <[EMAIL PROTECTED]> wrote: > Wow, I never knew about that syntax. I checked the Language Reference > all the way back to the 1.5 release and it is in every release. I'm > surprised I've never seen that syntax used before. > > Thank you for pointing that out. The reason yo

Re: App portability

2006-09-07 Thread Nate Straz
On Fri, Sep 08, 2006 at 03:18:22AM +0200, Daniel Poelzleithner wrote: > in myapps/views.py: > from .models import Somemodel > > which will import from myapps/models.py Somemodel > > from ..otherapp.models import Othermodel > > imports from myapps/../otherapp/models.py -> otherapps/models.py >

Re: App portability

2006-09-07 Thread Daniel Poelzleithner
Martin Glueck wrote: > Be careful ... in one of the next releases of python, support for > relative import will be dropped! So I would suggest that you don't > rely on relative import in new written code and change it whenever you > find it in old code. It will not be droped in 2.5 but it will b

Re: App portability

2006-09-07 Thread Malcolm Tredinnick
On Thu, 2006-09-07 at 03:41 +, SmileyChris wrote: > When moving an app to a different project, I had to go through and fix > all the references to my project name in code. Is there a better way to > import my code? Currently I import like: > > from projectname.appname.models import Model > >

Re: App portability

2006-09-07 Thread JP
You don't need to physically move an app from project to project to use the app in different projects. An app is just a python package. Say you have app 'foo' from project 'bar' and you want to use it in a new project, 'baz'. Install bar somewhere in your python path and then add bar.foo to the IN

Re: App portability

2006-09-07 Thread Pedro Lima
What about having a directory inside the project but also in the python path for keeping shared applications. Then just code the applications like from appname.models import Model and it's easy to move those applications between projects. Regards, Pedro --~--~-~--~~---

Re: App portability

2006-09-06 Thread Martin Glueck
> Well, as far as I know, python's import is relative. So if you're in the > module /home/gray/white.py and you say > import blue > it will first try to find blue.py in /home/gray, so design your imports > carefully. Be careful ... in one of the next releases of python, support for relativ

Re: App portability

2006-09-06 Thread Marc D.M.
On Thu, 2006-09-07 at 03:41 +, SmileyChris wrote: > When moving an app to a different project, I had to go through and fix > all the references to my project name in code. Is there a better way to > import my code? Currently I import like: > > from projectname.appname.models import Model > >

App portability

2006-09-06 Thread SmileyChris
When moving an app to a different project, I had to go through and fix all the references to my project name in code. Is there a better way to import my code? Currently I import like: from projectname.appname.models import Model It seems like this inhibits portability of apps somewhat. Perhaps t