Re: [SQLObject] SQLObject 0.9.2b1

2007-11-27 Thread Oleg Broytmann
On Tue, Nov 27, 2007 at 11:38:46PM +0300, Oleg Broytmann wrote: > -import MySQLdb, MySQLdb.constants.CR, MySQLdb.constants.ER > +import MySQLdb Revert this. These constants are not used in SQLObject 0.7, but required in later versions. Oleg. -- Oleg Broytmann

Re: [SQLObject] SQLObject 0.9.2b1

2007-11-27 Thread Oleg Broytmann
On Tue, Nov 27, 2007 at 11:01:04PM +0300, Oleg Broytmann wrote: > I have to fix the parameter Like in the attached patch. Oleg. -- Oleg Broytmannhttp://phd.pp.ru/[EMAIL PROTECTED] Programmers don't die, they just GOSUB without RETURN. Index: mysqlconnec

Re: [SQLObject] SQLObject 0.9.2b1

2007-11-27 Thread Oleg Broytmann
On Tue, Nov 27, 2007 at 08:49:51PM +0100, Markus Gritsch wrote: > The patch works great! Thank you for the report. > If sqlobject_encoding is present, it is not > silently ignored, but an Exception is raised: 'got an unexpected > keyword', which is ok. No, it is not ok. I am going to apply

Re: [SQLObject] SQLObject 0.9.2b1

2007-11-27 Thread Markus Gritsch
On 27/11/2007, Oleg Broytmann <[EMAIL PROTECTED]> wrote: > On Tue, Nov 27, 2007 at 08:17:55PM +0100, Markus Gritsch wrote: > > use_unicode specifies only if MySQLdb should *return* string values as > > unicode or as strings. Queries can be issued using unicode or string > > regardless of this para

Re: [SQLObject] SQLObject 0.9.2b1

2007-11-27 Thread Oleg Broytmann
On Tue, Nov 27, 2007 at 08:17:55PM +0100, Markus Gritsch wrote: > use_unicode specifies only if MySQLdb should *return* string values as > unicode or as strings. Queries can be issued using unicode or string > regardless of this parameter. This means SQLObject doesn't need to encode queries at

Re: [SQLObject] SQLObject 0.9.2b1

2007-11-27 Thread Markus Gritsch
On 27/11/2007, Markus Gritsch <[EMAIL PROTECTED]> wrote: > On 27/11/2007, Oleg Broytmann <[EMAIL PROTECTED]> wrote: > > On Tue, Nov 27, 2007 at 08:04:10PM +0100, Markus Gritsch wrote: > > > On 27/11/2007, Oleg Broytmann <[EMAIL PROTECTED]> wrote: > > > import MySQLdb > > > > > > x = MySQLdb.connect

Re: [SQLObject] SQLObject 0.9.2b1

2007-11-27 Thread Markus Gritsch
On 27/11/2007, Oleg Broytmann <[EMAIL PROTECTED]> wrote: > On Tue, Nov 27, 2007 at 08:04:10PM +0100, Markus Gritsch wrote: > > On 27/11/2007, Oleg Broytmann <[EMAIL PROTECTED]> wrote: > > import MySQLdb > > > > x = MySQLdb.connect(db='test', user='markus', charset='utf8') # > > supplying charset im

Re: [SQLObject] SQLObject 0.9.2b1

2007-11-27 Thread David Turner
On Tue, 2007-11-27 at 19:33 +0100, Markus Gritsch wrote: > > P.S. Thank you for your example, I will look into it in more detail. > > Ah, this example looks quite familiar ;) Indeed. > Please look at the attached screenshots, they show that everything is > ok. Aha! I have tracked down the pr

Re: [SQLObject] SQLObject 0.9.2b1

2007-11-27 Thread Oleg Broytmann
On Tue, Nov 27, 2007 at 08:04:10PM +0100, Markus Gritsch wrote: > On 27/11/2007, Oleg Broytmann <[EMAIL PROTECTED]> wrote: > import MySQLdb > > x = MySQLdb.connect(db='test', user='markus', charset='utf8') # > supplying charset implies use_unicode=True > c = x.cursor() > > c.execute('DROP TABLE p

Re: [SQLObject] SQLObject 0.9.2b1

2007-11-27 Thread Markus Gritsch
On 27/11/2007, Oleg Broytmann <[EMAIL PROTECTED]> wrote: > >IWBN if you run the tests using MySQLdb directly, or at least patch > SQLObject to not set "need_unicode" in MySQLConnection. import MySQLdb x = MySQLdb.connect(db='test', user='markus', charset='utf8') # supplying charset implies us

