Thread: [SQLObject] Escaping Conection URIs
SQLObject is a Python ORM.
Brought to you by:
ianbicking,
phd
From: Sidnei da S. <si...@en...> - 2006-05-16 13:30:16
|
I've recently used the 'pathname2url' function from urllib to convert a pathname to a file:// url for sqlite. However, to my surprise, pathname2url would quote characters in the generated url, namely spaces would be turned into %20. More (or less) surprisingly, sqlobject would not accept the quoted characters. Bug or feature? -- Sidnei da Silva Enfold Systems http://enfoldsystems.com Fax +1 832 201 8856 Office +1 713 942 2377 Ext 214 |
From: Chaz. <epr...@gm...> - 2006-05-16 15:49:27
|
Has anyone used SQLObject with sqlite on the Twisted framework? I would like to know if there are any "gotchas" that I should watch out for before beginning. Peace, Chaz. |
From: Kevin D. <da...@gm...> - 2006-05-16 17:51:14
|
On 5/16/06, Chaz. <epr...@gm...> wrote: > Has anyone used SQLObject with sqlite on the Twisted framework? I would > like to know if there are any "gotchas" that I should watch out for > before beginning. It depends on your exact usage. Generally speaking, they are incompatible. SQLObject database access is potentially a blocking operation, so you don't want that to happen inside your main Twisted event loop. If your database access is fast enough (and it *can* be with sqlite), you can just fudge it and use SQLObject. But, if any database access takes time to run, it will hold up your whole application. Another alternative is to put all of your database access on a thread or threads (deferToThread). Kevin |
From: Chaz. <epr...@gm...> - 2006-05-16 17:54:11
|
Thanks Kevin. That is what I suspected but I wanted to make sure. I guess I was hoping I had missed something! Chaz. Kevin Dangoor wrote: > On 5/16/06, Chaz. <epr...@gm...> wrote: >> Has anyone used SQLObject with sqlite on the Twisted framework? I would >> like to know if there are any "gotchas" that I should watch out for >> before beginning. > > It depends on your exact usage. Generally speaking, they are > incompatible. SQLObject database access is potentially a blocking > operation, so you don't want that to happen inside your main Twisted > event loop. > > If your database access is fast enough (and it *can* be with sqlite), > you can just fudge it and use SQLObject. But, if any database access > takes time to run, it will hold up your whole application. > > Another alternative is to put all of your database access on a thread > or threads (deferToThread). > > Kevin > |
From: Oleg B. <ph...@ma...> - 2006-05-16 17:16:45
|
On Tue, May 16, 2006 at 10:29:12AM -0300, Sidnei da Silva wrote: > More (or less) surprisingly, sqlobject would not accept the quoted > characters. > > Bug or feature? A bug caused by the home-grown DBConnection._parseURI() instead of using urllib or urlparse. Oleg. -- Oleg Broytmann http://phd.pp.ru/ ph...@ph... Programmers don't die, they just GOSUB without RETURN. |
From: Bill C. <sql...@ce...> - 2006-05-17 00:01:41
|
On Tue, May 16, 2006, Sidnei da Silva wrote: >I've recently used the 'pathname2url' function from urllib to convert >a pathname to a file:// url for sqlite. > >However, to my surprise, pathname2url would quote characters in the >generated url, namely spaces would be turned into %20. Whitespace in pathnames is evil, and should be avoided by people with a clue (you can't expect clueless end users to understand this). Bill -- INTERNET: bill@Celestial.COM Bill Campbell; Celestial Software LLC URL: http://www.celestial.com/ PO Box 820; 6641 E. Mercer Way FAX: (206) 232-9186 Mercer Island, WA 98040-0820; (206) 236-1676 ``Our Foreign dealings are an Open Book, generally a Check Book.'' Will Rogers |
From: Sidnei da S. <si...@en...> - 2006-05-17 02:53:37
|
On Tue, May 16, 2006 at 05:01:02PM -0700, Bill Campbell wrote: | On Tue, May 16, 2006, Sidnei da Silva wrote: | >I've recently used the 'pathname2url' function from urllib to convert | >a pathname to a file:// url for sqlite. | > | >However, to my surprise, pathname2url would quote characters in the | >generated url, namely spaces would be turned into %20. | | Whitespace in pathnames is evil, and should be avoided by people with a | clue (you can't expect clueless end users to understand this). Tell that to Windows users, specially ones that have their 'Program Files' directory localized to their native language. :) -- Sidnei da Silva Enfold Systems http://enfoldsystems.com Fax +1 832 201 8856 Office +1 713 942 2377 Ext 214 |
From: Bill C. <sql...@ce...> - 2006-05-17 03:19:49
|
On Tue, May 16, 2006, Sidnei da Silva wrote: >On Tue, May 16, 2006 at 05:01:02PM -0700, Bill Campbell wrote: >| On Tue, May 16, 2006, Sidnei da Silva wrote: >| >I've recently used the 'pathname2url' function from urllib to convert >| >a pathname to a file:// url for sqlite. >| > >| >However, to my surprise, pathname2url would quote characters in the >| >generated url, namely spaces would be turned into %20. >| >| Whitespace in pathnames is evil, and should be avoided by people with a >| clue (you can't expect clueless end users to understand this). > >Tell that to Windows users, specially ones that have their 'Program >Files' directory localized to their native language. :) I could make a strong arguments that all Windows users are clueless or they wouldn't install the Microsoft virus in the first place. Bill -- INTERNET: bill@Celestial.COM Bill Campbell; Celestial Software LLC URL: http://www.celestial.com/ PO Box 820; 6641 E. Mercer Way FAX: (206) 232-9186 Mercer Island, WA 98040-0820; (206) 236-1676 ``The man who produces while others dispose of his product is a slave.'' Ayn Rand |