Neil Schemenauer wrote: > On Thu, Jan 02, 2003 at 02:19:09PM -0500, Tom Jenkins wrote: > >>For example, one thing i really like in Zope is the getUser() call. >>This will load the user info from the db into a user instance. we use >>exUserFolder and store our users in postgresql. Now where or how >>would i do that in quixote. > > > I'm guessing you want sessions. When you have sessions working then you > probably want get_user(). You can import it directly from the Quixote > package (eg. "from quixote import get_user"). It's a trivial function > that basically returns request.session.user. > heh, google's good except when it doesn't read one's mind. I didn't see the get_user() method... hrmm quixote's small enough that i probably should read all the source > We are trying to put together an open source library for building > application on top of Quixote using ZODB as the database. The this would be cool. as long as you weren't designing, say, a CMF library > >>What about persistent database connections? What's the best way to >>manage this? > > > I'm not sure I understand your question. We use mod_scgi to connect > Apache to our application server. There are typically between 1 and 5 > instances of the server running. Each process opens a database > connection when it starts and keeps it open while handling requests. > The only time connections are closed is when the server is shutdown. > ah i was thinking along different lines. i have a database connection, should i : - have a db connection instance in a module that everybody imports? - do i subclass Publisher (say) and add get_dbconn() so you can do get_publisher().get_dbconn()? - do i throw the db connection into request and grab it from there? - something else which i can't think of? please note, these are off the cuff and may be stupid. Now I can sit and analyze them and conclude that the first one is probably the best way. or i could be wrong. it might not be a best practice in quixote. but i wouldn't know simply because there isn't anything in place to facilitate communication. now how about this scenario: I have a Department that has a list of Agencies. In some AgencyUI we need some information from Department. The url is myapp/department/1/agency/5/showSomeInfo. In Zope we'd use acquisition to call the right methods from the department to which the specific agency belongs (well actually in zope the above would be a pita to get right). To paraphrase Jim Fulton, "acquisition is cool, until it isn't". How do I handle it here? I've traversed department and so have instantiated the department 1. now down to agency and instantiating agency 5. hrmmm... how can i get access to department 1? should i: - have the department handle instantiating the agencies but then how will it know which one to instantiate? - throw the department instance into the request variable (gotta love that!) and have the agency.py's _q_getname(request) function pull it out when it instantiates the agency? - something else which i can't think of? maybe somebody has solved this. maybe somebody hasn't. i chose the request way. is it the best way? dunno with the little bit that I've done, quixote has really impressed me. it looks to be exactly what i want; publish python objects on the web. my hat is off to you guys; this is good stuff. my original post was not so much a "hey can somebody answer this" type of post. it was meant to be more of a "what i would love to see is more ways to communicate, to build the community, is there someplace i'm missing where snippets, scripts, hints, lessons learned, traps, etc are stored" type of message. btw, if anybody's interested i hang out on irc.freenode.net (used to be openprojects.org) in the #quixote channel. and if you got this far, thanks alot for wading through the ramblings of a zope user trying to get clean. -- Tom Jenkins Development InfoStructure http://www.devis.com