Re: [SQLObject] SQLObject 0.9.2b1

2007-11-27 Thread Oleg Broytmann
On Tue, Nov 27, 2007 at 07:48:11PM +0100, Markus Gritsch wrote: > On 27/11/2007, Oleg Broytmann <[EMAIL PROTECTED]> wrote: > >There were reports that MySQLdb 1.2.1+ requires unicode, not merely > > allows it. > > I cannot confirm this. It very much could be that the report was about a beta

Re: [SQLObject] SQLObject 0.9.2b1

2007-11-27 Thread Markus Gritsch
On 27/11/2007, Oleg Broytmann <[EMAIL PROTECTED]> wrote: > On Tue, Nov 27, 2007 at 05:54:41PM +0100, Markus Gritsch wrote: > > Since it is allowed to use unicode and strings in a query, why is > > there a need to force unicode? > >There were reports that MySQLdb 1.2.1+ requires unicode, not mer

Re: [SQLObject] SQLObject 0.9.2b1

2007-11-27 Thread David Turner
On Tue, 2007-11-27 at 18:01 +0100, Markus Gritsch wrote: > On 27/11/2007, David Turner <[EMAIL PROTECTED]> wrote: > > On Tue, 2007-11-27 at 15:17 +0100, Markus Gritsch wrote: > > > > Conclusion: SQLObject is doing the wrong thing on many levels for MySQL. > > No it is not. Using UTF-8 is an ideal

Re: [SQLObject] SQLObject 0.9.2b1

2007-11-27 Thread Oleg Broytmann
On Tue, Nov 27, 2007 at 05:54:41PM +0100, Markus Gritsch wrote: > Since it is allowed to use unicode and strings in a query, why is > there a need to force unicode? There were reports that MySQLdb 1.2.1+ requires unicode, not merely allows it. Oleg. -- Oleg Broytmannhttp://ph

Re: [SQLObject] SQLObject 0.9.2b1

2007-11-27 Thread David Turner
On Tue, 2007-11-27 at 15:17 +0100, Markus Gritsch wrote: > On 27/11/2007, Oleg Broytmann <[EMAIL PROTECTED]> wrote: > > On Tue, Nov 27, 2007 at 02:56:59PM +0100, Markus Gritsch wrote: > > > But if a BLOB contains just bytes which do *not* trigger the > > > Exception, the BLOB in the query *does* ge

Re: [SQLObject] SQLObject 0.9.2b1

2007-11-27 Thread Markus Gritsch
On 27/11/2007, Oleg Broytmann <[EMAIL PROTECTED]> wrote: > On Tue, Nov 27, 2007 at 07:44:49PM +0300, Oleg Broytmann wrote: > >Then the entire "need_unicode" in SQLObject is wrong because it forces > > SQLObject to use unicode for MySQLdb version 1.2.1 and up. > >Should it be a MySQLConnecti

Re: [SQLObject] SQLObject 0.9.2b1

2007-11-27 Thread Oleg Broytmann
On Tue, Nov 27, 2007 at 07:44:49PM +0300, Oleg Broytmann wrote: >Then the entire "need_unicode" in SQLObject is wrong because it forces > SQLObject to use unicode for MySQLdb version 1.2.1 and up. Should it be a MySQLConnection/DBuri parameter instead of calculated var? Oleg. -- Oleg

Re: [SQLObject] SQLObject 0.9.2b1

2007-11-27 Thread Oleg Broytmann
On Tue, Nov 27, 2007 at 05:38:23PM +0100, Markus Gritsch wrote: > As I read the docs, you are *allowed* to use unicode in queried, not > required. Then the entire "need_unicode" in SQLObject is wrong because it forces SQLObject to use unicode for MySQLdb version 1.2.1 and up. Oleg. -- Ol

Re: [SQLObject] SQLObject 0.9.2b1

2007-11-27 Thread Markus Gritsch
On 27/11/2007, Oleg Broytmann <[EMAIL PROTECTED]> wrote: > On Tue, Nov 27, 2007 at 07:16:16PM +0300, Oleg Broytmann wrote: > > On Tue, Nov 27, 2007 at 06:08:31PM +0200, Dan Pascu wrote: > > > So I think we should: > > > 1. get rid of the try/except > >Sorry, sent that to fast. > > >The poin

Re: [SQLObject] SQLObject 0.9.2b1

