Chuck Esterbrook wrote:

> I ran into a problem where an "import Foo" was picking up the Foo in 
> WebKit. Launch.py was previously tweaked to fix this but then got 
> tweaked back. However, we don't ever want "import Foo" to assume WebKit.

Because WebKit is a package, any modules in the WebKit package that call 
"import Foo" should get WebKit.Foo first.  The WebKit part is 
automatically appended.  That is why it doesn't matter in your servlets 
if you say "from WebKit import Page" or just "import Page".  Either way, 
if you look in sys.modules, you'll see WebKit.Page.


> 
> I made the following changes:
> 
> - Incorporated Geoff's path cleaning code from Cookie.py. No path 
> ending in 'webkit' or equal to '.' is kept.
> 
> - '' is always the first sys.path element.

Note that '' is not os.cwd.  '' is the directory the module calling 
"import" is in.  Therefore, you ARE including WebKit, assuming you are 
calling import from a module in the WebKit directory, or any 
subdirectory (since its a package).  So that's not what you want.

> 
> - The cur dir becomes Webware/


Why don't we eliminate this reliance on the cwd?  Why are you insisting 
on that?

> 
> - Got rid of WebwarePathLocation usage. A script always knows where 
> it's at with:
>     os.path.dirname(os.path.join(os.getcwd(), sys.argv[0]))

That might work.  Good idea.


I am not sure that everyone is on the same page on this path stuff.  
Clearly, I think I know, but so do you Chuck.  I don't like the reliance 
on CWD, because it means that you may have to do some tricks to call it 
from an init script or elsewhere.

Jay


_______________________________________________
Webware-devel mailing list
[EMAIL PROTECTED]
http://lists.sourceforge.net/lists/listinfo/webware-devel

Reply via email to