sqlobject-discuss Mailing List for SQLObject (Page 408)
SQLObject is a Python ORM.
Brought to you by:
ianbicking,
phd
You can subscribe to this list here.
2003 |
Jan
|
Feb
(2) |
Mar
(43) |
Apr
(204) |
May
(208) |
Jun
(102) |
Jul
(113) |
Aug
(63) |
Sep
(88) |
Oct
(85) |
Nov
(95) |
Dec
(62) |
---|---|---|---|---|---|---|---|---|---|---|---|---|
2004 |
Jan
(38) |
Feb
(93) |
Mar
(125) |
Apr
(89) |
May
(66) |
Jun
(65) |
Jul
(53) |
Aug
(65) |
Sep
(79) |
Oct
(60) |
Nov
(171) |
Dec
(176) |
2005 |
Jan
(264) |
Feb
(260) |
Mar
(145) |
Apr
(153) |
May
(192) |
Jun
(166) |
Jul
(265) |
Aug
(340) |
Sep
(300) |
Oct
(469) |
Nov
(316) |
Dec
(235) |
2006 |
Jan
(236) |
Feb
(156) |
Mar
(229) |
Apr
(221) |
May
(257) |
Jun
(161) |
Jul
(97) |
Aug
(169) |
Sep
(159) |
Oct
(400) |
Nov
(136) |
Dec
(134) |
2007 |
Jan
(152) |
Feb
(101) |
Mar
(115) |
Apr
(120) |
May
(129) |
Jun
(82) |
Jul
(118) |
Aug
(82) |
Sep
(30) |
Oct
(101) |
Nov
(137) |
Dec
(53) |
2008 |
Jan
(83) |
Feb
(139) |
Mar
(55) |
Apr
(69) |
May
(82) |
Jun
(31) |
Jul
(66) |
Aug
(30) |
Sep
(21) |
Oct
(37) |
Nov
(41) |
Dec
(65) |
2009 |
Jan
(69) |
Feb
(46) |
Mar
(22) |
Apr
(20) |
May
(39) |
Jun
(30) |
Jul
(36) |
Aug
(58) |
Sep
(38) |
Oct
(20) |
Nov
(10) |
Dec
(11) |
2010 |
Jan
(24) |
Feb
(63) |
Mar
(22) |
Apr
(72) |
May
(8) |
Jun
(13) |
Jul
(35) |
Aug
(23) |
Sep
(12) |
Oct
(26) |
Nov
(11) |
Dec
(30) |
2011 |
Jan
(15) |
Feb
(44) |
Mar
(36) |
Apr
(26) |
May
(27) |
Jun
(10) |
Jul
(28) |
Aug
(12) |
Sep
|
Oct
|
Nov
(17) |
Dec
(16) |
2012 |
Jan
(12) |
Feb
(31) |
Mar
(23) |
Apr
(14) |
May
(10) |
Jun
(26) |
Jul
|
Aug
(2) |
Sep
(2) |
Oct
(1) |
Nov
|
Dec
(6) |
2013 |
Jan
(4) |
Feb
(5) |
Mar
|
Apr
(4) |
May
(13) |
Jun
(7) |
Jul
(5) |
Aug
(15) |
Sep
(25) |
Oct
(18) |
Nov
(7) |
Dec
(3) |
2014 |
Jan
(1) |
Feb
(5) |
Mar
|
Apr
(3) |
May
(3) |
Jun
(2) |
Jul
(4) |
Aug
(5) |
Sep
|
Oct
(11) |
Nov
|
Dec
(62) |
2015 |
Jan
(8) |
Feb
(3) |
Mar
(15) |
Apr
|
May
|
Jun
(6) |
Jul
|
Aug
(6) |
Sep
|
Oct
|
Nov
|
Dec
(19) |
2016 |
Jan
(2) |
Feb
|
Mar
(2) |
Apr
(4) |
May
(3) |
Jun
(7) |
Jul
(14) |
Aug
(13) |
Sep
(6) |
Oct
(2) |
Nov
(3) |
Dec
|
2017 |
Jan
(6) |
Feb
(14) |
Mar
(2) |
Apr
|
May
(1) |
Jun
|
Jul
|
Aug
(1) |
Sep
|
Oct
(4) |
Nov
(3) |
Dec
|
2018 |
Jan
|
Feb
(1) |
Mar
|
Apr
|
May
|
Jun
(1) |
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
2019 |
Jan
|
Feb
(1) |
Mar
|
Apr
(44) |
May
(1) |
Jun
|
Jul
|
Aug
|
Sep
(1) |
Oct
|
Nov
|
Dec
(1) |
2020 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
(1) |
Nov
|
Dec
(1) |
2021 |
Jan
|
Feb
(1) |
Mar
|
Apr
|
May
|
Jun
(3) |
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
2022 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
(1) |
Oct
|
Nov
|
Dec
(1) |
2023 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
(1) |
Sep
|
Oct
(1) |
Nov
(2) |
Dec
|
2024 |
Jan
|
Feb
|
Mar
|
Apr
(4) |
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
(1) |
2025 |
Jan
|
Feb
(1) |
Mar
(1) |
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
From: Ian B. <ia...@co...> - 2003-09-26 06:03:26
|
On Thursday, September 25, 2003, at 05:11 PM, Sidnei da Silva wrote: > I've been having some trouble with the fact that releaseConnection > does a rollback() if autoCommit is false and not 'exception' and > supportTransactions is set to True. Namely, if in my application (Zope > 3-based) I've set autoCommit to false because Zope takes care of > commiting the transaction at the right time, but then it reaches this > path and anything that I do gets rolled back. So, the solution for me > was to set supportTransactions to False, which doesn't seem to affect > anything, but feels icky anyway. Is there any special reason for the > rollback() there? The line in question is 98 of DBConnection. Looking at that again, I don't know that the code is really correct. The difficulty is that objects should know when they are rolled back. I know ZODB handles this as well; I'm not as clear about how that fits into SQLObject. Specifically, Transaction.rollback expires all the instances so that invalid cached values are removed. So, I don't know if the current behavior is really right, but I don't think removing it is quite right either. Though it may be appropriate to set supportTransactions to false, because in a Zope environment the transactions are being handled by Zope, not by SQLObject. Though Zope is not always the final work on transactions either -- it's sometimes necessary to commit or rollback transactions in the middle of a request. So that has to be factored in too. So, in summary, I'm not sure. Ian |
From: Ian B. <ia...@co...> - 2003-09-26 04:45:58
|
On Thursday, September 25, 2003, at 05:18 PM, Luke Opperman wrote: > The error happens during the second call to addColumn, and only if I > import > StoryMotivation before Motivation (otherwise the rogue code below > never gets > called due to how needSet works). > > addNeedSet snippet: > cls = findClass(setCls, registry=registry) > if callable(getattr(obj, attr, None)): > getattr(obj, attr)(cls) > else: > setattr(obj, attr, cls) > > I'm trying to understand the reason for trying to create an instance > of the > class in the positive if statement. My code works if I comment that > out (ie, > if obj.attr already exists, then pass, otherwise set it) or just > always set > it. But ? This is so that addNeedSet/setNeedSet allow both callbacks and attribute setting (callbacks being more general). The particular problem here is already fixed in CVS. Ian |
From: Randall R. <ra...@ra...> - 2003-09-26 00:31:14
|
On Thursday, September 25, 2003, at 05:49 PM, Ian Sparks wrote: > General questions : > > How do SQLObject models fit into Webware? > Are there threading issues? > Does it work like dbPool? > > If anyone has some simple (even pseudocode) examples that would be a > great > help. Well, I haven't run into any big issues yet, and I've been building my latest app (a combination articles site and shopping cart) with it. On the other hand, I'm not trying to store my servlets in the db or anything. I also haven't needed transactions yet, but expect to. The two easy ways of getting around the caching (when updating articles, etc) are creating any needed objects in awake() and destroying them in sleep(), or just restarting the appserver on changes that would be cached by a servlet. I do the latter. For me, SQLObject has replaced the pooling built into psycopg. Just in time, too, as psycopg 2.0 will not have it anymore. :) If you can be more specific about something you'd like to see an example of, I can just pull out some of my current code (assuming I'm doing whatever you want to see). -- Randall Randall <ra...@ra...> "When you advocate any government action, you must first believe that violence is the best answer to the question at hand." -- Allen Thornton |
From: Luke O. <lu...@me...> - 2003-09-25 22:19:00
|
I'm thinking this has been mentioned on the list before, but getting an odd error: File "/usr/lib/python2.2/site-packages/SQLObject/SQLBuilder.py", line 126, in sqlRepr raise ValueError, "Unknown SQL builtin type: %s for %s" % \ ValueError: Unknown SQL builtin type: <class 'SQLObject.SQLObject.MetaSQLObject'> for <class 'MyContext.sqlobject.Motivation.Motivation'> When I have two foreignKey's in a table to the same related table Classes look like: class StoryMotivation(CoreObject): monkey = ForeignKey('Motivation') donkey = ForeignKey('Motivation') story = StringCol() class Motivation(CoreObject): name = StringCol() The error happens during the second call to addColumn, and only if I import StoryMotivation before Motivation (otherwise the rogue code below never gets called due to how needSet works). addNeedSet snippet: cls = findClass(setCls, registry=registry) if callable(getattr(obj, attr, None)): getattr(obj, attr)(cls) else: setattr(obj, attr, cls) I'm trying to understand the reason for trying to create an instance of the class in the positive if statement. My code works if I comment that out (ie, if obj.attr already exists, then pass, otherwise set it) or just always set it. But ? - Luke |
From: Sidnei da S. <si...@pl...> - 2003-09-25 22:15:52
|
Howdy again, I've been having some trouble with the fact that releaseConnection does a rollback() if autoCommit is false and not 'exception' and supportTransactions is set to True. Namely, if in my application (Zope 3-based) I've set autoCommit to false because Zope takes care of commiting the transaction at the right time, but then it reaches this path and anything that I do gets rolled back. So, the solution for me was to set supportTransactions to False, which doesn't seem to affect anything, but feels icky anyway. Is there any special reason for the rollback() there? The line in question is 98 of DBConnection. []'s -- Sidnei da Silva <si...@pl...> dreamcatching :: making your dreams come true http://dreamcatcher.homeunix.org Simulations are like miniskirts, they show a lot and hide the essentials. -- Hubert Kirrman |
From: Sidnei da S. <si...@pl...> - 2003-09-25 22:07:44
|
Howdy folks.=20 I've just checked in a BoolCol, and later I've figured out that it only works reliably on python 2.3. When I run the tests on python 2.2 I get 16 errors on my box, but none on 2.3. Can anyone confirm which one is the target version?=20 []'s --=20 Sidnei da Silva <si...@pl...> dreamcatching :: making your dreams come true http://dreamcatcher.homeunix.org Security check: =07=07=07INTRUDER ALERT! |
From: Ian S. <ia...@et...> - 2003-09-25 22:01:00
|
General questions : How do SQLObject models fit into Webware? Are there threading issues? Does it work like dbPool? If anyone has some simple (even pseudocode) examples that would be a great help. Thanks. |
From: Ian S. <ian...@et...> - 2003-09-24 14:49:24
|
> http://sources.redhat.com/bzip2/ has the windows program that > can unzip this file. Then winzip will probably open it. That's it. Thanks all. "Randall Randall" <ra...@ra...> wrote in message news:6C5...@ra...... > > On Thursday, September 11, 2003, at 05:58 PM, Ian Sparks wrote: > > > http://colorstudy.com/ianb/SQLObject-cvs.tar.bz2 > > > > Winzip won't open this, which is a shame because I'd like to get it. > > > > When I've had problems like this in the past I've often cured them with > > changing the file ext to .tar but no go on this. > > > > Advice anyone? > > http://sources.redhat.com/bzip2/ has the windows program that > can unzip this file. Then winzip will probably open it. > > -- > Randall Randall <ra...@ra...> > "When you advocate any government action, you must first > believe that violence is the best answer to the question > at hand." -- Allen Thornton > > > -- > Randall Randall <ra...@ra...> > "When you advocate any government action, you must first > believe that violence is the best answer to the question > at hand." -- Allen Thornton > > > -- > Randall Randall <ra...@ra...> > "When you advocate any government action, you must first > believe that violence is the best answer to the question > at hand." -- Allen Thornton > > > > ------------------------------------------------------- > This sf.net email is sponsored by:ThinkGeek > Welcome to geek heaven. > http://thinkgeek.com/sf |
From: James R. <jcr...@ya...> - 2003-09-23 04:19:11
|
While playing with SQLObject, I ran into a problem with the "set" method. If an exception occurred during an update (i.e. invalid data sent to the server), the exception is properly raised to the caller. But, any subsequent "set" calls causes "a freeze." I know that, technically, the data should be validated before sending it to the db, but... To make a long story short, I had to add a try/finally block after the call to self._SO_writeLock.acquire() in the SQLObject.set method so that the self._SO_writeLock.release() always gets called. Will this break anything? James __________________________________ Do you Yahoo!? Yahoo! SiteBuilder - Free, easy-to-use web site design software http://sitebuilder.yahoo.com |
From: Ian B. <ia...@co...> - 2003-09-22 17:31:05
|
On Monday, September 22, 2003, at 12:23 PM, cvigny wrote: > CREATE TABLE `url` ( > `id` int(25) unsigned NOT NULL auto_increment, > `idprotocol` int(3) unsigned NOT NULL default '0', > PRIMARY KEY (`id`) > ) TYPE=MyISAM > CREATE TABLE `protocol` ( > `id` int(3) unsigned NOT NULL auto_increment, > `protocol` varchar(50) NOT NULL default '', > PRIMARY KEY (`id`) > ) TYPE=MyISAM > from SQLObject import * > > import Config > > debug=1 > __connection__= MySQLConnection(host=Config.DB_HOST, > user=Config.DB_USERNAME, passwd=Config.DB_PASSWORD, > db="url",debug=debug) > > class MyStyle(Style): > def tableReference(self, table): > return "id" + table.lower() > > __connection__.style = MyStyle(longID=True) I think you don't want longID=True. That means the primary key will be prefixed with the table name (like protocol_id), but you are using just "id" for the primary key. Ian |
From: cvigny <cv...@ar...> - 2003-09-22 17:23:23
|
Hi, I have a problem using the Style object, I create my style for the foreign key building in idtable but it don't work. Please could you help with that ? here the py, sql and traceback code. I try to subscribe the mailling list but no response right now Traceback (most recent call last): File "D:\python\artonline\tt.py", line 55, in ? u = Url.new(protocol=p) File "C:\Python22\Lib\site-packages\SQLObject\SQLObject.py", line 800, in new inst._SO_finishCreate() File "C:\Python22\Lib\site-packages\SQLObject\SQLObject.py", line 820, in _SO_finishCreate names, values) File "C:\Python22\Lib\site-packages\SQLObject\DBConnection.py", line 127, in queryInsertID return self._runWithConnection(self._queryInsertID, table, idName, names, values) File "C:\Python22\Lib\site-packages\SQLObject\DBConnection.py", line 73, in _runWithConnection val = meth(conn, *args) File "C:\Python22\Lib\site-packages\SQLObject\DBConnection.py", line 370, in _queryInsertID c.execute(q) File "C:\Python22\lib\site-packages\MySQLdb\cursors.py", line 95, in execute return self._execute(query, args) File "C:\Python22\lib\site-packages\MySQLdb\cursors.py", line 114, in _execute self.errorhandler(self, exc, value) File "C:\Python22\lib\site-packages\MySQLdb\connections.py", line 33, in defaulterrorhandler raise errorclass, errorvalue _mysql_exceptions.OperationalError: (1054, "Unknown column 'protocol_id' in 'field list'") CREATE TABLE `url` ( `id` int(25) unsigned NOT NULL auto_increment, `idprotocol` int(3) unsigned NOT NULL default '0', PRIMARY KEY (`id`) ) TYPE=MyISAM CREATE TABLE `protocol` ( `id` int(3) unsigned NOT NULL auto_increment, `protocol` varchar(50) NOT NULL default '', PRIMARY KEY (`id`) ) TYPE=MyISAM |
From: Ian B. <ia...@co...> - 2003-09-17 21:10:29
|
On Wednesday, September 17, 2003, at 03:56 PM, Victor Ng wrote: > Shouldn't I be able to redefine the class? Sadly, no. > I'm not sure why an assertion is being thrown. > Because SQLObject handles classes by name (e.g. ForeignKey('TableName')) it is important that classes not be redefined and that names be unique. Re-fixing up classes would be quite difficult. In general redefining classes in Python can be problematic. In this specific instance I suppose it wouldn't cause a problem, but the assertion in there as a safeguard. Ian |
From: Victor Ng <vn...@ma...> - 2003-09-17 20:56:13
|
If I define the same class twice using SQLObject.SQLObject as the parent, I get the following error: >>> from SQLObject import * >>> class foo(SQLObject): ... aColumn = IntCol() ... >>> class foo(SQLObject): ... aColumn = IntCol() ... Traceback (most recent call last): File "<stdin>", line 1, in ? File "/Library/Frameworks/Python.framework/Versions/2.3/lib/python2.3/site- packages/SQLObject/SQLObject.py", line 161, in __new__ assert not classRegistry.get(registry, {}).has_key(className), "A database object by the name %s has already been created" % repr(className) AssertionError: A database object by the name 'foo' has already been created Shouldn't I be able to redefine the class? I'm not sure why an assertion is being thrown. vic |
From: Ian B. <ia...@co...> - 2003-09-16 15:49:26
|
On Tuesday, September 16, 2003, at 08:20 AM, Mark Mueller wrote: > Ian -- > > Very nice job with the SQLObject project. I am > considering using it for several projects. > > I like to model problems using the BON technique, > however, most middleware does not map to the program > space in a way that allows me to go easily from the > BON diagram to the program. SQLObject help my by > hiding the details. > > Thanks for all your work. I'm glad you enjoy it. You should post questions to the mailing list so that everyone can participate, answer, or hear the answer. > I do have a question. I have two classes arranged in > a parent-child (one-to-many) relationship. I need to > be able to have my collection in the parent object > include only a subset of the child items. (For > example, a customer's account object that has a > transactions collection that includes transactions for > a date range.) My problem is that the account object, > automatically, gives me all the transations. Is there > a way to filter the child objects? You have to construct the select yourself, like (untested): class Account(SQLObject): transactions = ForeignKey('Trans') def transactionsDuring(self, start=None, end=None): query = Trans.q.accountID == self.id if start: query = AND(query, Trans.q.eventDate > start) if end: query = AND(query, Trans.q.eventDate < end) return Trans.select(query) Ian |
From: Javier R. <jav...@Ho...> - 2003-09-12 01:58:51
|
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 Ian Sparks wrote: > http://colorstudy.com/ianb/SQLObject-cvs.tar.bz2 > > Winzip won't open this, which is a shame because I'd like to get it. > > When I've had problems like this in the past I've often cured them with > changing the file ext to .tar but no go on this. > > Advice anyone? IFAIK Winzip can't handle bzip2 compression. Get WinRAR or a bzip2 decompressor (http://sources.redhat.com/bzip2/#bzip2-latest). Later, Javier -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.2.2 (GNU/Linux) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org iD8DBQE/YSqr8XQC840MeeoRAl3HAJ4poO/hX3mgl9cH7vyMqc/90UJH5gCfe+75 fItDqw6kBbrDF72v7cVePcg= =3da3 -----END PGP SIGNATURE----- |
From: Randall R. <ra...@ra...> - 2003-09-11 22:44:00
|
On Thursday, September 11, 2003, at 05:58 PM, Ian Sparks wrote: > http://colorstudy.com/ianb/SQLObject-cvs.tar.bz2 > > Winzip won't open this, which is a shame because I'd like to get it. > > When I've had problems like this in the past I've often cured them with > changing the file ext to .tar but no go on this. > > Advice anyone? http://sources.redhat.com/bzip2/ has the windows program that can unzip this file. Then winzip will probably open it. -- Randall Randall <ra...@ra...> "When you advocate any government action, you must first believe that violence is the best answer to the question at hand." -- Allen Thornton -- Randall Randall <ra...@ra...> "When you advocate any government action, you must first believe that violence is the best answer to the question at hand." -- Allen Thornton -- Randall Randall <ra...@ra...> "When you advocate any government action, you must first believe that violence is the best answer to the question at hand." -- Allen Thornton |
From: Ian B. <ia...@co...> - 2003-09-11 22:28:45
|
On Thursday, September 11, 2003, at 04:58 PM, Ian Sparks wrote: > http://colorstudy.com/ianb/SQLObject-cvs.tar.bz2 > > Winzip won't open this, which is a shame because I'd like to get it. > > When I've had problems like this in the past I've often cured them with > changing the file ext to .tar but no go on this. Does WinZip open bz2 files? I would have thought it would, but I've never tried it. If, say, you have cygwin installed you'd do "tar jfx SQLObject-cvs.tar.bz2", or "bunzip2 ...". Ian |
From: Ian S. <ian...@et...> - 2003-09-11 22:00:23
|
http://colorstudy.com/ianb/SQLObject-cvs.tar.bz2 Winzip won't open this, which is a shame because I'd like to get it. When I've had problems like this in the past I've often cured them with changing the file ext to .tar but no go on this. Advice anyone? |
From: Ian B. <ia...@co...> - 2003-09-10 15:27:10
|
On Wednesday, September 10, 2003, at 03:54 AM, Simon Willison wrote: > In an application I'm developing, I need to run a query that I don't > think is supported natively by SQLObject. I have a table of Stories, > each including the date it was created. I want to find all days within > a certain month which contain at least one story. Here's the query I > need to run constructed by hand: > > select > distinct dayofmonth(date) > from > story > where > date >= '2003-09-01' > and > date < '2003-10-01' Yeah, the distinct part isn't going to work. Getting SQLObject to handle aggregate functions would be... I don't know. Still not sure what that would mean -- some sort of functional style. So, the SQL is probably the best you will get. So I'd just do it like: class Story(SQLObject): ... def daysWithStories(cls, month, connection=None): if connection is None: connection = cls._connection result = connection.queryOne(...your SQL...) return result[0] daysWithStories = classmethod(daysWithStories) At least that way it will look like part of your class, if not part of SQLObject. Ian |
From: Simon W. <cs...@ba...> - 2003-09-10 08:54:18
|
Hi all, In an application I'm developing, I need to run a query that I don't think is supported natively by SQLObject. I have a table of Stories, each including the date it was created. I want to find all days within a certain month which contain at least one story. Here's the query I need to run constructed by hand: select distinct dayofmonth(date) from story where date >= '2003-09-01' and date < '2003-10-01' Since this isn't natively supported by SQLObject, what would be the most elegant / "best practise" method for implementing the query? I'd rather not import another Postgres module and use that, so I'm currently swinging towards adding an extra method to the Story class which executes the query using SQLObject's own query mechanism and returns the result. Is there a neater way of doing this? Thanks, Simon |
From: Ian B. <ia...@co...> - 2003-09-09 16:11:51
|
On Tuesday, September 9, 2003, at 08:55 AM, Simon Willison wrote: > Hi all, > > Has anyone done any work on extending SQLObject classes to > auto-generate HTML forms for adding / editing data in tables? I'm > about to start work on an extension to do just that but if someone has > already worked on it I'd rather not reinvent the wheel. I've been working on a (still incomplete) for generation package, in webware-sandbox.sf.net CVS, /Sandbox/ianbicking/FormEncode -- the validation that I just recently added to SQLObject is taken from that package. I'm definitely looking for input and ideas about how it should work -- mostly about how to make the interface general and also reasonable (i.e., not too verbose, or requiring mental gyrations to figure out how to work with and customize to your needs). What's already in SQLObject should be expanded so you can add HTTP/HTML specific validators (and some of that process is in place in Validator.py). Then you need to be able to annotate the class as a whole, so you can add attributes, hide columns from forms, etc. I'm hoping that interfaces/adapters (probably taken from Zope 3's implementation) will aid in that. Then the form generation has to be worked out. I'm envisioning a limited number of generation possibilities at this point -- simplistic generation (useful for unit testing) that produces minimal HTML; a standard table-based layout, similar to what you might see in a registration form (labels ontop of input elements); and a template-based layout that inspects the HTML directly, replacing VALUE attributes, setting SELECTED attributes, etc. *But*, I don't want to just pile these features on, because the result won't be general enough, or will be too verbose, or too hard to work with. But these desires have kept me from finishing this off and putting it all together, even though the pieces are largely in place (except the HTML interpretation, but that's a recent plan on my part). Anyway, that's my plan. You're still welcome to have your own too ;) It would be nice if you used FormEncode's validation, though, even if you use something else for the other parts. Ian |
From: Simon W. <cs...@ba...> - 2003-09-09 13:54:59
|
Hi all, Has anyone done any work on extending SQLObject classes to auto-generate HTML forms for adding / editing data in tables? I'm about to start work on an extension to do just that but if someone has already worked on it I'd rather not reinvent the wheel. Cheers, Simon Willison http://simon.incutio.com/ |
From: Randall R. <ra...@ra...> - 2003-09-09 09:36:11
|
On Monday, September 8, 2003, at 09:19 PM, Ian Bicking wrote: >> Anyway, I haven't got the chance to fairly test whether >> transactions are working yet, because I'm using Python >> 2.2, and this SQLObject doesn't work with it. I'll >> install 2.3 today and retest. > > 2.2 should be fine. Are you having a problem with it? Yes, but it's a known issue with 2.2, which was fixed sometime later: >>> NTest(1, trans) Traceback (most recent call last): File "<stdin>", line 1, in ? File "/usr/lib/python2.2/site-packages/SQLObject/SQLObject.py", line 405, in __new__ val._init(id, connection, selectResults) File "/usr/lib/python2.2/site-packages/SQLObject/SQLObject.py", line 667, in _init selectResults = self._connection._SO_selectOne(self, dbNames) File "/usr/lib/python2.2/site-packages/SQLObject/DBConnection.py", line 416, in __getattr__ meth = new.instancemethod(func, self, self.__class__) TypeError: instancemethod() argument 3 must be class, not type Guido mentioned on a mailing list that this was to be fixed in 2.2.1, but since I had no reason to stay with 2.2.x for everything, I just installed 2.3. With Python 2.3, this problem doesn't exist, and everything works swimmingly. Thanks! -- Randall Randall <ra...@ra...> "When you advocate any government action, you must first believe that violence is the best answer to the question at hand." -- Allen Thornton |
From: Randall R. <ra...@ra...> - 2003-09-09 06:59:21
|
On Sunday, September 7, 2003, at 02:32 PM, Ian Bicking wrote: > Try CVS, I fixed a bunch of these yesterday. Or > http://colorstudy.com/ianb/SQLObject-cvs.tar.bz2 After installing Python 2.3 and psycopg 1.1.8, transactions seem to work fine. Thanks! -- Randall Randall <ra...@ra...> "When you advocate any government action, you must first believe that violence is the best answer to the question at hand." -- Allen Thornton -- Randall Randall <ra...@ra...> "When you advocate any government action, you must first believe that violence is the best answer to the question at hand." -- Allen Thornton |
From: Sidnei da S. <si...@pl...> - 2003-09-09 02:24:42
|
On Mon, Sep 08, 2003 at 08:27:09PM -0500, Ian Bicking wrote: | Unique is hard, because you can't test it in isolation. You'd have to | look at all the other rows, whether they are in memory or not. It | seems like the database would do this best. | | Anyway, I don't think this is the best place for a validator, it's | really best done in the database. Is there a problem there? | | Also, Validators.py is really part of another piece of (as-yet | unreleased) software I'm writing, and include/Validators.py is (and | will continue to be) a direct copy of that. I'm not sure where the | best place for a SQLObject-specific validator is. Thanks for the answer. I've ended up creating the validator as a field constraint (it was for my zope3-integration project). []'s -- Sidnei da Silva <si...@pl...> dreamcatching :: making your dreams come true http://dreamcatcher.homeunix.org It's ten o'clock; do you know where your processes are? |