2007-11-27 Thread Oleg Broytmann
On Tue, Nov 27, 2007 at 07:16:16PM +0300, Oleg Broytmann wrote: > On Tue, Nov 27, 2007 at 06:08:31PM +0200, Dan Pascu wrote: > > So I think we should: > > 1. get rid of the try/except Sorry, sent that to fast. >The point taken. Thank you! But... > > 2. only use the connection encoding

Re: [SQLObject] SQLObject 0.9.2b1

2007-11-27 Thread Oleg Broytmann
On Tue, Nov 27, 2007 at 06:08:31PM +0200, Dan Pascu wrote: > So I think we should: > 1. get rid of the try/except > 2. only use the connection encoding to encode strings / string values > 3. use latin1 to encode/decode blobs that ensures that they are sent > unmodified to the db The point take

Re: [SQLObject] SQLObject 0.9.2b1

2007-11-27 Thread Dan Pascu
On Tuesday 27 November 2007, Oleg Broytmann wrote: > On Tue, Nov 27, 2007 at 03:17:23PM +0100, Markus Gritsch wrote: > > Having this try/except > > here unconditionally for all cases > >Let's satisfy all (to possible extent) - let's make a parameter for > MySQLConnection (and SQLObject DB URI)

Re: [SQLObject] SQLObject 0.9.2b1

2007-11-27 Thread Oleg Broytmann
On Tue, Nov 27, 2007 at 03:17:23PM +0100, Markus Gritsch wrote: > Having this try/except > here unconditionally for all cases Let's satisfy all (to possible extent) - let's make a parameter for MySQLConnection (and SQLObject DB URI) that allows/prevents the try/except. By default it could be "d

Re: [SQLObject] SQLObject 0.9.2b1

2007-11-27 Thread Oleg Broytmann
On Tue, Nov 27, 2007 at 03:17:23PM +0100, Markus Gritsch wrote: > Instead of getting an exception, the > code just continues to run, issuing a query containing the wrong > characters for the DB. [skip] > But I doubt that the BLOB would be inserted *correctly* if it gets > converted to unicode using

Re: [SQLObject] SQLObject 0.9.2b1

2007-11-27 Thread Markus Gritsch
On 27/11/2007, Oleg Broytmann <[EMAIL PROTECTED]> wrote: > On Tue, Nov 27, 2007 at 02:56:59PM +0100, Markus Gritsch wrote: > > But if a BLOB contains just bytes which do *not* trigger the > > Exception, the BLOB in the query *does* get converted to unicode, and > > I doubt this would be the desired

Re: [SQLObject] SQLObject 0.9.2b1

2007-11-27 Thread Oleg Broytmann
On Tue, Nov 27, 2007 at 02:56:59PM +0100, Markus Gritsch wrote: > But if a BLOB contains just bytes which do *not* trigger the > Exception, the BLOB in the query *does* get converted to unicode, and > I doubt this would be the desired behavior. The absence of try/except in question wouldn't pre

Re: [SQLObject] SQLObject 0.9.2b1

2007-11-27 Thread Markus Gritsch
On 27/11/2007, Oleg Broytmann <[EMAIL PROTECTED]> wrote: > On Tue, Nov 27, 2007 at 02:43:06PM +0100, Markus Gritsch wrote: > > On 27/11/2007, Oleg Broytmann <[EMAIL PROTECTED]> wrote: > > > if self.need_unicode and not isinstance(query, unicode): > > > -try: > >

Re: [SQLObject] SQLObject 0.9.2b1

2007-11-27 Thread Oleg Broytmann
On Tue, Nov 27, 2007 at 02:43:06PM +0100, Markus Gritsch wrote: > On 27/11/2007, Oleg Broytmann <[EMAIL PROTECTED]> wrote: > > if self.need_unicode and not isinstance(query, unicode): > > -try: > > -query = unicode(query, self.encoding) >

Re: [SQLObject] SQLObject 0.9.2b1

2007-11-27 Thread Markus Gritsch
On 27/11/2007, Oleg Broytmann <[EMAIL PROTECTED]> wrote: > On Tue, Nov 27, 2007 at 02:02:02PM +0100, Markus Gritsch wrote: > > How about applying the attached patch? > > --- mysqlconnection_orig.py 2007-09-27 02:18:28.0 +0200 > +++ mysqlconnection.py 2007-11-27 13:57:30.324125000 +0100

Re: [SQLObject] SQLObject 0.9.2b1

