Re: Turbogears now based on Pylons!

2007-06-29 Thread Noah Gift
On 6/29/07, Mike Orr [EMAIL PROTECTED] wrote: On 6/28/07, Noah Gift [EMAIL PROTECTED] wrote: I am pretty sure Turbogears riding on Pylons will be on a vengeance to document things correctly and not just the API, but usage scenarios for everything. Joining forces will make a big

Re: Turbogears now based on Pylons!

2007-06-29 Thread Noah Gift
On 6/29/07, Mike Orr [EMAIL PROTECTED] wrote: On 6/29/07, Noah Gift [EMAIL PROTECTED] wrote: Yes, this is really exciting stuff. I vote we capitalize on the energy will it is hot and start making subprojects and delegating things. One excellent strategy is to use community user groups

Re: Turbogears now based on Pylons!

2007-06-28 Thread Mike Orr
On 6/27/07, Michael Bayer [EMAIL PROTECTED] wrote: Of course the engine must be initialized before any tables can be defined or any work done. since ive seen people get the wrong idea about this, let me reiterate: *you can define all your tables and mappers with no database connection

Re: Turbogears now based on Pylons!

2007-06-28 Thread Mike Orr
On 6/27/07, Uwe C. Schroeder [EMAIL PROTECTED] wrote: if you really want COMMIT for every SELECT, i'd favor it being enabled via an option passed to create_engine(). Not every select, every transaction that didn't roll back. I just think the default of rollback on every transaction is

Re: Turbogears now based on Pylons!

2007-06-28 Thread Uwe C. Schroeder
On Wednesday 27 June 2007, Mike Orr wrote: On 6/27/07, Uwe C. Schroeder [EMAIL PROTECTED] wrote: if you really want COMMIT for every SELECT, i'd favor it being enabled via an option passed to create_engine(). Not every select, every transaction that didn't roll back. I just think

Re: Turbogears now based on Pylons!

2007-06-28 Thread Wichert Akkerman
Previously Michael Bayer wrote: On Jun 27, 6:42 pm, Ian Bicking [EMAIL PROTECTED] wrote: The way I see this working is something like (vaguely): def transaction_middleware(app): def wrapper(environ, start_response): manager = TransactionManager()

Re: Turbogears now based on Pylons!

2007-06-28 Thread Uwe C. Schroeder
On Thursday 28 June 2007, Mike Orr wrote: And this. If you have a 50-column table, by gosh SQLAlchemy is going to select all 50 fields in full `TableName`.columnName AS columnName notation, which makes the query hard to read in the log. M - a 50 column table? My old CS teacher will

Re: Turbogears now based on Pylons!

2007-06-28 Thread Jonathan LaCour
Michael Bayer wrote: im not exactly sure why Jonathan thinks that the url forces one to define my connection up front. if youre saying, i want to distribute the application without an .ini file thats fine...but when the thing is actually *used*, there will be an .ini file or other

Re: Turbogears now based on Pylons!

2007-06-28 Thread Jonathan LaCour
Michael Bayer wrote: just to clarify, however this works, it should be *really easy* for individual controller methods to be marked as transactional or not. I have written decorators like these already, in the style of: class MyController(...): def index_page(self): .

Re: Turbogears now based on Pylons!

2007-06-28 Thread Michael Bayer
On Jun 28, 1:40 am, Uwe C. Schroeder [EMAIL PROTECTED] wrote: On Wednesday 27 June 2007, Michael Bayer wrote: this issue can be worked around by using explicit transactions. actually no, it can't. Maybe I don't get it right, but the only way for me to get a commit was actually to modify

Re: Turbogears now based on Pylons!

