Sergio Duran wrote:
I've been using Webware for some weeks and after some minor debugging I
found I'd like the servlets to have a cwd set to their own local path, I
know it's not suggested, since multiple calls to the servlet or
different servlets would make the webware server to be constantly
changing dirs, but I don't really know the implications, what's the best
solution around this?

Nope, you can't do that. It's not just because you'll be changing around all the time -- rather, two servlets will often be running at exactly the same time, and there's only one cwd.


for example, i have a context and it has a file named test.txt, I'd be
easier to just use, for example, open('test.txt', 'r'), but the server
is not working on that dir so It wont find the file, the normal solution
would be addding something like
os.path.join(os.path.dirname(self.serverSidePath()),'test.txt'), but if
I ever need to deal with lots of files in some dir inside my context,
I'd have to create a function to return (or store) that path, and use
it, I'd love to be able to just open('test.txt') directly, would that be
possible?

I would recommend you add methods to your SitePage, like an open method, that does what you want. Or perhaps a path method, so it would be open(self.path('test.txt')).


There's something else I'd like to ask, do I have to flock() the files,
shelves and/or pickles I use under a Webware servlet?

Typically in Webware we use thread locks in these cases (i.e., threading.Lock) instead of flock. But it depends on your usage -- there's no magic bullet for concurrency issues. flock would probably be safer.


Often I use a combination of ParamFactory and a per-instance lock. ParamFactory is at:
http://cvs.sourceforge.net/viewcvs.py/*checkout*/webware-sandbox/Sandbox/ianbicking/ParamFactory.py?content-type=text%2Fplain&rev=1.2


  Ian


------------------------------------------------------- This SF.Net email is sponsored by the new InstallShield X.
From Windows to Linux, servers to mobile, InstallShield X is the one
installation-authoring solution that does it all. Learn more and
evaluate today! http://www.installshield.com/Dev2Dev/0504
_______________________________________________
Webware-devel mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/webware-devel

Reply via email to