2007-11-27 Thread Oleg Broytmann
On Tue, Nov 27, 2007 at 02:02:02PM +0100, Markus Gritsch wrote: > How about applying the attached patch? --- mysqlconnection_orig.py 2007-09-27 02:18:28.0 +0200 +++ mysqlconnection.py 2007-11-27 13:57:30.324125000 +0100 @@ -110,10 +110,7 @@ # For MySQLdb 1.2.1 and lat

Re: [SQLObject] SQLObject 0.9.2b1

2007-11-27 Thread Markus Gritsch
On 04/10/2007, Oleg Broytmann <[EMAIL PROTECTED]> wrote: > On Wed, Oct 03, 2007 at 06:15:21PM -0400, David Turner wrote: > > On Wed, 2007-10-03 at 23:57 +0200, Markus Gritsch wrote: > > > Ah, I see. I have no objection against removing the conversion to > > > unicode completely. > > > > Ok, I comm

Re: [SQLObject] SQLObject 0.9.2b1

2007-10-05 Thread David Turner
On Thu, 2007-10-04 at 17:40 -0400, David Turner wrote: > On Thu, 2007-10-04 at 14:47 +0200, Markus Gritsch wrote: > > On 10/4/07, Oleg Broytmann <[EMAIL PROTECTED]> wrote: > > > On Thu, Oct 04, 2007 at 01:50:52PM +0200, Markus Gritsch wrote: > > > > In MySQLdb queries are *allowed* to be unicode. >

Re: [SQLObject] SQLObject 0.9.2b1

2007-10-04 Thread David Turner
On Thu, 2007-10-04 at 14:47 +0200, Markus Gritsch wrote: > On 10/4/07, Oleg Broytmann <[EMAIL PROTECTED]> wrote: > > On Thu, Oct 04, 2007 at 01:50:52PM +0200, Markus Gritsch wrote: > > > In MySQLdb queries are *allowed* to be unicode. > > > > I meant - there were a period when SQLObject forces quer

Re: [SQLObject] SQLObject 0.9.2b1

2007-10-04 Thread Markus Gritsch
On 10/4/07, Oleg Broytmann <[EMAIL PROTECTED]> wrote: > On Thu, Oct 04, 2007 at 01:50:52PM +0200, Markus Gritsch wrote: > > In MySQLdb queries are *allowed* to be unicode. > > I meant - there were a period when SQLObject forces queries to be > unicode for MySQLdb 1.2.1+. Is that over now? Do we all

Re: [SQLObject] SQLObject 0.9.2b1

2007-10-04 Thread Oleg Broytmann
On Thu, Oct 04, 2007 at 01:50:52PM +0200, Markus Gritsch wrote: > On 10/4/07, Oleg Broytmann <[EMAIL PROTECTED]> wrote: > > We've finally returned to the > > beginning - do not use unicode with MySQLdb at all? > > No, I don't think this is true. In MySQLdb queries are *allowed* to be > unicode.

Re: [SQLObject] SQLObject 0.9.2b1

2007-10-04 Thread Markus Gritsch
On 10/4/07, Oleg Broytmann <[EMAIL PROTECTED]> wrote: >Now where is self.need_unicode used? I don't know. > We've finally returned to the > beginning - do not use unicode with MySQLdb at all? No, I don't think this is true. In MySQLdb queries are *allowed* to be unicode. >From the 'MySQLdb

Re: [SQLObject] SQLObject 0.9.2b1

2007-10-03 Thread Oleg Broytmann
On Wed, Oct 03, 2007 at 06:15:21PM -0400, David Turner wrote: > On Wed, 2007-10-03 at 23:57 +0200, Markus Gritsch wrote: > > Ah, I see. I have no objection against removing the conversion to > > unicode completely. > > Ok, I committed it to trunk. Thanks for your suggestions. Now where is se

Re: [SQLObject] SQLObject 0.9.2b1

2007-10-03 Thread David Turner
On Wed, 2007-10-03 at 23:57 +0200, Markus Gritsch wrote: > On 10/3/07, David Turner <[EMAIL PROTECTED]> wrote: > > On Wed, 2007-10-03 at 22:57 +0200, Markus Gritsch wrote: > > > http://www.mail-archive.com/sqlobject-discuss@lists.sourceforge.net/msg02607.html > > > > This appears to be an example w

Re: [SQLObject] SQLObject 0.9.2b1

2007-10-03 Thread Markus Gritsch
On 10/3/07, David Turner <[EMAIL PROTECTED]> wrote: > On Wed, 2007-10-03 at 22:57 +0200, Markus Gritsch wrote: > > http://www.mail-archive.com/sqlobject-discuss@lists.sourceforge.net/msg02607.html > > This appears to be an example which breaks when you convert a unicode > string to unicode. I was

