I would suggest just adding the Root directory to sys.path during startup. I do
this in the __init__.py file of the directory that is the Webware context I am
using.


In __init__.py, you can define a function that Webware calls during AppServer
startup on each of your contexts:

def contextInitialize(app, path)
   import sys
   sys.path.append("/path/to/Root") # or possibly just the path var.

- Luke

Quoting Lethalman <[EMAIL PROTECTED]>:

(first sorry for my poor English)
Webware is the best python framework for me, great job!

This is my problem.
I'm trying to connect some psp/servlets from a subdirectory to the root
directory, but i can't import some modules.
For example:
Root/
- FyreSite.py
- index.psp
- database/
--- Config.fs
--- DB.fs
- admin/
--- Admin_Panel.py
--- index.psp

Now, when i try to get admin/index.psp i can't import the class FyreSite
from FyreSite.py and extend the PSP page for FyreSite and Admin_Panel
I'm trying to find any solution to solve this stupid problem...
This is the header of admin/index.psp:
<%@ page imports="sys,os"%>
<%
self.dir = os.path.split(os.path.split(self.serverSidePath())[0])[0]
sys.path.insert(0, self.dir)
%>
<%@ page imports="FyreSite:FyreSite"%>
<%@ page extends="FyreSite,Admin_Panel"%>
...

But it can't find the module named FyreSite... so i tried:
...
sys.path.insert(0, self.dir)
from FyreSite import FyreSite
%>
<%@ page extends="FyreSite,Admin_Panel"%>

And it doesn't work... really i would like to extend Admin_Panel to
FyreSite:
class Admin_Panel(FyreSite)

then extend admin/index.psp to Admin_Panel:
<%@ page extends="Admin_Panel"%>

But i can't extend Admin_Panel to FyreSite first because i haven't
self.serverSidePath()

Is there an alternative against copying FyreSite.py to each subdirectory
or set a prefix Admin_ to each file then bring them to the Root
directory and remove the subdirectories?

Please help me...

--
Fyrebird Hosting Provider - Technical Department



-------------------------------------------------------
This SF.Net email is sponsored by:
Sybase ASE Linux Express Edition - download now for FREE
LinuxWorld Reader's Choice Award Winner for best database on Linux.
http://ads.osdn.com/?ad_id=5588&alloc_id=12065&op=click
_______________________________________________
Webware-discuss mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/webware-discuss




-- The Pursuit of Counterfactual Histories


------------------------------------------------------- This SF.Net email is sponsored by: Sybase ASE Linux Express Edition - download now for FREE LinuxWorld Reader's Choice Award Winner for best database on Linux. http://ads.osdn.com/?ad_id=5588&alloc_id=12065&op=click _______________________________________________ Webware-discuss mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/webware-discuss

Reply via email to