best way to handle IntegrityError with pyramid_tm

2011-05-16 Thread Eric Rasmussen
Hi everyone, I'm still coming to terms with the concept of a transaction manager (I'm using Pyramid/Akhet), and I'm not seeing a simple and universally accepted way doing two things I'd often do in Pylons: 1) Catch and handle SQLAlchemy exceptions like IntegrityError 2) Return a newly committed

Re: best way to handle IntegrityError with pyramid_tm

2011-05-16 Thread Michael Merickel
2) Return a newly committed object (for instance, if I save a new user successfully, I'd like to return that user object to the handler) You can populate your user object's pkey same as always by issuing a session.flush() after adding the object to your session. This will dump it to the

[Akhet] how do I serve my app from subdirectory?

2011-05-16 Thread Tony Schmidt
I set WSGIScriptAlias /mysubdir /path/to/my/pyramid.wsgi which works if I add that prefix to my static URLs, but my handlers don't get routed appropriately. Any tips? (I would also prefer to not have to add the subdir prefix manually to the static links in my template.) Thanks. -- You

Re: how do I serve my Pyramid/Akhet app from subdirectory?

2011-05-16 Thread Tony Schmidt
Sorry, I guess square brackets get removed in the subjects - I'm using Akhet. On May 16, 6:33 pm, Tony Schmidt tschm...@sacfoodcoop.com wrote: I set WSGIScriptAlias /mysubdir /path/to/my/pyramid.wsgi which works if I add that prefix to my static URLs, but my handlers don't get routed

Re: [Akhet] how do I serve my app from subdirectory?

2011-05-16 Thread Michael Merickel
To host a WSGI app at a subdirectory you have to do 2 things. 1) Tell apache to forward requests only for that subdirectory. This is done using the WSGIScriptAlias. 2) Tell the WSGI app that it is being hosted at a subdirectory. This is done by setting the SCRIPT_NAME parameter in the

Re: best way to handle IntegrityError with pyramid_tm

2011-05-16 Thread Eric Rasmussen
Thanks Michael -- I had a feeling it was something simple eluding me. Calling Session.flush() worked perfect. On Mon, May 16, 2011 at 4:26 PM, Michael Merickel mich...@merickel.orgwrote: 2) Return a newly committed object (for instance, if I save a new user successfully, I'd like to return

Re: 'View Only pdf file

2011-05-16 Thread Boyi Shafie
The doc is not that secret. I just don't want have an easy way to download it. I found out there are tools out there like scribd, flexpaper. I decided to use swftools and zviewer. -Sharil I. Shafie- On 06-May-2011 2:52 PM, Vincenzo Ampolo vincenzo.amp...@gmail.com wrote: On Fri, 2011-05-06 at