Re: [SQLObject] Non-DB SQLObject instances
SQLObject is a Python ORM.
Brought to you by:
ianbicking,
phd
From: Ian B. <ia...@co...> - 2005-10-07 15:54:51
|
Jeff Watkins wrote: > I've been taking on the challenge of building an identity management and > access control framework for TurboGears. One of the features I really > liked about working with BroadVision's Web framework (back in 2001) was > the notion of an anonymous visitor. > > During the course of a visit, you could collect various information > about the visitor (name, age, etc) and populate the anonymous visitor > record. Then if the visitor asked, you could stash that in the DB. > > I'd like to do the same (or similar) thing with TurboGears and > SQLObject. However, I don't seem to be able to create an instance of > SQLObject that *isn't* created in the database. > > Does anyone have any suggestions? Well, you can't do that. I can basically understand the idea, though I've had very little motivation to do this in my own work. Technically it's rather subtle; as I've said before, I'd have to see a really detailed proposal to really be able to consider what it'd mean for the code. Unit tests make for a particularly good proposal format. But anyway, when I've created out-of-database objects to represent future persistence (like a shopping cart representing a future invoice, or an anonymous user, or whatever) I've later regretted it, and decided that I should have just put it in the database from the beginning. After all, you still have to give the user an ID -- even a random and temporary one -- because you have to associate the user with their future requests. And you'll still need to do cleanup, as those anonymous users won't go away on their own. Doing it in the database isn't so bad. -- Ian Bicking / ia...@co... / http://blog.ianbicking.org |