Just Launched: You can now import projects and releases from Google Code onto SourceForge
We are excited to release new functionality to enable a 1-click import from Google Code onto the Allura platform on SourceForge. You can import tickets, wikis, source, releases, and more with a few simple steps. Read More
T.J. Jankun-Kelly wrote:
> Question 1: New Sessions
> In the middle of a transaction, I occasionally have the need to force
> a new session to be created to replace the current session.
> Invalidating the session and then calling session again does not work
> since it always returns the (invalidated) session. Neither does
> setting the current session to None (via Transaction.setSession) and
> then requesting a new session (similar problem). Any suggestions?
If you're willing to live with the same session object with the same session
ID, you can clear all values out of the session with
self.session().values().clear(). I use this and it works fine.
> Question 2: Long Tasks
> Someone has probably asked this one before, but I could not find an
> answer (see question 4). Occasionally, I perform a long operation on
> the app server. If I wait around for the response, the HTML page
> returns "timeout" or "client reset by peer" messages. What is the
> Webware-ish approach to solving this problem?
One approach is to start a separate thread to do the operation (either using
TaskKit or just the built-in threading module), and have the servlet refresh
itself periodically, monitoring the status of the task until it is done. If
you search the archives (see below) you might find some code samples, since
I know this has been asked before. Also, check the Webware Wiki if you
> Question 3: Threading
> I have not found a good description of how Webware uses its various
> threads. My main question is this: I have on part of code that has
> have only one thread in it at a time (i.e., if two clients connect to
> the app server, only one can be using this object at a time). Again,
> what is the Webware-ish approach to this?
Create a global threading.RLock object at module level, and lock/unlock it
around that code:
mylock = threading.RLock()
<code that must only run in one thread at a time>
> Question 4: Searching
> This is not a Webware question per se, more of one on the mailing
> list. I cannot find the search functionality for the
> webware-discuss mailing
> list from the SF page. I think some of my questions may have been
> addressed before, so searching would be preferred. Can someone point
> me to this?
There's a search box on the left side of the page.