Handling Beaker Duplicate entry IntegrityErrors

2008-02-08 Thread Robert Ian Smit
When two requests for the same namespace come in at the same time, this can lead to duplicate entries since both requests will try to do an INSERT. Can this exception be handled in Beaker in a next version or should I handle the exception in my code? Regards, Bob

Re: Beaker ext.database config

2007-10-28 Thread Robert Ian Smit
During the upgrade to the current version of Pylons (0.9.6.1) and Beaker (0.8) db-based session and cache handling broke. I had thought that just url should be enough, however, I apparently missed enforcing some consistency in it. So, if you're using SQLAlchemy 0.3, the .url arg is

Re: Beaker ext.database config

2007-10-28 Thread Robert Ian Smit
On Oct 28, 5:49 pm, Ben Bangert [EMAIL PROTECTED] wrote: Why do you need to set the namespace class like that? You can't do: beaker.cache.sa.url = etc. In the ini file? My configuration was using namespace_class instead of type. Maybe there used to be a good reason for doing that,

Beaker ext.database config

2007-10-27 Thread Robert Ian Smit
During the upgrade to the current version of Pylons (0.9.6.1) and Beaker (0.8) db-based session and cache handling broke. The beaker config options are passed on to the create_engine call from sqlalchemy which raises an exception. For now I patched beaker.ext.database so that sa_opts is an

Re: Beaker + SQLAlchemy backend problem

2007-09-16 Thread Robert Ian Smit
[root:dev_tempstorage_db] select length(value) from caches; +---+ | length(value) | +---+ | 67694 | +---+ The problem was not caused by a distinction between text and blob cols, but rather by the maximum colsize of these types. Changing to either

Re: Beaker + SQLAlchemy backend problem

2007-09-16 Thread Robert Ian Smit
Changing to either longtext or longblob will equally solve the problem. Ah, I'll change it to longblob then, does this limitation of blob size apply to all db's? My sqlalchemized db code is 90% database independent. Right now I don't have time to port the app or extract a useful

Re: Beaker + SQLAlchemy backend problem

2007-08-29 Thread Robert Ian Smit
After lots of attempts at changing the the to be pickled contents, I modified the columntype of value to be longtext instead of blob. This solved all caching problems. That's rather odd, perhaps the MySQL connector is doing something funky with the formatting when its a blob that

Re: Session store

2007-04-22 Thread Robert Ian Smit
After some digging I came up with the following solution: In config/middleware.py at the top op make_app I've added the following lines: from sqla import SQLAlchemyNamespaceManager app_conf['session_namespace_class'] = SQLAlchemyNamespaceManager app_conf['session_dburi'] =

Re: RESTful applications

2007-01-01 Thread Robert Ian Smit
REST gets a lot of press these days, it seems. However, I haven't found many examples of how it works in practice. It seems that put and delete methods need to be called via XMLHttpRequest (AJAX). Pylons and some other frameworks can work with browser-unsupported HTTP verbs by using a

Re: SQLAlchemy sessions

2006-10-18 Thread Robert Ian Smit
in my methods I do: def some_method(self): foo = object_session(self).query(Foo).get(1) You may run into problems if you have unattached objects though. eg. New objects you want to save. I tend to save objects to the session immediately after instantiating so I don't expect

SQLAlchemy sessions

2006-10-17 Thread Robert Ian Smit
I have a buch of controllers that define a __before__ method to attach a session as per the QuickWiki tutorial. Some methods on my mapped model classes require access to the database. I want to flush or discard all updates resulting from a request at the 'bottom' of the controller. I have found

Re: SQLAlchemy sessions

2006-10-17 Thread Robert Ian Smit
How can I create a seperate, 'clean' session for each request? How can I get a reference to this same session from different places in my app? 1. Are you using bound or dynamic meta data? I'm guessing dynamic. DynamicMetaData 2. Can you show me the code you're using to create the