sqlobject-discuss Mailing List for SQLObject (Page 379)
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: trash1 <tr...@ho...> - 2004-06-23 09:18:59
|
Hello about last two days I can't check svn repository: svn co svn://colorstudy.com/trunk/SQLObject svn: Berkeley DB error while opening 'nodes' table for filesystem /var/lib/subversion/repository/db: Cannot allocate memory I'm do this under win2000 Some other projects, that I checks works fine. Regards Aleksey |
From: Ahmed M. A. <ahm...@wa...> - 2004-06-23 08:51:20
|
Sorry, The correct code is: trans = debDB.newTransaction() doz=Dozenten(trans) Ahmed MOHAMED ALI "Akki Nitsch" <ak...@ak...> wrote in message news:Pine.LNX.4.44.0406221516060.7842-100000@linux.local... > Hi everybody! > > I've got a problem with creating new database entries when i'm using > transactions. > > Here's my code: > > import SQLObject > > class DeputatsDB: > def __init__(self): > """Initiate a database connection""" > self._conn = SQLObject.PostgresConnection('user=akki > dbname=deputat') > > def newTransaction(self): > """Open a new transaction""" > return self._conn.transaction() > > def getDozenten(self, trans): > """Return an item from table Dozent""" > return Dozenten(trans) > > class Table: > def __init__(self, trans): > """Initiate a transaction""" > self._trans = trans > > class Dozent(SQLObject.SQLObject): > """Class dozent properties of dozent""" > dozent_uid = SQLObject.StringCol() > vorname = SQLObject.StringCol() > name = SQLObject.StringCol() > kuerzel = SQLObject.StringCol(length=5, default = None) > anrede = SQLObject.StringCol() > > class Dozenten(Table): > """Class for manipulation of dozenten""" > def addDozent(self, uid, vorname, name, kuerzel, anrede): > """Add a new dozent to database""" > return Dozent.new(connection=self._trans, > dozent_uid=uid, > name=name, vorname=vorname, > kuerzel=kuerzel, anrede=anrede) > > > After creation of instances of DeputatsDB, DeputatsDB.Transaction and > Table i'm trying to add a new Dozent to the Database: > > from deputatsabrechnung import * > > debDB = DeputatsDB() > trans = debDB.newTransaction() > table = Table(trans) > doz=Dozenten(table) > > doz.addDozent('324534645zgfb', 'James', 'Bond', 'bon', 'Mister') > > Now i'm getting this error message: > > Traceback (most recent call last): > File "<stdin>", line 1, in ? > File > "/zope/mniportal/Products/MNIVeranstaltungen/deputatsabrechnung/deputatsabre chnung.py", > line 30, in addDozent > kuerzel=kuerzel, anrede=anrede) > File "/usr/local/lib/python2.3/site-packages/SQLObject/SQLObject.py", > line 907, in new > inst._SO_finishCreate(id, connection=connection) > File "/usr/local/lib/python2.3/site-packages/SQLObject/SQLObject.py", > line 928, in _SO_finishCreate > id = connection.queryInsertID(self._table, self._idName, > AttributeError: Table instance has no attribute 'queryInsertID' > > > Well, after searching the mail list i haven't found any hint what courses > this error and i haven't any idea what my fault is. > > Can anybody help me? > > Thank you very much! > > Akki Nitsch > > ############################################################# > The freedom of meaning one thing and saying > something different is not permitted. > E.W. Dijkstra > > > > ------------------------------------------------------- > This SF.Net email sponsored by Black Hat Briefings & Training. > Attend Black Hat Briefings & Training, Las Vegas July 24-29 - > digital self defense, top technical experts, no vendor pitches, > unmatched networking opportunities. Visit www.blackhat.com |
From: Ahmed M. A. <ahm...@wa...> - 2004-06-23 08:44:35
|
Hi, I think that your problem is caused by the next line: doz=Dozenten(table) why do you pass the the table argument ? This will lead to the call self._trans = table in Table__init__ and will overwrite your Transaction instance with a Table instance. Instead use: doz=Dozenten() I hope that will work. Ahmed MOHAMED ALI "Akki Nitsch" <ak...@ak...> wrote in message news:Pine.LNX.4.44.0406221516060.7842-100000@linux.local... > Hi everybody! > > I've got a problem with creating new database entries when i'm using > transactions. > > Here's my code: > > import SQLObject > > class DeputatsDB: > def __init__(self): > """Initiate a database connection""" > self._conn = SQLObject.PostgresConnection('user=akki > dbname=deputat') > > def newTransaction(self): > """Open a new transaction""" > return self._conn.transaction() > > def getDozenten(self, trans): > """Return an item from table Dozent""" > return Dozenten(trans) > > class Table: > def __init__(self, trans): > """Initiate a transaction""" > self._trans = trans > > class Dozent(SQLObject.SQLObject): > """Class dozent properties of dozent""" > dozent_uid = SQLObject.StringCol() > vorname = SQLObject.StringCol() > name = SQLObject.StringCol() > kuerzel = SQLObject.StringCol(length=5, default = None) > anrede = SQLObject.StringCol() > > class Dozenten(Table): > """Class for manipulation of dozenten""" > def addDozent(self, uid, vorname, name, kuerzel, anrede): > """Add a new dozent to database""" > return Dozent.new(connection=self._trans, > dozent_uid=uid, > name=name, vorname=vorname, > kuerzel=kuerzel, anrede=anrede) > > > After creation of instances of DeputatsDB, DeputatsDB.Transaction and > Table i'm trying to add a new Dozent to the Database: > > from deputatsabrechnung import * > > debDB = DeputatsDB() > trans = debDB.newTransaction() > table = Table(trans) > doz=Dozenten(table) > > doz.addDozent('324534645zgfb', 'James', 'Bond', 'bon', 'Mister') > > Now i'm getting this error message: > > Traceback (most recent call last): > File "<stdin>", line 1, in ? > File > "/zope/mniportal/Products/MNIVeranstaltungen/deputatsabrechnung/deputatsabre chnung.py", > line 30, in addDozent > kuerzel=kuerzel, anrede=anrede) > File "/usr/local/lib/python2.3/site-packages/SQLObject/SQLObject.py", > line 907, in new > inst._SO_finishCreate(id, connection=connection) > File "/usr/local/lib/python2.3/site-packages/SQLObject/SQLObject.py", > line 928, in _SO_finishCreate > id = connection.queryInsertID(self._table, self._idName, > AttributeError: Table instance has no attribute 'queryInsertID' > > > Well, after searching the mail list i haven't found any hint what courses > this error and i haven't any idea what my fault is. > > Can anybody help me? > > Thank you very much! > > Akki Nitsch > > ############################################################# > The freedom of meaning one thing and saying > something different is not permitted. > E.W. Dijkstra > > > > ------------------------------------------------------- > This SF.Net email sponsored by Black Hat Briefings & Training. > Attend Black Hat Briefings & Training, Las Vegas July 24-29 - > digital self defense, top technical experts, no vendor pitches, > unmatched networking opportunities. Visit www.blackhat.com |
From: Peter G. <pet...@st...> - 2004-06-22 17:34:54
|
Hello. I had a layout similar to class Actor(SQLObject): actorType = IntCol() class Store(Actor): name = StringCol(length = 64) When I insert new rows using Store.new(actorType = 1, name = "Test") it doesn't actualy insert a row in the actor table and the actorType column is also found in the store table. Even though this might seem like a smart optimization to make, it's not since I'm trying to implement a test slice from a larger model. Also, I sometimes need to fetch an Actor object to find out what type of actor I should continue fetching, but since there are no rows in the actor table I get an error telling that the object was not found. Further more, my model supports multiple inheritence of this nature: class Store(Actor, Organisation): .... It seems the second superclass is ignored completely, is this not support in SQLObject? As a final question I'd like to ask how where to put the transaction object when you are creating new rows. The transaction object can be passed as the second argument when getting objects, but not when creating new. Best regards, Peter Gebauer |
From: CLIFFORD I. <cli...@di...> - 2004-06-22 15:25:54
|
At 05:18 PM 21/06/2004 +0200, Ivo van der Wijk wrote: >Hi, > >I regularly run into weird problems because I'm trying to pass the wrong >type of object to, for example, a foreign key. > >How hard would it be to make SQLObject warn in such cases? [snip] Hi Ivo, I just read about PyProtocols <http://peak.telecommunity.com/PyProtocols.html> in the FormEncode <http://www.formencode.org> documentation. It is supposed to help with this issue, amongst others. Regards, Clifford Ilkay Dinamis Corporation 3266 Yonge Street, Suite 1419 Toronto, Ontario Canada M4N 3P6 Tel: 416-410-3326 |
From: Akki N. <ak...@ak...> - 2004-06-22 13:41:43
|
Hi everybody! I've got a problem with creating new database entries when i'm using transactions. Here's my code: import SQLObject class DeputatsDB: def __init__(self): """Initiate a database connection""" self._conn = SQLObject.PostgresConnection('user=akki dbname=deputat') def newTransaction(self): """Open a new transaction""" return self._conn.transaction() def getDozenten(self, trans): """Return an item from table Dozent""" return Dozenten(trans) class Table: def __init__(self, trans): """Initiate a transaction""" self._trans = trans class Dozent(SQLObject.SQLObject): """Class dozent properties of dozent""" dozent_uid = SQLObject.StringCol() vorname = SQLObject.StringCol() name = SQLObject.StringCol() kuerzel = SQLObject.StringCol(length=5, default = None) anrede = SQLObject.StringCol() class Dozenten(Table): """Class for manipulation of dozenten""" def addDozent(self, uid, vorname, name, kuerzel, anrede): """Add a new dozent to database""" return Dozent.new(connection=self._trans, dozent_uid=uid, name=name, vorname=vorname, kuerzel=kuerzel, anrede=anrede) After creation of instances of DeputatsDB, DeputatsDB.Transaction and Table i'm trying to add a new Dozent to the Database: from deputatsabrechnung import * debDB = DeputatsDB() trans = debDB.newTransaction() table = Table(trans) doz=Dozenten(table) doz.addDozent('324534645zgfb', 'James', 'Bond', 'bon', 'Mister') Now i'm getting this error message: Traceback (most recent call last): File "<stdin>", line 1, in ? File "/zope/mniportal/Products/MNIVeranstaltungen/deputatsabrechnung/deputatsabrechnung.py", line 30, in addDozent kuerzel=kuerzel, anrede=anrede) File "/usr/local/lib/python2.3/site-packages/SQLObject/SQLObject.py", line 907, in new inst._SO_finishCreate(id, connection=connection) File "/usr/local/lib/python2.3/site-packages/SQLObject/SQLObject.py", line 928, in _SO_finishCreate id = connection.queryInsertID(self._table, self._idName, AttributeError: Table instance has no attribute 'queryInsertID' Well, after searching the mail list i haven't found any hint what courses this error and i haven't any idea what my fault is. Can anybody help me? Thank you very much! Akki Nitsch ############################################################# The freedom of meaning one thing and saying something different is not permitted. E.W. Dijkstra |
From: Oleg B. <ph...@ma...> - 2004-06-22 12:01:16
|
On Tue, Jun 22, 2004 at 05:26:43AM -0600, William Volkman wrote: > I've got insertion and update of records working pretty well, however > record deletion seems broken (as well as conspicuously missing from > the docs on the web site ;-) > > >>> foo = XImport.get(5) > >>> foo.delete() foo.destroySelf() Oleg. -- Oleg Broytmann http://phd.pp.ru/ ph...@ph... Programmers don't die, they just GOSUB without RETURN. |
From: Philippe N. <sw...@fr...> - 2004-06-22 11:52:02
|
On Tue, Jun 22, 2004 at 05:26:43AM -0600, William Volkman wrote: > I've got insertion and update of records working pretty well, however > record deletion seems broken (as well as conspicuously missing from > the docs on the web site ;-) > Try foo.destroySelf() -- Philippe |
From: William V. <wkv...@ne...> - 2004-06-22 11:26:50
|
I've got insertion and update of records working pretty well, however record deletion seems broken (as well as conspicuously missing from the docs on the web site ;-) >>> foo = XImport.get(5) >>> foo.delete() Traceback (most recent call last): File "<stdin>", line 1, in ? TypeError: delete() takes exactly 2 arguments (1 given) >>> foo.delete(5) Traceback (most recent call last): File "<stdin>", line 1, in ? File "/usr/lib/python2.2/site-packages/sqlobject/main.py", line 1028, in delete TypeError: __init__() takes exactly 1 argument (2 given) >>> XImport.delete(5) Traceback (most recent call last): File "<stdin>", line 1, in ? File "/usr/lib/python2.2/site-packages/sqlobject/main.py", line 1028, in delete TypeError: __init__() takes exactly 1 argument (2 given) My copy of SQLObject is about a week old, trying to update it results in: svn update svn: Berkeley DB error while opening 'nodes' table for filesystem /var/lib/subversion/repository/db: Cannot allocate memory Which I googled for and found that a svnadmin recover is necessary with possibly an increase in the number of locks in DB_CONFIG |
From: William V. <wkv...@ne...> - 2004-06-22 10:47:31
|
On Tue, 2004-06-15 at 02:40, Ahmed MOHAMED ALI wrote: > The connection object that you are using is your original connection, > the Transaction create a new connection,so you must use that one. > The transaction class uses internally this connection.It exposes the > same interface than the connection itself and use a delegation mechanism > to communicate with the database server.Here's how you can modify your code > to > work with transaction: > > <begin modified code> > trans = WKVTestTable._connection.transaction() > for i in xrange(1000): > newrec = WKVTestTable(connection=trans,...) --> set the connection argument > to be the transaction itself > trans.commit() > </end modified code> Thank you, I had stared at the example in the doc and failed to notice the "trans" argument on the get (let alone consider it as a potential argument for the class instantiation). I am a little disturbed however as this implies that I cannot have a field named connection in my DB table, is that correct? I would kinda expect that a wrapper would take steps to not collide with potential user defined fields (much like the __SO__ prefixing that is done). Thanks again, William. |
From: CLIFFORD I. <cli...@di...> - 2004-06-21 20:47:03
|
Hello Matt, At 12:09 AM 21/06/2004 -0400, Matt Feifarek wrote: >Hi Clifford. > >FormKit is 3rd party software, not included with Webkit, but I'm one of >the two authors, so I'll answer. I knew it was third party software and that you were one of the authors but I could not find a mailing list for FormKit so I decided to post here. Chances are high that FormKit users are WebWare users, though the converse is not necessarily true. >The form.dump() method is very very simple, and not really meant for >permanent use. It's just to make sure that your form works. Of course, it >/can/ be used, but it's ugly, as you noticed. We use it to make sure >everything is okay, then replace the form output bits in our servlets with >more hand-crafted code. > >Every field in a form has a set of accessor methods that you can pick at >to lay out your form in a template or manually or however you wish: > >myfield.tag() >myfield.label() >myfield.error() >myfield.value() > >and some others... > >Basically, you just want to set up your code in self.writeln() or >whatever, and just grab onto the tag() text, and drop it into your page >output wherever you wish. Thank you for explaining this. Once you gave me the clue, I found an example grepping through the Examples directory and managed to get my first form working. I have excerpted relevant bits below for when someone else comes along and asks the same question. ############################# def writeContent(self): if self.form.isSuccessful(): self.writeln('''<p>Form successfully posted '%s'.</p>''' % self.form.values()) else: self.writeln( self.form.startTags() ) self.writeln(self.form.startTags()) self.writeln('''<table>''') if self.form.userID.error(): self.writeln('''\t<tr><td>Please enter a valid user ID</td>''') self.writeln('''\t<td>%s</td></tr>''' % self.form.userID.tag()) else: self.writeln('''\t<tr><td>User ID</td>''') self.writeln('''\t<td>%s</td></tr>''' % self.form.userID.tag()) if self.form.pw.error(): self.writeln('''\t<tr><td>Please enter a valid password</td>''') self.writeln('''\t<td>%s</td></tr>''' % self.form.pw.tag()) else: self.writeln('''\t<tr><td>Password</td>''') self.writeln('''\t<td>%s</td></tr>''' % self.form.pw.tag()) self.writeln('''\t<tr><td> </td>''') self.writeln('''\t<td>%s</td></tr>''' % self.form.button.tag()) self.writeln('''</table>''') self.writeln( self.form.endTags()) ############################# It would be nice to have a way of not having to write the fiddly HTML bits, whether using tables or DIV tags, and do something like: self.writeln(self.form.userID.label()) self.writeln(self.form.userID.tag()) self.form.userID.label() and .tag() would expand out to either the appropriate table row/cell tag or DIV tag. I guess this is what something like Cheetah template is allegedly able to do, though I have not figured out how to do that yet. Regards, Clifford Ilkay Dinamis Corporation 3266 Yonge Street, Suite 1419 Toronto, Ontario Canada M4N 3P6 Tel: 416-410-3326 |
From: Ivo v. d. W. <iv...@am...> - 2004-06-21 15:18:31
|
Hi, I regularly run into weird problems because I'm trying to pass the wrong type of object to, for example, a foreign key. How hard would it be to make SQLObject warn in such cases? I.e. class a(SQLObject): x = StringCol() # x = dummy class b(SQLObject): x = StringCol() class c(SQLObject): x = StringCol() b = ForeignKey("b") after these declarations, SQLObject will silently allow: foo = c(x="", b=a()) (or) foo.b = a() If you have enough classes, selects(), code, etc, it's pretty easy to mixup arguments, results, classes, etc. An extra check would be very welcome. Anyone else experiencing this as well? Cheers Ivo -- Drs. I.R. van der Wijk -=- Korte Leidsedwarsstraat 12 Amaze 1017 RC Amsterdam, NL -=- T +31-20-4688336 F +31-20-4688337 Zope/Plone/Content Management W http://www.amaze.nl E in...@am... Open Source Solutions W http://vanderwijk.info E iv...@am... Consultancy PGP http://vanderwijk.info/pgp |
From: Karl C. <qu...@no...> - 2004-06-21 09:56:22
|
I request/suggest syntax sugar so that you can do this: k = OtherTable.get(123) MyTable.select(MyTable.q.other == k) Instead of only: MyTable.select(MyTable.q.otherID == k.id) Second, I am trying to add a hook so that I can do this: MyTable.select(OtherTable.q.foo == 123) and have it automatically add an ID match to get: MyTable.select(AND( OtherTable.q.foo == 123, MyTable.q.otherID == OtherTable.q.id)) any suggestions on how to do this? -- Karl 2004-06-21 02:48 |
From: Karl C. <qu...@no...> - 2004-06-18 14:41:02
|
The patch below adds support for tables which have only the 'id' column. Such schema are occasionally useful (esp. for related join to another table) Index: dbconnection.py =================================================================== --- dbconnection.py (revision 1138) +++ dbconnection.py (working copy) @@ -361,6 +361,12 @@ self.sqlrepr(so.id))) def _SO_selectOne(self, so, columnNames): + if not columnNames: + return (self.queryOne("SELECT 1 FROM %s WHERE %s = %s" % + (so._table, + so._idName, + self.sqlrepr(so.id))) + and ()) return self.queryOne("SELECT %s FROM %s WHERE %s = %s" % (", ".join(columnNames), so._table, Index: main.py =================================================================== --- main.py (revision 1138) +++ main.py (working copy) @@ -603,7 +603,7 @@ if not selectResults: dbNames = [col.dbName for col in self._SO_columns] selectResults = self._connection._SO_selectOne(self, dbNames) - if not selectResults: + if selectResults is None: raise SQLObjectNotFound, "The object %s by the ID %s does not exist" % (self.__class__.__name__, self.id) self._SO_selectInit(selectResults) self._SO_createValues = {} -- Karl 2004-06-18 07:30 |
From: David W. <da...@su...> - 2004-06-18 11:12:25
|
Clifford, >> How would you represent an optional one to one relationship with >> SQLObject? A use case would be a system where there is a table for >> person and another for donor. A person can be a donor but need not be >> a donor. If a person becomes a donor, there must not be more than one >> donor row. Donations are handled in another table. > > > Answering my own question, one way of dealing with this is to make the > foreign key in the dependent table unique. e.g. > > create table donor ( > id serial primary key, > person_id integer unique reference person(id), > ... > > Now to figure out how to capture and decode the errors raised by > PostgreSQL. I would use the same primary key as used in the person table as both primary key and foreign key. That neatly enforces that you cannot have 2 donors for one person. Regards Dave -- David Warnock, Sundayta Ltd. http://www.sundayta.com iDocSys for Document Management. VisibleResults for Fundraising. Development and Hosting of Web Applications and Sites. |
From: Philippe N. <sw...@fr...> - 2004-06-17 16:43:44
|
On Thu, Jun 17, 2004 at 01:18:08PM -0300, Michel Thadeu wrote: > Hi guys! >=20 > I know there is a count() method for the *.select() object... I know > Philippe Normand write a patch to sum() function too, does anyone have > write a max() method? >=20 At revision 152, there doesn't seem to have any max(). > If no one had write the patch, i change my own copy of sqlobject (the > ultimate version in svn), but I don?t know how to write the patch :) I > can write folowing the Philippe example (the change was made based on > the Phillipe change, almost everything the same code), but before learn > how to write a patch, I want to know if is there a patch made... >=20 Well it's quite simple. Add a "max" method in main.SelectResults. This method has to build an SQL expression which is then passed to the "accumulate" method. In your case the SQL expression would be "MAX(%s)" % attribute I guess. Finally to produce the patch, use svn diff :) --=20 Philippe Normand | base-art dot net |
From: <mic...@ya...> - 2004-06-17 16:18:21
|
Hi guys! I know there is a count() method for the *.select() object... I know Philippe Normand write a patch to sum() function too, does anyone have write a max() method? If no one had write the patch, i change my own copy of sqlobject (the ultimate version in svn), but I don´t know how to write the patch :) I can write folowing the Philippe example (the change was made based on the Phillipe change, almost everything the same code), but before learn how to write a patch, I want to know if is there a patch made... thanks for the attention! seeya ===== -- Michel Thadeu Sabchuk Curitiba/PR ______________________________________________________________________ Participe da pesquisa global sobre o Yahoo! Mail: http://br.surveys.yahoo.com/global_mail_survey_br |
From: Justus P. <ju...@ry...> - 2004-06-17 14:00:10
|
On Thu, Jun 17, 2004 at 06:38:31AM -0400, CLIFFORD ILKAY wrote: > I think this will try to reference a join table called grp_person, which is > not what I want. The table is actually called grp_memberships. I know it is > possible to override class and attribute names but I do not think the class > GrpPerson is actually generated. How should I deal with this? I haven't actually tried it but the documentation says to use intermediateTable = grp_memberships. -- Justus |
From: CLIFFORD I. <cli...@di...> - 2004-06-17 13:08:38
|
At 07:27 AM 17/06/2004 -0400, CLIFFORD ILKAY wrote: >Hi, > >How would you represent an optional one to one relationship with >SQLObject? A use case would be a system where there is a table for person >and another for donor. A person can be a donor but need not be a donor. If >a person becomes a donor, there must not be more than one donor row. >Donations are handled in another table. Answering my own question, one way of dealing with this is to make the foreign key in the dependent table unique. e.g. create table donor ( id serial primary key, person_id integer unique reference person(id), ... Now to figure out how to capture and decode the errors raised by PostgreSQL. Regards, Clifford Ilkay Dinamis Corporation 3266 Yonge Street, Suite 1419 Toronto, Ontario Canada M4N 3P6 Tel: 416-410-3326 |
From: CLIFFORD I. <cli...@di...> - 2004-06-17 10:39:54
|
Hi, Many to many relationships are represented by RelatedJoin but apparently, the join class is not referenced explicitly. What happens if we have preexisting tables and their names do not meet the criteria for SQLObject? e.g. say we have a many to many relationship between people and groups. class Person(SQLObject): userId = StringCol(length=16, alternateID=True) name = StringCol(length=50) groups = RelatedJoin('Grp') class Grp(SQLObject): codecode = StringCol(length=6, alternateID=True, unique=True, notNone=True) people = RelatedJoin('Person') I think this will try to reference a join table called grp_person, which is not what I want. The table is actually called grp_memberships. I know it is possible to override class and attribute names but I do not think the class GrpPerson is actually generated. How should I deal with this? Regards, Clifford Ilkay Dinamis Corporation 3266 Yonge Street, Suite 1419 Toronto, Ontario Canada M4N 3P6 Tel: 416-410-3326 |
From: alexander s. <al...@an...> - 2004-06-17 10:22:46
|
CLIFFORD ILKAY wrote, at 17.06.2004 14:27: > How would you represent an optional one to one relationship with > SQLObject? A use case would be a system where there is a table for > person and another for donor. A person can be a donor but need not be a > donor. If a person becomes a donor, there must not be more than one > donor row. Donations are handled in another table. we use inheritance patch by Daniel Savard for that. see http://sourceforge.net/mailarchive/forum.php?thread_id=3802832&forum_id=30269 best wishes, alex. |
From: CLIFFORD I. <cli...@di...> - 2004-06-17 09:42:20
|
Hi, How would you represent an optional one to one relationship with SQLObject? A use case would be a system where there is a table for person and another for donor. A person can be a donor but need not be a donor. If a person becomes a donor, there must not be more than one donor row. Donations are handled in another table. Regards, Clifford Ilkay Dinamis Corporation 3266 Yonge Street, Suite 1419 Toronto, Ontario Canada M4N 3P6 Tel: 416-410-3326 |
From: CLIFFORD I. <cli...@di...> - 2004-06-17 09:42:20
|
Hi, I saw no obvious way to represent referential integrity constraints if SQLObject generated the table. I can drop the table that should be referenced without doing a cascade if the table is generated by SO. My workaround is to just generate the table via a SQL script, which I really do not mind as it gives me greater control anyway. Having done that, is there a way that I can capture the class declaration in case I have to fine tune it? I know I can do a "_fromDatabase=true" after declaring the class and then do a dir(MyClass) to find out what its attributes are but that gives me too much information and not enough information at the same time. Regards, Clifford Ilkay Dinamis Corporation 3266 Yonge Street, Suite 1419 Toronto, Ontario Canada M4N 3P6 Tel: 416-410-3326 |
From: Chris G. <ch...@il...> - 2004-06-17 01:00:20
|
On 16 Jun 2004, Cary Fitzhugh said: > File "C:\PYTHON23\Lib\site-packages\mod_python\Session.py", line > 132, in > __init__ > Cookie.add_cookie(self._req, self.make_cookie()) > > File "C:\PYTHON23\Lib\site-packages\mod_python\Session.py", line > 160, in > make_cookie > c.path = dirpath[len(docroot):] > > TypeError: unsubscriptable object Could you give us some more information? This traceback is pretty obtuse... How is SQLObject involved in the value of "dirpath"? And what IS dirpath's value at the point when it fails? |
From: Cary F. <ckf...@ho...> - 2004-06-16 14:52:01
|
Hello, Another bloke posted a while ago as well and said he hadn't received an answer. What is going on here? Have you ever seen this error before? I think that there is some problem in getting the dirpath from the HTTP header, but don't know enough about this to figure it out. If I can't get this to work I'll have to bag SQLObject, which would be a loss since it has so much potential. This error occurs when I use the publisher handler to view a page, and in that function it tries to create a session object, which is on line 24. Any ideas? Mod_python error: "PythonHandler mod_python.publisher" Traceback (most recent call last): File "C:\PYTHON23\Lib\site-packages\mod_python\apache.py", line 299, in HandlerDispatch result = object(req) File "C:\PYTHON23\Lib\site-packages\mod_python\publisher.py", line 136, in handler result = util.apply_fs_data(object, req.form, req=req) File "C:\PYTHON23\Lib\site-packages\mod_python\util.py", line 361, in apply_fs_data return object(**args) File "C:/Program Files/Apache Group/Apache2/htdocs\Login.py", line 24, in loadPage sess = Session(req, secret=SECRET_CODE) File "C:\PYTHON23\Lib\site-packages\mod_python\Session.py", line 386, in Session timeout=timeout, lock=lock) File "C:\PYTHON23\Lib\site-packages\mod_python\Session.py", line 358, in __init__ timeout=timeout, lock=lock) File "C:\PYTHON23\Lib\site-packages\mod_python\Session.py", line 132, in __init__ Cookie.add_cookie(self._req, self.make_cookie()) File "C:\PYTHON23\Lib\site-packages\mod_python\Session.py", line 160, in make_cookie c.path = dirpath[len(docroot):] TypeError: unsubscriptable object Cary FitzHugh Software Engineer _________________________________________________________________ FREE pop-up blocking with the new MSN Toolbar get it now! http://toolbar.msn.click-url.com/go/onm00200415ave/direct/01/ |