2007-06-28 Thread Michael Bayer
On Jun 28, 2:09 am, Mike Orr [EMAIL PROTECTED] wrote: I would probably want this optional URI in a subclass rather than in SAContext itself. The reason 'uri' is a required argument is to guarantee that the default engine is initialized at all times. When we designed SAContext we (Mike

Re: Turbogears now based on Pylons!

2007-06-28 Thread Michael Bayer
On Jun 27, 5:56 pm, Ian Bicking [EMAIL PROTECTED] wrote: * Way for a library to get the transaction manager. * Interface for that transaction manager, maybe copied from Zope. * Single convention for how to specify a database connection (ideally string-based). * Probably a way to get the

Re: Turbogears now based on Pylons!

2007-06-28 Thread Michael Bayer
On Jun 28, 2007, at 9:58 AM, Jonathan LaCour wrote: Michael Bayer wrote: just to clarify, however this works, it should be *really easy* for individual controller methods to be marked as transactional or not. I have written decorators like these already, in the style of: class

Re: Turbogears now based on Pylons!

2007-06-28 Thread Jonathan LaCour
Michael Bayer wrote: the way this idea works is that if some wrapping component knows it needs a transaction, it opens one. then the controller method participates in that transaction, regardless of whether or not its marked as @transactional. Of course, that makes complete sense. As long

Re: Turbogears now based on Pylons!

2007-06-28 Thread Ian Bicking
Michael Bayer wrote: On Jun 27, 6:42 pm, Ian Bicking [EMAIL PROTECTED] wrote: The way I see this working is something like (vaguely): def transaction_middleware(app): def wrapper(environ, start_response): manager = TransactionManager() environ['transaction.manager']

Re: Turbogears now based on Pylons!

2007-06-28 Thread Michael Bayer
On Jun 28, 11:46 am, Ian Bicking [EMAIL PROTECTED] wrote: So as middleware I think it should be fine. If you want to catch a problem with the commit and handle it gracefully, I think you can just do your own commit in your code (and the middleware commit will just commit what little

Re: Turbogears now based on Pylons!

2007-06-28 Thread Alberto Valverde
On Jun 28, 2007, at 12:42 AM, Ian Bicking wrote: Jonathan LaCour wrote: Ian Bicking wrote: Personally I'd like to see something a bit different: * Way for a library to get the transaction manager. * Interface for that transaction manager, maybe copied from Zope. * Single convention for

Re: Turbogears now based on Pylons!

2007-06-28 Thread Jonathan LaCour
Alberto Valverde wrote: I'd like to add here that I've got use-cases for the transaction boundary and session initialization being closer to the server than what the __before__ and __after__ hooks provide. For example, the authentication function I feed to AuthKit which uses a DB

Re: Turbogears now based on Pylons!

2007-06-28 Thread Ian Bicking
Alberto Valverde wrote: On Jun 28, 2007, at 12:42 AM, Ian Bicking wrote: Jonathan LaCour wrote: Ian Bicking wrote: Personally I'd like to see something a bit different: * Way for a library to get the transaction manager. * Interface for that transaction manager, maybe copied from

Re: Turbogears now based on Pylons!

2007-06-28 Thread Alberto Valverde
On Jun 28, 2007, at 7:33 PM, Jonathan LaCour wrote: Alberto Valverde wrote: I'd like to add here that I've got use-cases for the transaction boundary and session initialization being closer to the server than what the __before__ and __after__ hooks provide. For example, the

Re: Turbogears now based on Pylons!

2007-06-28 Thread Alberto Valverde
On Jun 28, 2007, at 7:45 PM, Ian Bicking wrote: Alberto Valverde wrote: On Jun 28, 2007, at 12:42 AM, Ian Bicking wrote: Jonathan LaCour wrote: Ian Bicking wrote: Personally I'd like to see something a bit different: * Way for a library to get the transaction manager. * Interface

Re: Turbogears now based on Pylons!

2007-06-28 Thread Uwe C. Schroeder
On Thursday 28 June 2007, Michael Bayer wrote: On Jun 28, 1:40 am, Uwe C. Schroeder [EMAIL PROTECTED] wrote: On Wednesday 27 June 2007, Michael Bayer wrote: this issue can be worked around by using explicit transactions. actually no, it can't. Maybe I don't get it right, but the only

Re: Turbogears now based on Pylons!

2007-06-28 Thread Mike Orr
On 6/28/07, Jonathan LaCour [EMAIL PROTECTED] wrote: 3. Either some middleware or just a few lines inside the BaseController of the TurboGears template that starts a transaction on every request and puts it into the transaction manager. And, in my opinion, items #1 and #2

Re: Turbogears now based on Pylons!

2007-06-28 Thread Alberto Valverde
On Jun 28, 2007, at 8:52 PM, Mike Orr wrote: On 6/28/07, Jonathan LaCour [EMAIL PROTECTED] wrote: 3. Either some middleware or just a few lines inside the BaseController of the TurboGears template that starts a transaction on every request and puts it into the

Re: Turbogears now based on Pylons!

2007-06-28 Thread Noah Gift
On 6/28/07, Alberto Valverde [EMAIL PROTECTED] wrote: On Jun 28, 2007, at 8:52 PM, Mike Orr wrote: On 6/28/07, Jonathan LaCour [EMAIL PROTECTED] wrote: 3. Either some middleware or just a few lines inside the BaseController of the TurboGears template that starts a

Re: Turbogears now based on Pylons!

2007-06-28 Thread Jonathan LaCour
Mike Orr wrote: ... and available to non-TG Pylons applications. The @transactional decorator sounds like a good idea, possibly with a False flag if the default is transactional. Agreed. This is a good point to ask, how will the TG template differ from the standard Pylons template? Will

Re: Turbogears now based on Pylons!

2007-06-28 Thread Mike Orr
On 6/28/07, Jonathan LaCour [EMAIL PROTECTED] wrote: The TurboGears template, as of right now, is basically the same as a Pylons template, only it includes a default route to a special WSGIController subclass called TurboGearsController that implements all sorts of nice things, like

Re: Turbogears now based on Pylons!

2007-06-28 Thread Jonathan LaCour
Mike Orr wrote: So if i want to use this for all URLs under a certain prefix, I would direct the route to my subclass of TurboGearsController, using action route (always?). Well, thats the idea. It needs lots of love and testing, though. Line 66 (object_dispatch) returns my TG action

Re: Turbogears now based on Pylons!

2007-06-28 Thread Noah Gift
On 6/28/07, Jonathan LaCour [EMAIL PROTECTED] wrote: Mike Orr wrote: So if i want to use this for all URLs under a certain prefix, I would direct the route to my subclass of TurboGearsController, using action route (always?). Well, thats the idea. It needs lots of love and testing,

Re: Turbogears now based on Pylons!

2007-06-28 Thread Michael Bayer
On Jun 28, 2:32 pm, Uwe C. Schroeder [EMAIL PROTECTED] wrote: If I could figure out how, I probably would. The code from the docs doesn't work, because TG does something around that. I guess one of the major drawbacks of TG is it's documentation (or lack thereof) when it comes to using SA

Re: Turbogears now based on Pylons!

2007-06-28 Thread Michael Bayer
On Jun 28, 2:01 pm, Alberto Valverde [EMAIL PROTECTED] wrote: One problem I see is that this might cause trouble in cases like this: Request | V db transaction middleware - creates session A | V authentication middleware - authenticates user and keeps ref to User

Re: Turbogears now based on Pylons!

2007-06-28 Thread Noah Gift
drawbacks of TG is it's documentation (or lack thereof) when it comes to using SA together with it. I actually asked Michael Bayer a couple of dumb questions as result of not knowing what the controller did in a SQLAlchemy turbogears project. I am glad I wasn't the only one who was

Re: Turbogears now based on Pylons!

2007-06-28 Thread [EMAIL PROTECTED]
For me TG on Pylons would be a set of similar packages-components that make thinks easier and quicker - wrappers for various backends (tg-user for authkit and others) - set of helpers (toscawidgets, webhelpers) --~--~-~--~~~---~--~~ You received this message

Re: Turbogears now based on Pylons!

2007-06-28 Thread Uwe C. Schroeder
Funny you mention Twisted. May app is actually Twisted based - and yes, I agree. I had some good (and some bad) experiences with Glyph emailing back and forth to get things resolved :-) On Thursday 28 June 2007, Noah Gift wrote: drawbacks of TG is it's documentation (or lack thereof) when

Re: Turbogears now based on Pylons!

2007-06-28 Thread Mike Orr
On 6/28/07, Noah Gift [EMAIL PROTECTED] wrote: I am pretty sure Turbogears riding on Pylons will be on a vengeance to document things correctly and not just the API, but usage scenarios for everything. Joining forces will make a big difference. TG and Pylons combined probably account for

Turbogears now based on Pylons!

2007-06-27 Thread Spider
And in breaking news ... Jonathan LaCour writing at http://cleverdevil.org/ says : This past weekend, Mark Ramm and I held a sprint to experiment on implementing a TurboGears like API on top of the excellent Pylons web framework. The sprint was hugely successful, and as a result, TurboGears 2.0

Re: Turbogears now based on Pylons!

2007-06-27 Thread anderbubble
I couldn't be happier with this news. I've been using TurboGears for almost a year now, and had been frustrated with the stagnation in development and the myriad of Python web frameworks. I'm glad to see two of the top contenders combining, rather than duplicating, their efforts. Keep up the

Re: Turbogears now based on Pylons!

2007-06-27 Thread Mark Ramm
I couldn't be happier with this news. I've been using TurboGears for almost a year now, and had been frustrated with the stagnation in development and the myriad of Python web frameworks. I'm glad to see two of the top contenders combining, rather than duplicating, their efforts. Pylons

Re: Turbogears now based on Pylons!

2007-06-27 Thread Mike Orr
[checking my watch] It's not April 1st so this must be true. Reminds me of ZDjangoGears and the joke that ultimately became Parrot. This is great news for Python web interpoerability! Pylons users will benefit from having access to a TG-style dispatcher and decorators for validation, JSON,

Re: Turbogears now based on Pylons!

2007-06-27 Thread Mark Ramm
It's proven trivial to drop SAContext into an existing Pylons application (one variable definition and two search-and-replaces) so I expect the same will be true for TG applications. Yea, Jonathan has stuff to talk to you about. I think SAContext could be pretty easily modified to meet his

Re: Turbogears now based on Pylons!

2007-06-27 Thread Ian Bicking
Mark Ramm wrote: I'd like there to be an entry point for database engines (SA, SO, DejaVu, or whatever) that offer a very minimal set of functions in a database agnostic way. * connect * start_transaction * end_transaction * rollback Personally I'd like to see something a bit different:

Re: Turbogears now based on Pylons!

2007-06-27 Thread Jonathan LaCour
Ian Bicking wrote: Personally I'd like to see something a bit different: * Way for a library to get the transaction manager. * Interface for that transaction manager, maybe copied from Zope. * Single convention for how to specify a database connection (ideally string-based). * Probably

Re: Turbogears now based on Pylons!

2007-06-27 Thread Noah Gift
On 6/27/07, Jonathan LaCour [EMAIL PROTECTED] wrote: Ian Bicking wrote: Personally I'd like to see something a bit different: * Way for a library to get the transaction manager. * Interface for that transaction manager, maybe copied from Zope. * Single convention for how to specify a

Re: Turbogears now based on Pylons!

2007-06-27 Thread Ian Bicking
Jonathan LaCour wrote: Ian Bicking wrote: Personally I'd like to see something a bit different: * Way for a library to get the transaction manager. * Interface for that transaction manager, maybe copied from Zope. * Single convention for how to specify a database connection (ideally

Re: Turbogears now based on Pylons!

2007-06-27 Thread Mike Orr
On 6/27/07, Mark Ramm [EMAIL PROTECTED] wrote: Yea, Jonathan has stuff to talk to you about. I think SAContext could be pretty easily modified to meet his needs. (He wants to share models between Pylons and other command line tools), but I think that's a use case we should try to address

Re: Turbogears now based on Pylons!

2007-06-27 Thread Jonathan LaCour
Ian Bicking wrote: The way I see this working is something like (vaguely): def transaction_middleware(app): def wrapper(environ, start_response): manager = TransactionManager() environ['transaction.manager'] = manager try: app_iter =

Re: Turbogears now based on Pylons!

2007-06-27 Thread Mike Orr
On 6/27/07, Jonathan LaCour [EMAIL PROTECTED] wrote: Ian Bicking wrote: Personally I'd like to see something a bit different: * Way for a library to get the transaction manager. * Interface for that transaction manager, maybe copied from Zope. * Single convention for how to specify a

Re: Turbogears now based on Pylons!

2007-06-27 Thread Mike Orr
On 6/27/07, Jonathan LaCour [EMAIL PROTECTED] wrote: Okay, I am mostly with you, but then you end up with a lot of boilerplate elsewhere wherever you start a transaction and throw it into the manager. I think we can address this in the TurboGears pylons template somehow and automatically

Re: Turbogears now based on Pylons!

2007-06-27 Thread Mark Ramm
It sounds like Pylons and TurboGears have very different paradigms about how transactions are handled. I can't do a side-by-side comparison, because I am not 100% clear on an example of the right way to handle transactions in Pylons. But I can describe what TurboGears 1.0 does. TG currently

Re: Turbogears now based on Pylons!

2007-06-27 Thread Uwe C. Schroeder
On Wednesday 27 June 2007, Mark Ramm wrote: It sounds like Pylons and TurboGears have very different paradigms about how transactions are handled. I can't do a side-by-side comparison, because I am not 100% clear on an example of the right way to handle transactions in Pylons. But I can

Re: Turbogears now based on Pylons!

2007-06-27 Thread Michael Bayer
I hadn't heard of DejaVu until now. One issue with SQLAlchemy is connect/rollback are buried in the SQL and ORM APIs, so I'm not sure how useful it would be to shoehorn them into this API which is out of band from the controller code. just to clarify, not really. the entire point of

Re: Turbogears now based on Pylons!

2007-06-27 Thread Michael Bayer
On Jun 27, 8:24 pm, Uwe C. Schroeder [EMAIL PROTECTED] wrote: And on that note: if you're using SA with TG, SA issues a rollback on every transaction that is not an insert or update. So if you're having a stored procedure (which you trigger with select * from stored_proc() and that stored

Re: Turbogears now based on Pylons!

2007-06-27 Thread Michael Bayer
On Jun 27, 6:42 pm, Ian Bicking [EMAIL PROTECTED] wrote: The way I see this working is something like (vaguely): def transaction_middleware(app): def wrapper(environ, start_response): manager = TransactionManager() environ['transaction.manager'] = manager

Re: Turbogears now based on Pylons!

2007-06-27 Thread Michael Bayer
On Jun 27, 7:44 pm, Mike Orr [EMAIL PROTECTED] wrote: The normal Pylons strategy is to clear the SQLAlchemy session in the base controller before calling the action method. This is effectively a rollback, but since all the changes are in memory and haven't been compiled to SQL yet, no

Re: Turbogears now based on Pylons!

2007-06-27 Thread Uwe C. Schroeder
On Wednesday 27 June 2007, Michael Bayer wrote: On Jun 27, 8:24 pm, Uwe C. Schroeder [EMAIL PROTECTED] wrote: And on that note: if you're using SA with TG, SA issues a rollback on every transaction that is not an insert or update. So if you're having a stored procedure (which you trigger