Re: [SQLObject] SQLObject 0.9.2b1

2007-10-03 Thread David Turner
On Wed, 2007-10-03 at 22:57 +0200, Markus Gritsch wrote: > On 10/3/07, Markus Gritsch <[EMAIL PROTECTED]> wrote: > > On 10/3/07, David Turner <[EMAIL PROTECTED]> wrote: > > > I was thinking that it might make more sense to just remove that whole > > > section. I understand that whoever wrote that

Re: [SQLObject] SQLObject 0.9.2b1

2007-10-03 Thread David Turner
On Wed, 2007-10-03 at 22:49 +0200, Markus Gritsch wrote: > On 10/3/07, David Turner <[EMAIL PROTECTED]> wrote: > > I was thinking that it might make more sense to just remove that whole > > section. I understand that whoever wrote that code thought it was > > necessary to convert to Unicode, but I

Re: [SQLObject] SQLObject 0.9.2b1

2007-10-03 Thread Markus Gritsch
On 10/3/07, Markus Gritsch <[EMAIL PROTECTED]> wrote: > On 10/3/07, David Turner <[EMAIL PROTECTED]> wrote: > > I was thinking that it might make more sense to just remove that whole > > section. I understand that whoever wrote that code thought it was > > necessary to convert to Unicode, but I th

Re: [SQLObject] SQLObject 0.9.2b1

2007-10-03 Thread Markus Gritsch
On 10/3/07, David Turner <[EMAIL PROTECTED]> wrote: > I was thinking that it might make more sense to just remove that whole > section. I understand that whoever wrote that code thought it was > necessary to convert to Unicode, but I think it is not. Can you comment > on this idea? There was a t

Re: [SQLObject] SQLObject 0.9.2b1

2007-10-03 Thread Oleg Broytmann
On Wed, Oct 03, 2007 at 04:46:00PM -0400, David Turner wrote: > > > > if self.need_unicode and not isinstance(query, unicode): > > > > try: > > > > query = unicode(query, self.encoding) > > > > except UnicodeError: > > > > pass > > I was thinking that it

Re: [SQLObject] SQLObject 0.9.2b1

2007-10-03 Thread David Turner
On Wed, 2007-10-03 at 11:22 +0200, Andres Freund wrote: > Hi, > > On Tuesday 02 October 2007, Oleg Broytmann wrote in "Re: [SQLObject] > SQLObject > 0.9.2b1": > > Hello! > > > > On Tue, Oct 02, 2007 at 09:34:08AM +0200, Markus Gritsch wrote: >

Re: [SQLObject] SQLObject 0.9.2b1

2007-10-03 Thread Andres Freund
Hi, On Tuesday 02 October 2007, Oleg Broytmann wrote in "Re: [SQLObject] SQLObject 0.9.2b1": > Hello! > > On Tue, Oct 02, 2007 at 09:34:08AM +0200, Markus Gritsch wrote: > > the new version 0.9.2b1 added a try except block around the conversion > > to unicode of

Re: [SQLObject] SQLObject 0.9.2b1

2007-10-02 Thread Markus Gritsch
On 10/2/07, Oleg Broytmann <[EMAIL PROTECTED]> wrote: >Do you have a problem with the new code? No, so far it works fine. Markus - This SF.net email is sponsored by: Microsoft Defy all challenges. Microsoft(R) Visual St

Re: [SQLObject] SQLObject 0.9.2b1

2007-10-02 Thread Oleg Broytmann
Hello! On Tue, Oct 02, 2007 at 09:34:08AM +0200, Markus Gritsch wrote: > the new version 0.9.2b1 added a try except block around the conversion > to unicode of the query in mysqlconnection.py: > > if self.need_unicode and not isinstance(query, unicode): > try: > query = un

Re: [SQLObject] SQLObject 0.9.2b1

2007-10-02 Thread Markus Gritsch
Hi, the new version 0.9.2b1 added a try except block around the conversion to unicode of the query in mysqlconnection.py: if self.need_unicode and not isinstance(query, unicode): try: query = unicode(query, self.encoding) except UnicodeError: pass In w

[SQLObject] SQLObject 0.9.2b1

2007-10-01 Thread Oleg Broytmann
Hello! I'm pleased to announce the 0.9.2b1, the first beta of 0.9.2 release of SQLObject. What is SQLObject = SQLObject is an object-relational mapper. Your database tables are described as classes, and rows are instances of those classes. SQLObject is meant to be easy to use