sqlobject-cvs Mailing List for SQLObject (Page 187)
SQLObject is a Python ORM.
Brought to you by:
ianbicking,
phd
You can subscribe to this list here.
| 2003 |
Jan
|
Feb
|
Mar
(9) |
Apr
(74) |
May
(29) |
Jun
(16) |
Jul
(28) |
Aug
(10) |
Sep
(57) |
Oct
(9) |
Nov
(29) |
Dec
(12) |
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 2004 |
Jan
(7) |
Feb
(14) |
Mar
(6) |
Apr
(3) |
May
(12) |
Jun
(34) |
Jul
(9) |
Aug
(29) |
Sep
(22) |
Oct
(2) |
Nov
(15) |
Dec
(52) |
| 2005 |
Jan
(47) |
Feb
(78) |
Mar
(14) |
Apr
(35) |
May
(33) |
Jun
(16) |
Jul
(26) |
Aug
(63) |
Sep
(40) |
Oct
(96) |
Nov
(96) |
Dec
(123) |
| 2006 |
Jan
(159) |
Feb
(144) |
Mar
(64) |
Apr
(31) |
May
(88) |
Jun
(48) |
Jul
(16) |
Aug
(64) |
Sep
(87) |
Oct
(92) |
Nov
(56) |
Dec
(76) |
| 2007 |
Jan
(94) |
Feb
(103) |
Mar
(126) |
Apr
(123) |
May
(85) |
Jun
(11) |
Jul
(130) |
Aug
(47) |
Sep
(65) |
Oct
(70) |
Nov
(12) |
Dec
(11) |
| 2008 |
Jan
(30) |
Feb
(55) |
Mar
(88) |
Apr
(20) |
May
(50) |
Jun
|
Jul
(38) |
Aug
(1) |
Sep
(9) |
Oct
(5) |
Nov
(6) |
Dec
(39) |
| 2009 |
Jan
(8) |
Feb
(16) |
Mar
(3) |
Apr
(33) |
May
(44) |
Jun
(1) |
Jul
(10) |
Aug
(33) |
Sep
(74) |
Oct
(22) |
Nov
|
Dec
(15) |
| 2010 |
Jan
(28) |
Feb
(22) |
Mar
(46) |
Apr
(29) |
May
(1) |
Jun
(1) |
Jul
(27) |
Aug
(8) |
Sep
(5) |
Oct
(33) |
Nov
(24) |
Dec
(41) |
| 2011 |
Jan
(4) |
Feb
(12) |
Mar
(35) |
Apr
(29) |
May
(19) |
Jun
(16) |
Jul
(32) |
Aug
(25) |
Sep
(5) |
Oct
(11) |
Nov
(21) |
Dec
(12) |
| 2012 |
Jan
(3) |
Feb
(4) |
Mar
(20) |
Apr
(4) |
May
(25) |
Jun
(13) |
Jul
|
Aug
|
Sep
(2) |
Oct
(25) |
Nov
(9) |
Dec
(1) |
| 2013 |
Jan
(6) |
Feb
(8) |
Mar
|
Apr
(10) |
May
(31) |
Jun
(7) |
Jul
(18) |
Aug
(33) |
Sep
(4) |
Oct
(16) |
Nov
|
Dec
(27) |
| 2014 |
Jan
(2) |
Feb
|
Mar
|
Apr
(11) |
May
(39) |
Jun
(8) |
Jul
(11) |
Aug
(4) |
Sep
|
Oct
(27) |
Nov
|
Dec
(71) |
| 2015 |
Jan
(17) |
Feb
(47) |
Mar
(33) |
Apr
|
May
|
Jun
(9) |
Jul
(7) |
Aug
|
Sep
|
Oct
|
Nov
|
Dec
(8) |
| 2016 |
Jan
(4) |
Feb
(4) |
Mar
|
Apr
|
May
(12) |
Jun
(7) |
Jul
(9) |
Aug
(31) |
Sep
(8) |
Oct
(3) |
Nov
(15) |
Dec
(1) |
| 2017 |
Jan
(13) |
Feb
(7) |
Mar
(14) |
Apr
(8) |
May
(10) |
Jun
(4) |
Jul
(2) |
Aug
(1) |
Sep
|
Oct
(8) |
Nov
(4) |
Dec
(5) |
| 2018 |
Jan
(2) |
Feb
(8) |
Mar
|
Apr
(4) |
May
|
Jun
(6) |
Jul
|
Aug
(1) |
Sep
|
Oct
|
Nov
(1) |
Dec
|
| 2019 |
Jan
(1) |
Feb
(16) |
Mar
(1) |
Apr
(3) |
May
(5) |
Jun
(1) |
Jul
|
Aug
|
Sep
(2) |
Oct
|
Nov
(1) |
Dec
(3) |
| 2020 |
Jan
|
Feb
|
Mar
|
Apr
(1) |
May
(1) |
Jun
|
Jul
|
Aug
(1) |
Sep
|
Oct
(2) |
Nov
|
Dec
(2) |
| 2021 |
Jan
|
Feb
(2) |
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
(1) |
Nov
(1) |
Dec
|
| 2022 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
(6) |
Oct
(1) |
Nov
(1) |
Dec
(4) |
| 2023 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
(1) |
Aug
(3) |
Sep
(2) |
Oct
(2) |
Nov
(4) |
Dec
|
| 2024 |
Jan
|
Feb
(2) |
Mar
|
Apr
|
May
|
Jun
|
Jul
(1) |
Aug
|
Sep
(1) |
Oct
|
Nov
|
Dec
(9) |
| 2025 |
Jan
|
Feb
(4) |
Mar
(2) |
Apr
|
May
|
Jun
|
Jul
|
Aug
(1) |
Sep
|
Oct
|
Nov
(2) |
Dec
(2) |
|
From: <ian...@us...> - 2003-07-05 18:43:42
|
Update of /cvsroot/sqlobject/SOWeb/docs In directory sc8-pr-cvs1:/tmp/cvs-serv16069/docs Modified Files: default.css Log Message: Added note about IRC Index: default.css =================================================================== RCS file: /cvsroot/sqlobject/SOWeb/docs/default.css,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 |
|
From: <ian...@us...> - 2003-07-05 18:43:42
|
Update of /cvsroot/sqlobject/SOWeb In directory sc8-pr-cvs1:/tmp/cvs-serv16069 Modified Files: index.html index.txt Log Message: Added note about IRC Index: index.html =================================================================== RCS file: /cvsroot/sqlobject/SOWeb/index.html,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** index.html 5 Jul 2003 04:47:02 -0000 1.6 --- index.html 5 Jul 2003 18:43:39 -0000 1.7 *************** *** 96,99 **** --- 96,100 ---- </pre> <p><a class="reference" href="http://sourceforge.net/cvs/?group_id=74338">Read more about CVS access</a> or <a class="reference" href="http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/sqlobject">browse CVS online</a>.</p> + <p>The author sometimes hangs out in IRC on <tt class="literal"><span class="pre">#webware</span></tt> on <tt class="literal"><span class="pre">irc.freenode.net</span></tt>.</p> </div> <div class="section" id="bugs-patches-etc"> Index: index.txt =================================================================== RCS file: /cvsroot/sqlobject/SOWeb/index.txt,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** index.txt 5 Jul 2003 04:39:06 -0000 1.4 --- index.txt 5 Jul 2003 18:43:39 -0000 1.5 *************** *** 94,97 **** --- 94,99 ---- .. _browse CVS online: http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/sqlobject + The author sometimes hangs out in IRC on ``#webware`` on ``irc.freenode.net``. + Bugs, patches, etc ================== |
|
From: <ian...@us...> - 2003-07-05 04:47:22
|
Update of /cvsroot/sqlobject/SOWeb In directory sc8-pr-cvs1:/tmp/cvs-serv22908 Modified Files: index.html Log Message: got rid of header backlinks Index: index.html =================================================================== RCS file: /cvsroot/sqlobject/SOWeb/index.html,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** index.html 5 Jul 2003 04:39:06 -0000 1.5 --- index.html 5 Jul 2003 04:47:02 -0000 1.6 *************** *** 23,27 **** </div> <div class="section" id="introduction"> ! <h1><a class="toc-backref" href="#id8" name="introduction">Introduction</a></h1> <p>SQLObject is an <em>object-relational mapper</em>. It allows you to translate RDBMS table rows into Python objects, and manipulate those --- 23,27 ---- </div> <div class="section" id="introduction"> ! <h1><a name="introduction">Introduction</a></h1> <p>SQLObject is an <em>object-relational mapper</em>. It allows you to translate RDBMS table rows into Python objects, and manipulate those *************** *** 38,42 **** </div> <div class="section" id="example"> ! <h1><a class="toc-backref" href="#id9" name="example">Example</a></h1> <p>I love examples. Examples give a feel for the aesthetic of the API, which matters to me a great deal. This is just a snippet that creates --- 38,42 ---- </div> <div class="section" id="example"> ! <h1><a name="example">Example</a></h1> <p>I love examples. Examples give a feel for the aesthetic of the API, which matters to me a great deal. This is just a snippet that creates *************** *** 86,90 **** </div> <div class="section" id="community"> ! <h1><a class="toc-backref" href="#id10" name="community">Community</a></h1> <p><a class="reference" href="http://lists.sourceforge.net/lists/listinfo/sqlobject-discuss">Join the mailing list</a> or visit the <a class="reference" href="http://sourceforge.net/mailarchive/forum.php?forum=sqlobject-discuss">sqlobject-discuss archives</a>.</p> <p>If you are tracking changes, keeping up with CVS is helpful. To --- 86,90 ---- </div> <div class="section" id="community"> ! <h1><a name="community">Community</a></h1> <p><a class="reference" href="http://lists.sourceforge.net/lists/listinfo/sqlobject-discuss">Join the mailing list</a> or visit the <a class="reference" href="http://sourceforge.net/mailarchive/forum.php?forum=sqlobject-discuss">sqlobject-discuss archives</a>.</p> <p>If you are tracking changes, keeping up with CVS is helpful. To *************** *** 98,102 **** </div> <div class="section" id="bugs-patches-etc"> ! <h1><a class="toc-backref" href="#id11" name="bugs-patches-etc">Bugs, patches, etc</a></h1> <p>Please submit bugs and patches to the <a class="reference" href="http://sourceforge.net/tracker/?atid=540672&group_id=74338&func=browse">SourceForge bug tracker</a>. You might want to send mail to the mailing list before generating --- 98,102 ---- </div> <div class="section" id="bugs-patches-etc"> ! <h1><a name="bugs-patches-etc">Bugs, patches, etc</a></h1> <p>Please submit bugs and patches to the <a class="reference" href="http://sourceforge.net/tracker/?atid=540672&group_id=74338&func=browse">SourceForge bug tracker</a>. You might want to send mail to the mailing list before generating *************** *** 107,111 **** </div> <div class="section" id="download"> ! <h1><a class="toc-backref" href="#id12" name="download">Download</a></h1> <p><a class="reference" href="http://prdownloads.sourceforge.net/sqlobject/SQLObject-0.4.tar.gz?download">SQLObject-0.4.tar.gz</a></p> <p><a class="reference" href="http://prdownloads.sourceforge.net/sqlobject/SQLObject-0.4-1.noarch.rpm?download">SQLObject-0.4-1.noarch.rpm</a></p> --- 107,111 ---- </div> <div class="section" id="download"> ! <h1><a name="download">Download</a></h1> <p><a class="reference" href="http://prdownloads.sourceforge.net/sqlobject/SQLObject-0.4.tar.gz?download">SQLObject-0.4.tar.gz</a></p> <p><a class="reference" href="http://prdownloads.sourceforge.net/sqlobject/SQLObject-0.4-1.noarch.rpm?download">SQLObject-0.4-1.noarch.rpm</a></p> *************** *** 113,117 **** </div> <div class="section" id="documentation"> ! <h1><a class="toc-backref" href="#id13" name="documentation">Documentation</a></h1> <p><a class="reference" href="docs/News.html">New in 0.4</a></p> <p><a class="reference" href="docs/SQLObject.html">SQLObject documentation</a></p> --- 113,117 ---- </div> <div class="section" id="documentation"> ! <h1><a name="documentation">Documentation</a></h1> <p><a class="reference" href="docs/News.html">New in 0.4</a></p> <p><a class="reference" href="docs/SQLObject.html">SQLObject documentation</a></p> |
|
From: <ian...@us...> - 2003-07-05 04:47:21
|
Update of /cvsroot/sqlobject/SOWeb/docs In directory sc8-pr-cvs1:/tmp/cvs-serv22908/docs Modified Files: SQLObject.html build default.css Log Message: got rid of header backlinks Index: SQLObject.html =================================================================== RCS file: /cvsroot/sqlobject/SOWeb/docs/SQLObject.html,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** SQLObject.html 5 Jul 2003 04:39:07 -0000 1.4 --- SQLObject.html 5 Jul 2003 04:47:02 -0000 1.5 *************** *** 74,78 **** </div> <div class="section" id="author-site-and-license"> ! <h1><a class="toc-backref" href="#id7" name="author-site-and-license">Author, Site, and License</a></h1> <p>SQLObject is by Ian Bicking (<a class="reference" href="mailto:ianb@colorstudy.com">ianb@colorstudy.com</a>). The website is <a class="reference" href="http://sqlobject.org">sqlobject.org</a>.</p> --- 74,78 ---- </div> <div class="section" id="author-site-and-license"> ! <h1><a name="author-site-and-license">Author, Site, and License</a></h1> <p>SQLObject is by Ian Bicking (<a class="reference" href="mailto:ianb@colorstudy.com">ianb@colorstudy.com</a>). The website is <a class="reference" href="http://sqlobject.org">sqlobject.org</a>.</p> *************** *** 85,89 **** </div> <div class="section" id="introduction"> ! <h1><a class="toc-backref" href="#id8" name="introduction">Introduction</a></h1> <p>SQLObject is an <em>object-relational mapper</em>. It allows you to translate RDBMS table rows into Python objects, and manipulate those --- 85,89 ---- </div> <div class="section" id="introduction"> ! <h1><a name="introduction">Introduction</a></h1> <p>SQLObject is an <em>object-relational mapper</em>. It allows you to translate RDBMS table rows into Python objects, and manipulate those *************** *** 99,103 **** </div> <div class="section" id="requirements"> ! <h1><a class="toc-backref" href="#id9" name="requirements">Requirements</a></h1> <p>Currently SQLObject supports MySQL, PostgreSQL (via <tt class="literal"><span class="pre">psycopg</span></tt>), SQLite, and a DBM-based store. The DBM backend is the youngest, --- 99,103 ---- </div> <div class="section" id="requirements"> ! <h1><a name="requirements">Requirements</a></h1> <p>Currently SQLObject supports MySQL, PostgreSQL (via <tt class="literal"><span class="pre">psycopg</span></tt>), SQLite, and a DBM-based store. The DBM backend is the youngest, *************** *** 107,111 **** </div> <div class="section" id="compared-to-other-database-wrappers"> ! <h1><a class="toc-backref" href="#id10" name="compared-to-other-database-wrappers">Compared To Other Database Wrappers</a></h1> <p>There are several object-relational mappers (ORM) for Python. I honestly can't comment deeply on the quality of those packages, but --- 107,111 ---- </div> <div class="section" id="compared-to-other-database-wrappers"> ! <h1><a name="compared-to-other-database-wrappers">Compared To Other Database Wrappers</a></h1> <p>There are several object-relational mappers (ORM) for Python. I honestly can't comment deeply on the quality of those packages, but *************** *** 153,157 **** </div> <div class="section" id="future"> ! <h1><a class="toc-backref" href="#id11" name="future">Future</a></h1> <p>Here are some things I plan:</p> <ul class="simple"> --- 153,157 ---- </div> <div class="section" id="future"> ! <h1><a name="future">Future</a></h1> <p>Here are some things I plan:</p> <ul class="simple"> *************** *** 173,180 **** </div> <div class="section" id="using-sqlobject-an-introduction"> ! <h1><a class="toc-backref" href="#id12" name="using-sqlobject-an-introduction">Using SQLObject: An Introduction</a></h1> <p>Let's start off quickly...</p> <div class="section" id="declaring-the-class"> ! <h2><a class="toc-backref" href="#id13" name="declaring-the-class">Declaring the Class</a></h2> <p>To begin with, let's make a database connection. Choose from one of <cite>MySQLConnection</cite>, <cite>PostgresConnection</cite>, <cite>SQLiteConnection</cite>, and --- 173,180 ---- </div> <div class="section" id="using-sqlobject-an-introduction"> ! <h1><a name="using-sqlobject-an-introduction">Using SQLObject: An Introduction</a></h1> <p>Let's start off quickly...</p> <div class="section" id="declaring-the-class"> ! <h2><a name="declaring-the-class">Declaring the Class</a></h2> <p>To begin with, let's make a database connection. Choose from one of <cite>MySQLConnection</cite>, <cite>PostgresConnection</cite>, <cite>SQLiteConnection</cite>, and *************** *** 240,244 **** </div> <div class="section" id="using-the-class"> ! <h2><a class="toc-backref" href="#id14" name="using-the-class">Using the Class</a></h2> <p>Now that you have a class, how will you use it? We'll be considering the class defined above.</p> --- 240,244 ---- </div> <div class="section" id="using-the-class"> ! <h2><a name="using-the-class">Using the Class</a></h2> <p>Now that you have a class, how will you use it? We'll be considering the class defined above.</p> *************** *** 332,336 **** </div> <div class="section" id="one-to-many-relationships"> ! <h2><a class="toc-backref" href="#id15" name="one-to-many-relationships">One-to-Many Relationships</a></h2> <p>Well, a real address book should have people, but also addresses. These examples are in <tt class="literal"><span class="pre">personaddress.py</span></tt></p> --- 332,336 ---- </div> <div class="section" id="one-to-many-relationships"> ! <h2><a name="one-to-many-relationships">One-to-Many Relationships</a></h2> <p>Well, a real address book should have people, but also addresses. These examples are in <tt class="literal"><span class="pre">personaddress.py</span></tt></p> *************** *** 376,380 **** </div> <div class="section" id="many-to-many-relationships"> ! <h2><a class="toc-backref" href="#id16" name="many-to-many-relationships">Many-to-Many Relationships</a></h2> <p>For this example we will have user and role objects. The two have a many-to-many relationship, which is represented with the --- 376,380 ---- </div> <div class="section" id="many-to-many-relationships"> ! <h2><a name="many-to-many-relationships">Many-to-Many Relationships</a></h2> <p>For this example we will have user and role objects. The two have a many-to-many relationship, which is represented with the *************** *** 443,447 **** </div> <div class="section" id="selecting-multiple-objects"> ! <h2><a class="toc-backref" href="#id17" name="selecting-multiple-objects">Selecting Multiple Objects</a></h2> <p>While the full power of all the kinds of joins you can do with a database are not revealed in SQLObject, a simple <tt class="literal"><span class="pre">SELECT</span></tt> is --- 443,447 ---- </div> <div class="section" id="selecting-multiple-objects"> ! <h2><a name="selecting-multiple-objects">Selecting Multiple Objects</a></h2> <p>While the full power of all the kinds of joins you can do with a database are not revealed in SQLObject, a simple <tt class="literal"><span class="pre">SELECT</span></tt> is *************** *** 509,513 **** </div> <div class="section" id="customizing-the-objects"> ! <h2><a class="toc-backref" href="#id18" name="customizing-the-objects">Customizing the Objects</a></h2> <p>While we haven't done so in the examples, you can include your own methods in the class definition. Writing you own methods should be --- 509,513 ---- </div> <div class="section" id="customizing-the-objects"> ! <h2><a name="customizing-the-objects">Customizing the Objects</a></h2> <p>While we haven't done so in the examples, you can include your own methods in the class definition. Writing you own methods should be *************** *** 515,519 **** some other details to be aware of.</p> <div class="section" id="initializing-the-objects"> ! <h3><a class="toc-backref" href="#id19" name="initializing-the-objects">Initializing the Objects</a></h3> <p>With new-style classes, <cite>__init__</cite> is called everytime the class is called. That means it's called when an object is just fetched from --- 515,519 ---- some other details to be aware of.</p> <div class="section" id="initializing-the-objects"> ! <h3><a name="initializing-the-objects">Initializing the Objects</a></h3> <p>With new-style classes, <cite>__init__</cite> is called everytime the class is called. That means it's called when an object is just fetched from *************** *** 523,527 **** </div> <div class="section" id="adding-magic-attributes-properties"> ! <h3><a class="toc-backref" href="#id20" name="adding-magic-attributes-properties">Adding Magic Attributes (properties)</a></h3> <p>You can use all the normal techniques for defining this new-style class, including <cite>classmethod</cite>, <cite>staticmethod</cite>, and <cite>property</cite>, but --- 523,527 ---- </div> <div class="section" id="adding-magic-attributes-properties"> ! <h3><a name="adding-magic-attributes-properties">Adding Magic Attributes (properties)</a></h3> <p>You can use all the normal techniques for defining this new-style class, including <cite>classmethod</cite>, <cite>staticmethod</cite>, and <cite>property</cite>, but *************** *** 571,575 **** </div> <div class="section" id="overriding-column-attributes"> ! <h3><a class="toc-backref" href="#id21" name="overriding-column-attributes">Overriding Column Attributes</a></h3> <p>It's a little more complicated if you want to override the behavior of an database column attribute. For instance, imagine there's special --- 571,575 ---- </div> <div class="section" id="overriding-column-attributes"> ! <h3><a name="overriding-column-attributes">Overriding Column Attributes</a></h3> <p>It's a little more complicated if you want to override the behavior of an database column attribute. For instance, imagine there's special *************** *** 630,639 **** </div> <div class="section" id="reference"> ! <h1><a class="toc-backref" href="#id22" name="reference">Reference</a></h1> <p>The instructions above should tell you enough to get you started, and be useful for many situations. Now we'll show how to specify the class more completely.</p> <div class="section" id="col-class-specifying-columns"> ! <h2><a class="toc-backref" href="#id23" name="col-class-specifying-columns">Col Class: Specifying Columns</a></h2> <p>The list of columns is a list of <cite>Col</cite> objects. These objects don't have functionality in themselves, but give you a way to specify the --- 630,639 ---- </div> <div class="section" id="reference"> ! <h1><a name="reference">Reference</a></h1> <p>The instructions above should tell you enough to get you started, and be useful for many situations. Now we'll show how to specify the class more completely.</p> <div class="section" id="col-class-specifying-columns"> ! <h2><a name="col-class-specifying-columns">Col Class: Specifying Columns</a></h2> <p>The list of columns is a list of <cite>Col</cite> objects. These objects don't have functionality in themselves, but give you a way to specify the *************** *** 675,679 **** </dl> <div class="section" id="subclasses-of-col"> ! <h3><a class="toc-backref" href="#id24" name="subclasses-of-col">Subclasses of Col</a></h3> <p>The <cite>ForeignKey</cite> class should be used instead of <cite>Col</cite> when the column is a reference to another table/class. It is generally used like --- 675,679 ---- </dl> <div class="section" id="subclasses-of-col"> ! <h3><a name="subclasses-of-col">Subclasses of Col</a></h3> <p>The <cite>ForeignKey</cite> class should be used instead of <cite>Col</cite> when the column is a reference to another table/class. It is generally used like *************** *** 722,726 **** </div> <div class="section" id="sqlobject-class-specifying-your-class"> ! <h2><a class="toc-backref" href="#id25" name="sqlobject-class-specifying-your-class">SQLObject Class: Specifying Your Class</a></h2> <p>In addition to the columns, there are a number of other special attributes you can set in your class.</p> --- 722,726 ---- </div> <div class="section" id="sqlobject-class-specifying-your-class"> ! <h2><a name="sqlobject-class-specifying-your-class">SQLObject Class: Specifying Your Class</a></h2> <p>In addition to the columns, there are a number of other special attributes you can set in your class.</p> *************** *** 758,767 **** </div> <div class="section" id="relationships-between-classes-tables"> ! <h2><a class="toc-backref" href="#id26" name="relationships-between-classes-tables">Relationships Between Classes/Tables</a></h2> <p>You can use the <cite>ForeignKey</cite> to handle foreign references in a table, but for back references and many-to-many relationships you'll use joins.</p> <div class="section" id="multiplejoin-one-to-many"> ! <h3><a class="toc-backref" href="#id27" name="multiplejoin-one-to-many">MultipleJoin: One-to-Many</a></h3> <p>See <a class="reference" href="#one-to-many-relationships">One-to-Many Relationships</a> for an example of one-to-many relationships.</p> --- 758,767 ---- </div> <div class="section" id="relationships-between-classes-tables"> ! <h2><a name="relationships-between-classes-tables">Relationships Between Classes/Tables</a></h2> <p>You can use the <cite>ForeignKey</cite> to handle foreign references in a table, but for back references and many-to-many relationships you'll use joins.</p> <div class="section" id="multiplejoin-one-to-many"> ! <h3><a name="multiplejoin-one-to-many">MultipleJoin: One-to-Many</a></h3> <p>See <a class="reference" href="#one-to-many-relationships">One-to-Many Relationships</a> for an example of one-to-many relationships.</p> *************** *** 784,788 **** </div> <div class="section" id="relatedjoin-many-to-many"> ! <h3><a class="toc-backref" href="#id28" name="relatedjoin-many-to-many">RelatedJoin: Many-to-Many</a></h3> <p>See <a class="reference" href="#many-to-many-relationships">Many-to-Many Relationships</a> for examples of using many-to-many joins.</p> <p><cite>RelatedJoin</cite> has all the keyword arguments of <a class="reference" href="#multiple-join-keywords">MultipleJoin</a>, plus:</p> --- 784,788 ---- </div> <div class="section" id="relatedjoin-many-to-many"> ! <h3><a name="relatedjoin-many-to-many">RelatedJoin: Many-to-Many</a></h3> <p>See <a class="reference" href="#many-to-many-relationships">Many-to-Many Relationships</a> for examples of using many-to-many joins.</p> <p><cite>RelatedJoin</cite> has all the keyword arguments of <a class="reference" href="#multiple-join-keywords">MultipleJoin</a>, plus:</p> *************** *** 829,833 **** </div> <div class="section" id="transactions"> ! <h2><a class="toc-backref" href="#id29" name="transactions">Transactions</a></h2> <p>Transaction support in SQLObject is left to the database. Transactions can be used like:</p> --- 829,833 ---- </div> <div class="section" id="transactions"> ! <h2><a name="transactions">Transactions</a></h2> <p>Transaction support in SQLObject is left to the database. Transactions can be used like:</p> *************** *** 853,857 **** </div> <div class="section" id="automatic-schema-generation"> ! <h2><a class="toc-backref" href="#id30" name="automatic-schema-generation">Automatic Schema Generation</a></h2> <p>All the connections support creating and droping tables based on the class definition. First you have to prepare your class definition, --- 853,857 ---- </div> <div class="section" id="automatic-schema-generation"> ! <h2><a name="automatic-schema-generation">Automatic Schema Generation</a></h2> <p>All the connections support creating and droping tables based on the class definition. First you have to prepare your class definition, *************** *** 859,863 **** <a class="reference" href="#dbmconnection">DBMConnection</a> do not require or use type information).</p> <div class="section" id="columns-types"> ! <h3><a class="toc-backref" href="#id31" name="columns-types">Columns Types</a></h3> <p>A column type is indicated by using a subclass of <cite>Col</cite>:</p> <dl> --- 859,863 ---- <a class="reference" href="#dbmconnection">DBMConnection</a> do not require or use type information).</p> <div class="section" id="columns-types"> ! <h3><a name="columns-types">Columns Types</a></h3> <p>A column type is indicated by using a subclass of <cite>Col</cite>:</p> <dl> *************** *** 893,897 **** </div> <div class="section" id="creating-and-dropping-tables"> ! <h3><a class="toc-backref" href="#id32" name="creating-and-dropping-tables">Creating and Dropping Tables</a></h3> <p>To create a table call <cite>createTable</cite>. It takes two arguments:</p> <dl> --- 893,897 ---- </div> <div class="section" id="creating-and-dropping-tables"> ! <h3><a name="creating-and-dropping-tables">Creating and Dropping Tables</a></h3> <p>To create a table call <cite>createTable</cite>. It takes two arguments:</p> <dl> *************** *** 910,919 **** </div> <div class="section" id="dynamic-classes"> ! <h1><a class="toc-backref" href="#id33" name="dynamic-classes">Dynamic Classes</a></h1> <p>SQLObject classes can be manipulated dynamically. This leaves open the possibility of constructing SQLObject classes from an XML file, from database introspection, or from a graphical interface.</p> <div class="section" id="automatic-class-generation"> ! <h2><a class="toc-backref" href="#id34" name="automatic-class-generation">Automatic Class Generation</a></h2> <p>SQLObject can read the table description from the database, and fill in the class columns (as would normally be described in the <cite>_columns</cite> --- 910,919 ---- </div> <div class="section" id="dynamic-classes"> ! <h1><a name="dynamic-classes">Dynamic Classes</a></h1> <p>SQLObject classes can be manipulated dynamically. This leaves open the possibility of constructing SQLObject classes from an XML file, from database introspection, or from a graphical interface.</p> <div class="section" id="automatic-class-generation"> ! <h2><a name="automatic-class-generation">Automatic Class Generation</a></h2> <p>SQLObject can read the table description from the database, and fill in the class columns (as would normally be described in the <cite>_columns</cite> *************** *** 929,933 **** </div> <div class="section" id="runtime-column-changes"> ! <h2><a class="toc-backref" href="#id35" name="runtime-column-changes">Runtime Column Changes</a></h2> <p><em>SQLite does not support this feature</em></p> <p>You can add and remove columns to your class at runtime. Such changes --- 929,933 ---- </div> <div class="section" id="runtime-column-changes"> ! <h2><a name="runtime-column-changes">Runtime Column Changes</a></h2> <p><em>SQLite does not support this feature</em></p> <p>You can add and remove columns to your class at runtime. Such changes *************** *** 949,958 **** </div> <div class="section" id="legacy-database-schemas"> ! <h1><a class="toc-backref" href="#id36" name="legacy-database-schemas">Legacy Database Schemas</a></h1> <p>Often you will have a database that already exists, and does not use the naming conventions that SQLObject expects, or does not use any naming convention at all.</p> <div class="section" id="sqlobject-requirements"> ! <h2><a class="toc-backref" href="#id37" name="sqlobject-requirements">SQLObject requirements</a></h2> <p>While SQLObject tries not to make too many requirements on your schema, some assumptions are made. Some of these may be relaxed in --- 949,958 ---- </div> <div class="section" id="legacy-database-schemas"> ! <h1><a name="legacy-database-schemas">Legacy Database Schemas</a></h1> <p>Often you will have a database that already exists, and does not use the naming conventions that SQLObject expects, or does not use any naming convention at all.</p> <div class="section" id="sqlobject-requirements"> ! <h2><a name="sqlobject-requirements">SQLObject requirements</a></h2> <p>While SQLObject tries not to make too many requirements on your schema, some assumptions are made. Some of these may be relaxed in *************** *** 979,983 **** </div> <div class="section" id="changing-the-naming-style"> ! <h2><a class="toc-backref" href="#id38" name="changing-the-naming-style">Changing the Naming Style</a></h2> <p>By default names in SQLObject are expected to be mixed case in Python (like <tt class="literal"><span class="pre">mixedCase</span></tt>), and underscore-separated in SQL (like --- 979,983 ---- </div> <div class="section" id="changing-the-naming-style"> ! <h2><a name="changing-the-naming-style">Changing the Naming Style</a></h2> <p>By default names in SQLObject are expected to be mixed case in Python (like <tt class="literal"><span class="pre">mixedCase</span></tt>), and underscore-separated in SQL (like *************** *** 1015,1019 **** </div> <div class="section" id="irregular-naming"> ! <h2><a class="toc-backref" href="#id39" name="irregular-naming">Irregular Naming</a></h2> <p>While naming conventions are nice, they are not always present. You can control most of the names that SQLObject uses, independent of the --- 1015,1019 ---- </div> <div class="section" id="irregular-naming"> ! <h2><a name="irregular-naming">Irregular Naming</a></h2> <p>While naming conventions are nice, they are not always present. You can control most of the names that SQLObject uses, independent of the *************** *** 1034,1038 **** </div> <div class="section" id="dbconnection-database-connections"> ! <h1><a class="toc-backref" href="#id40" name="dbconnection-database-connections">DBConnection: Database Connections</a></h1> <p>The <cite>DBConnection</cite> module currently has four external classes, <cite>MySQLConnection</cite>, <cite>PostgresConnection</cite>, <cite>SQLiteConnection</cite>, --- 1034,1038 ---- </div> <div class="section" id="dbconnection-database-connections"> ! <h1><a name="dbconnection-database-connections">DBConnection: Database Connections</a></h1> <p>The <cite>DBConnection</cite> module currently has four external classes, <cite>MySQLConnection</cite>, <cite>PostgresConnection</cite>, <cite>SQLiteConnection</cite>, *************** *** 1042,1046 **** console.</p> <div class="section" id="mysql"> ! <h2><a class="toc-backref" href="#id41" name="mysql">MySQL</a></h2> <p><cite>MySQLConnection</cite> takes the keyword arguments <cite>host</cite>, <cite>db</cite>, <cite>user</cite>, and <cite>passwd</cite>, just like <cite>MySQLdb.connect</cite> does.</p> --- 1042,1046 ---- console.</p> <div class="section" id="mysql"> ! <h2><a name="mysql">MySQL</a></h2> <p><cite>MySQLConnection</cite> takes the keyword arguments <cite>host</cite>, <cite>db</cite>, <cite>user</cite>, and <cite>passwd</cite>, just like <cite>MySQLdb.connect</cite> does.</p> *************** *** 1050,1054 **** </div> <div class="section" id="postgres"> ! <h2><a class="toc-backref" href="#id42" name="postgres">Postgres</a></h2> <p><cite>PostgresConnection</cite> takes a single connection string, like <tt class="literal"><span class="pre">"dbname=something</span> <span class="pre">user=some_user"</span></tt>, just like <cite>psycopg.connect</cite>. --- 1050,1054 ---- </div> <div class="section" id="postgres"> ! <h2><a name="postgres">Postgres</a></h2> <p><cite>PostgresConnection</cite> takes a single connection string, like <tt class="literal"><span class="pre">"dbname=something</span> <span class="pre">user=some_user"</span></tt>, just like <cite>psycopg.connect</cite>. *************** *** 1058,1062 **** </div> <div class="section" id="sqlite"> ! <h2><a class="toc-backref" href="#id43" name="sqlite">SQLite</a></h2> <p><cite>SQLiteConnection</cite> takes the a single string, which is the path to the database file.</p> --- 1058,1062 ---- </div> <div class="section" id="sqlite"> ! <h2><a name="sqlite">SQLite</a></h2> <p><cite>SQLiteConnection</cite> takes the a single string, which is the path to the database file.</p> *************** *** 1071,1075 **** </div> <div class="section" id="dbmconnection"> ! <h2><a class="toc-backref" href="#id44" name="dbmconnection">DBMConnection</a></h2> <p><cite>DBMConnection</cite> takes a single string, which is the path to a directory in which to store the database.</p> --- 1071,1075 ---- </div> <div class="section" id="dbmconnection"> ! <h2><a name="dbmconnection">DBMConnection</a></h2> <p><cite>DBMConnection</cite> takes a single string, which is the path to a directory in which to store the database.</p> *************** *** 1087,1091 **** </div> <div class="section" id="exported-symbols"> ! <h1><a class="toc-backref" href="#id45" name="exported-symbols">Exported Symbols</a></h1> <p>You can use <tt class="literal"><span class="pre">from</span> <span class="pre">SQLObject</span> <span class="pre">import</span> <span class="pre">*</span></tt>, though you don't have to. It exports a minimal number of symbols. The symbols exported:</p> --- 1087,1091 ---- </div> <div class="section" id="exported-symbols"> ! <h1><a name="exported-symbols">Exported Symbols</a></h1> <p>You can use <tt class="literal"><span class="pre">from</span> <span class="pre">SQLObject</span> <span class="pre">import</span> <span class="pre">*</span></tt>, though you don't have to. It exports a minimal number of symbols. The symbols exported:</p> Index: build =================================================================== RCS file: /cvsroot/sqlobject/SOWeb/docs/build,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** build 5 Jul 2003 04:39:07 -0000 1.4 --- build 5 Jul 2003 04:47:02 -0000 1.5 *************** *** 6,8 **** cp $SOURCEDIR/../examples/snippets/*.html ../examples/snippets/ cd .. ! buildhtml.py --- 6,8 ---- cp $SOURCEDIR/../examples/snippets/*.html ../examples/snippets/ cd .. ! buildhtml.py --no-toc-backlinks Index: default.css =================================================================== RCS file: /cvsroot/sqlobject/SOWeb/docs/default.css,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 |
|
From: <ian...@us...> - 2003-07-05 04:41:03
|
Update of /cvsroot/sqlobject/SOWeb/docs In directory sc8-pr-cvs1:/tmp/cvs-serv22441/docs Added Files: Authors.html Authors.txt Log Message: Added authors file --- NEW FILE: Authors.html --- <?xml version="1.0" encoding="utf-8" ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <meta name="generator" content="Docutils 0.2.8: http://docutils.sourceforge.net/" /> <title>Authors</title> <link rel="stylesheet" href="default.css" type="text/css" /> </head> <body> <div class="document" id="authors"> <h1 class="title">Authors</h1> <p>SQLObject was originally written and continues to be maintained by Ian Bicking <<a class="reference" href="mailto:ianb@colorstudy.com">ianb@colorstudy.com</a>></p> <p>Contributions have been made by:</p> <ul class="simple"> <li>Frank Barknecht <<a class="reference" href="mailto:fbar@footils.org">fbar@footils.org</a>></li> <li>Bud P. Bruegger <<a class="reference" href="mailto:bug@sistema.it">bug@sistema.it</a>></li> <li>David M. Cook <<a class="reference" href="mailto:dave@davidcook.org">dave@davidcook.org</a>></li> <li>Luke Opperman <<a class="reference" href="mailto:luke@metathusalan.com">luke@metathusalan.com</a>></li> </ul> </div> </body> </html> --- NEW FILE: Authors.txt --- Authors ======= SQLObject was originally written and continues to be maintained by Ian Bicking <ia...@co...> Contributions have been made by: * Frank Barknecht <fb...@fo...> * Bud P. Bruegger <bu...@si...> * David M. Cook <da...@da...> * Luke Opperman <lu...@me...> |
|
From: <ian...@us...> - 2003-07-05 04:39:10
|
Update of /cvsroot/sqlobject/SOWeb/docs
In directory sc8-pr-cvs1:/tmp/cvs-serv22271/docs
Modified Files:
News.html News.txt SQLObject.html SQLObject.txt build
default.css
Log Message:
Update for 0.4
Index: News.html
===================================================================
RCS file: /cvsroot/sqlobject/SOWeb/docs/News.html,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
*** News.html 8 Apr 2003 04:05:04 -0000 1.2
--- News.html 5 Jul 2003 04:39:07 -0000 1.3
***************
*** 14,33 ****
<p class="topic-title"><a name="contents">Contents:</a></p>
<ul class="simple">
! <li><a class="reference" href="#sqlobject-0-3" id="id3" name="id3">SQLObject 0.3</a><ul>
! <li><a class="reference" href="#features" id="id4" name="id4">Features</a></li>
! <li><a class="reference" href="#bugs" id="id5" name="id5">Bugs</a></li>
</ul>
</li>
! <li><a class="reference" href="#sqlobject-0-2-1" id="id6" name="id6">SQLObject 0.2.1</a><ul>
! <li><a class="reference" href="#id1" id="id7" name="id7">Bugs</a></li>
! <li><a class="reference" href="#id2" id="id8" name="id8">Features</a></li>
</ul>
</li>
</ul>
</div>
! <a class="target" id="start" name="start"></a><div class="section" id="sqlobject-0-3">
! <h1><a name="sqlobject-0-3">SQLObject 0.3</a></h1>
<div class="section" id="features">
<h2><a name="features">Features</a></h2>
<ul class="simple">
<li>Table creation (SQL schema generation) via new class method
--- 14,170 ----
<p class="topic-title"><a name="contents">Contents:</a></p>
<ul class="simple">
! <li><a class="reference" href="#sqlobject-0-4" id="id5" name="id5">SQLObject 0.4</a><ul>
! <li><a class="reference" href="#features" id="id6" name="id6">Features</a><ul>
! <li><a class="reference" href="#col-and-join" id="id7" name="id7">Col and Join</a></li>
</ul>
</li>
! <li><a class="reference" href="#bugs" id="id8" name="id8">Bugs</a></li>
! <li><a class="reference" href="#internal" id="id9" name="id9">Internal</a></li>
! </ul>
! </li>
! <li><a class="reference" href="#sqlobject-0-3" id="id10" name="id10">SQLObject 0.3</a><ul>
! <li><a class="reference" href="#id1" id="id11" name="id11">Features</a></li>
! <li><a class="reference" href="#id2" id="id12" name="id12">Bugs</a></li>
! </ul>
! </li>
! <li><a class="reference" href="#sqlobject-0-2-1" id="id13" name="id13">SQLObject 0.2.1</a><ul>
! <li><a class="reference" href="#id3" id="id14" name="id14">Bugs</a></li>
! <li><a class="reference" href="#id4" id="id15" name="id15">Features</a></li>
</ul>
</li>
</ul>
</div>
! <a class="target" id="start" name="start"></a><div class="section" id="sqlobject-0-4">
! <h1><a name="sqlobject-0-4">SQLObject 0.4</a></h1>
<div class="section" id="features">
<h2><a name="features">Features</a></h2>
+ <ul>
+ <li><p class="first">You can specify columns in a new, preferred manner:</p>
+ <pre class="literal-block">
+ class SomeObject(SQLObject):
+ someColumn = Col()
+ </pre>
+ <p>Equivalent to:</p>
+ <pre class="literal-block">
+ class SomeObject(SQLObject):
+ _columns = [Col('someColumn')]
+ </pre>
+ <p>Ditto joins.</p>
+ </li>
+ <li><p class="first">Cache objects have a clear method, which empties all objects.
+ However, weak references to objects <em>are</em> maintained, so the
+ integrity of the cache can be ensured.</p>
+ </li>
+ <li><p class="first">SQLObject subclasses can be further subclassed, adding or removing
+ column definitions (as well as changing settings like connection,
+ style, etc). Each class still refers to a single concrete table in
+ the database -- the class hierarchy is not represented in the
+ database.</p>
+ </li>
+ <li><p class="first">Each SQLObject subclass can have an associated style, as given in
+ the <cite>_style</cite> attribute. This object is used to map between Python
+ and database names (e.g., the column name for a Python attribute).
+ Some samples are available in the <cite>Style</cite> module.</p>
+ </li>
+ <li><p class="first">Postgres support for <cite>_fromDatabase</cite> (reading a table definition from
+ the database, and creating a class from that).</p>
+ </li>
+ <li><p class="first">Postgres id columns more permissive, you don't have to create a
+ specially named sequence (or implicitly create that sequence through
+ <tt class="literal"><span class="pre">SERIAL</span></tt>). lastoid is used instead.</p>
+ </li>
+ <li><p class="first">MySQL uses <tt class="literal"><span class="pre">localhost</span></tt> as the default host, and the empty string
+ as the default password.</p>
+ </li>
+ <li><p class="first">Added functions for use with queries: <cite>ISNULL</cite>, <cite>ISNOTNULL</cite>. <tt class="literal"><span class="pre">==</span></tt>
+ and <tt class="literal"><span class="pre">!=</span></tt> can be used with None, and is translated into <cite>ISNULL</cite>,
+ <cite>ISNOTNULL</cite>.</p>
+ </li>
+ <li><p class="first">Classes can be part of a specific registry. Since classes are
+ referred to by name in several places, the names have to be unique.
+ This can be problematic, so you can add a class variable <cite>_registry</cite>,
+ the value of which should be a string. Classes references are
+ assumed to be inside that registry, and class names need only be
+ unique among classes in that registry.</p>
+ </li>
+ <li><p class="first"><tt class="literal"><span class="pre">SomeClass.select()</span></tt> selects all, instead of using
+ <tt class="literal"><span class="pre">SomeClass.select('all')</span></tt>. You can also use None instead of
+ <tt class="literal"><span class="pre">'all'</span></tt>.</p>
+ </li>
+ <li><p class="first">Trying to fetch non-existent objects raises <cite>SQLObjectNotFound</cite>,
+ which is a subclass of the builtin exception <cite>LookupError</cite>.
+ This may not be raised if <cite>_cacheValues</cite> is False and you use
+ the ID to fetch an object (but alternateID fetches will raise
+ the exception in either case).</p>
+ </li>
+ <li><p class="first">Can order by descending order, with the <cite>reversed</cite> option to
+ the <cite>select</cite> method, or by prefixing the column with a <tt class="literal"><span class="pre">"-"</span></tt>.</p>
+ </li>
+ <li><p class="first">Ordering with joins works better -- you can order with multiple
+ columns, as well as descending ordering.</p>
+ </li>
+ </ul>
+ <div class="section" id="col-and-join">
+ <h3><a name="col-and-join">Col and Join</a></h3>
+ <ul class="simple">
+ <li><cite>Join</cite> constructors have an argument <cite>orderBy</cite>, which is the name
+ of a Python attribute to sort results by. If not given, the
+ appropriate class's <cite>_defaultOrder</cite> will be used. None implies
+ no sorting (and <tt class="literal"><span class="pre">orderBy=None</span></tt> will override <cite>_defaultOrder</cite>).</li>
+ <li><cite>ForeignKey</cite> class (subclass of <cite>Col</cite>), for somewhat easier/clearer
+ declaration of foreign keys.</li>
+ <li><cite>Col</cite> (and subclasses) can take a <cite>sqlType</cite> argument, which is used
+ in table definitions. E.g., <tt class="literal"><span class="pre">Col(sqlType="BOOLEAN")</span></tt> can be used
+ to create a <tt class="literal"><span class="pre">BOOLEAN</span></tt> column, even though no <cite>BooleanCol</cite> exists.</li>
+ <li><cite>alternateID</cite> (a specifier for columns) implies <tt class="literal"><span class="pre">NOT</span> <span class="pre">NULL</span></tt>. Also
+ implies <tt class="literal"><span class="pre">UNIQUE</span></tt>.</li>
+ <li><cite>unique</cite> (a specifier for columns) added.</li>
+ <li><cite>DecimalCol</cite> and <cite>CurrencyCol</cite> added.</li>
+ <li><cite>EnumCol</cite> uses constraints on Postgres (if you use <cite>createTable</cite>).</li>
+ </ul>
+ </div>
+ </div>
+ <div class="section" id="bugs">
+ <h2><a name="bugs">Bugs</a></h2>
+ <ul class="simple">
+ <li><cite>DateTimeCol</cite> uses <tt class="literal"><span class="pre">TIMESTAMP</span></tt> for Postgres. Note that the
+ Python type name is used for column names, not necessarily the
+ SQL standard name.</li>
+ <li>Foreign key column names are slightly more permissive. They still
+ need to end in <tt class="literal"><span class="pre">id</span></tt>, but it's case insensitive.</li>
+ <li>_defaultOrder should be the python attribute's name, not the database
+ name.</li>
+ <li>SomeClass.q.colName uses proper Python attributes for colName, and
+ proper database names when executed in the database.</li>
+ <li>SQLite select results back to being proper iterator.</li>
+ <li>SomeClass.q.colName now does proper translation to database names,
+ using dbName, etc., instead of being entirely algorithm-driven.</li>
+ <li>Raise <cite>TypeError</cite> if you pass an unknown argument to the <cite>new</cite>
+ method.</li>
+ <li>You can override the _get_* or _set_* version of a property without
+ overriding the other.</li>
+ <li>Python 2.3 compatible.</li>
+ <li>Trying to use <tt class="literal"><span class="pre">Col('id')</span></tt> or <tt class="literal"><span class="pre">id</span> <span class="pre">=</span> <span class="pre">Col()</span></tt> will raise an
+ exception, instead of just acting funky.</li>
+ <li><tt class="literal"><span class="pre">ForeignKey</span></tt> columns return None if the associated column is
+ NULL in the database (used to just act weird).</li>
+ <li>Instantiating an object with an id of None will give an error,
+ instead of just acting weird.</li>
+ </ul>
+ </div>
+ <div class="section" id="internal">
+ <h2><a name="internal">Internal</a></h2>
+ <ul class="simple">
+ <li><cite>Col</cite> class separated into <cite>Col</cite> and <cite>SOCol</cite> (and same for all other
+ <cite>*Col</cite> classes). <cite>Col</cite> defines a column, <cite>SOCol</cite> is that definition
+ bound to a particular SQLObject class.</li>
+ <li>Instance variable <tt class="literal"><span class="pre">_SO_columns</span></tt> holds the <cite>SOCol</cite> instances.</li>
+ </ul>
+ </div>
+ </div>
+ <div class="section" id="sqlobject-0-3">
+ <h1><a name="sqlobject-0-3">SQLObject 0.3</a></h1>
+ <div class="section" id="id1">
+ <h2><a name="id1">Features</a></h2>
<ul class="simple">
<li>Table creation (SQL schema generation) via new class method
***************
*** 56,61 ****
</ul>
</div>
! <div class="section" id="bugs">
! <h2><a name="bugs">Bugs</a></h2>
<ul class="simple">
<li>LIMIT/OFFSET (select result slicing) works in Postgres and SQLite.</li>
--- 193,198 ----
</ul>
</div>
! <div class="section" id="id2">
! <h2><a name="id2">Bugs</a></h2>
<ul class="simple">
<li>LIMIT/OFFSET (select result slicing) works in Postgres and SQLite.</li>
***************
*** 68,79 ****
<div class="section" id="sqlobject-0-2-1">
<h1><a name="sqlobject-0-2-1">SQLObject 0.2.1</a></h1>
! <div class="section" id="id1">
! <h2><a name="id1">Bugs</a></h2>
<ul class="simple">
<li>Fixed caching of new objects</li>
</ul>
</div>
! <div class="section" id="id2">
! <h2><a name="id2">Features</a></h2>
<ul class="simple">
<li><a class="reference" href="http://sqlite.org/">SQLite</a> support</li>
--- 205,216 ----
<div class="section" id="sqlobject-0-2-1">
<h1><a name="sqlobject-0-2-1">SQLObject 0.2.1</a></h1>
! <div class="section" id="id3">
! <h2><a name="id3">Bugs</a></h2>
<ul class="simple">
<li>Fixed caching of new objects</li>
</ul>
</div>
! <div class="section" id="id4">
! <h2><a name="id4">Features</a></h2>
<ul class="simple">
<li><a class="reference" href="http://sqlite.org/">SQLite</a> support</li>
Index: News.txt
===================================================================
RCS file: /cvsroot/sqlobject/SOWeb/docs/News.txt,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
*** News.txt 8 Apr 2003 04:05:04 -0000 1.2
--- News.txt 5 Jul 2003 04:39:07 -0000 1.3
***************
*** 8,11 ****
--- 8,152 ----
.. _start:
+ SQLObject 0.4
+ =============
+
+ Features
+ --------
+
+ * You can specify columns in a new, preferred manner::
+
+ class SomeObject(SQLObject):
+ someColumn = Col()
+
+ Equivalent to::
+
+ class SomeObject(SQLObject):
+ _columns = [Col('someColumn')]
+
+ Ditto joins.
+
+ * Cache objects have a clear method, which empties all objects.
+ However, weak references to objects *are* maintained, so the
+ integrity of the cache can be ensured.
+
+ * SQLObject subclasses can be further subclassed, adding or removing
+ column definitions (as well as changing settings like connection,
+ style, etc). Each class still refers to a single concrete table in
+ the database -- the class hierarchy is not represented in the
+ database.
+
+ * Each SQLObject subclass can have an associated style, as given in
+ the `_style` attribute. This object is used to map between Python
+ and database names (e.g., the column name for a Python attribute).
+ Some samples are available in the `Style` module.
+
+ * Postgres support for `_fromDatabase` (reading a table definition from
+ the database, and creating a class from that).
+
+ * Postgres id columns more permissive, you don't have to create a
+ specially named sequence (or implicitly create that sequence through
+ ``SERIAL``). lastoid is used instead.
+
+ * MySQL uses ``localhost`` as the default host, and the empty string
+ as the default password.
+
+ * Added functions for use with queries: `ISNULL`, `ISNOTNULL`. ``==``
+ and ``!=`` can be used with None, and is translated into `ISNULL`,
+ `ISNOTNULL`.
+
+ * Classes can be part of a specific registry. Since classes are
+ referred to by name in several places, the names have to be unique.
+ This can be problematic, so you can add a class variable `_registry`,
+ the value of which should be a string. Classes references are
+ assumed to be inside that registry, and class names need only be
+ unique among classes in that registry.
+
+ * ``SomeClass.select()`` selects all, instead of using
+ ``SomeClass.select('all')``. You can also use None instead of
+ ``'all'``.
+
+ * Trying to fetch non-existent objects raises `SQLObjectNotFound`,
+ which is a subclass of the builtin exception `LookupError`.
+ This may not be raised if `_cacheValues` is False and you use
+ the ID to fetch an object (but alternateID fetches will raise
+ the exception in either case).
+
+ * Can order by descending order, with the `reversed` option to
+ the `select` method, or by prefixing the column with a ``"-"``.
+
+ * Ordering with joins works better -- you can order with multiple
+ columns, as well as descending ordering.
+
+ Col and Join
+ ~~~~~~~~~~~~
+
+ * `Join` constructors have an argument `orderBy`, which is the name
+ of a Python attribute to sort results by. If not given, the
+ appropriate class's `_defaultOrder` will be used. None implies
+ no sorting (and ``orderBy=None`` will override `_defaultOrder`).
+
+ * `ForeignKey` class (subclass of `Col`), for somewhat easier/clearer
+ declaration of foreign keys.
+
+ * `Col` (and subclasses) can take a `sqlType` argument, which is used
+ in table definitions. E.g., ``Col(sqlType="BOOLEAN")`` can be used
+ to create a ``BOOLEAN`` column, even though no `BooleanCol` exists.
+
+ * `alternateID` (a specifier for columns) implies ``NOT NULL``. Also
+ implies ``UNIQUE``.
+
+ * `unique` (a specifier for columns) added.
+
+ * `DecimalCol` and `CurrencyCol` added.
+
+ * `EnumCol` uses constraints on Postgres (if you use `createTable`).
+
+ Bugs
+ ----
+
+ * `DateTimeCol` uses ``TIMESTAMP`` for Postgres. Note that the
+ Python type name is used for column names, not necessarily the
+ SQL standard name.
+
+ * Foreign key column names are slightly more permissive. They still
+ need to end in ``id``, but it's case insensitive.
+
+ * _defaultOrder should be the python attribute's name, not the database
+ name.
+
+ * SomeClass.q.colName uses proper Python attributes for colName, and
+ proper database names when executed in the database.
+
+ * SQLite select results back to being proper iterator.
+
+ * SomeClass.q.colName now does proper translation to database names,
+ using dbName, etc., instead of being entirely algorithm-driven.
+
+ * Raise `TypeError` if you pass an unknown argument to the `new`
+ method.
+
+ * You can override the _get_* or _set_* version of a property without
+ overriding the other.
+
+ * Python 2.3 compatible.
+
+ * Trying to use ``Col('id')`` or ``id = Col()`` will raise an
+ exception, instead of just acting funky.
+
+ * ``ForeignKey`` columns return None if the associated column is
+ NULL in the database (used to just act weird).
+
+ * Instantiating an object with an id of None will give an error,
+ instead of just acting weird.
+
+ Internal
+ --------
+
+ * `Col` class separated into `Col` and `SOCol` (and same for all other
+ `*Col` classes). `Col` defines a column, `SOCol` is that definition
+ bound to a particular SQLObject class.
+
+ * Instance variable ``_SO_columns`` holds the `SOCol` instances.
+
SQLObject 0.3
=============
Index: SQLObject.html
===================================================================
RCS file: /cvsroot/sqlobject/SOWeb/docs/SQLObject.html,v
retrieving revision 1.3
retrieving revision 1.4
diff -C2 -d -r1.3 -r1.4
*** SQLObject.html 8 Apr 2003 04:05:04 -0000 1.3
--- SQLObject.html 5 Jul 2003 04:39:07 -0000 1.4
***************
*** 5,66 ****
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="generator" content="Docutils 0.2.8: http://docutils.sourceforge.net/" />
! <title>SQLObject 0.3</title>
<link rel="stylesheet" href="default.css" type="text/css" />
</head>
<body>
! <div class="document" id="sqlobject-0-3">
! <h1 class="title">SQLObject 0.3</h1>
<div class="contents topic" id="contents">
<p class="topic-title"><a name="contents">Contents:</a></p>
[...1877 lines suppressed...]
! * <cite>CurrencyCol</cite></p>
! <p>From <cite>SQLObject.Join</cite>:
! * <cite>MultipleJoin</cite>
! * <cite>RelatedJoin</cite></p>
! <p>From <cite>SQLObject.Style</cite>:
! * <cite>Style</cite>
! * <cite>MixedCaseUnderscoreStyle</cite>
! * <cite>DefaultStyle</cite>
! * <cite>MixedCaseStyle</cite></p>
! <p>From <cite>SQLObject.SQLBuilder</cite>:</p>
<ul class="simple">
<li><cite>AND</cite></li>
***************
*** 882,885 ****
--- 1130,1134 ----
<li><cite>IN</cite></li>
<li><cite>LIKE</cite></li>
+ <li><cite>DESC</cite></li>
<li><cite>CONTAINSSTRING</cite></li>
<li><cite>const</cite></li>
Index: SQLObject.txt
===================================================================
RCS file: /cvsroot/sqlobject/SOWeb/docs/SQLObject.txt,v
retrieving revision 1.3
retrieving revision 1.4
diff -C2 -d -r1.3 -r1.4
*** SQLObject.txt 8 Apr 2003 04:05:04 -0000 1.3
--- SQLObject.txt 5 Jul 2003 04:39:07 -0000 1.4
***************
*** 1,4 ****
```````````````
! SQLObject 0.3
```````````````
--- 1,4 ----
```````````````
! SQLObject 0.4
```````````````
***************
[...1617 lines suppressed...]
! * `MultipleJoin`
! * `RelatedJoin`
!
! From `SQLObject.Style`:
! * `Style`
! * `MixedCaseUnderscoreStyle`
! * `DefaultStyle`
! * `MixedCaseStyle`
!
! From `SQLObject.SQLBuilder`:
* `AND`
***************
*** 907,910 ****
--- 1017,1021 ----
* `IN`
* `LIKE`
+ * `DESC`
* `CONTAINSSTRING`
* `const`
Index: build
===================================================================
RCS file: /cvsroot/sqlobject/SOWeb/docs/build,v
retrieving revision 1.3
retrieving revision 1.4
diff -C2 -d -r1.3 -r1.4
*** build 13 Mar 2003 20:45:39 -0000 1.3
--- build 5 Jul 2003 04:39:07 -0000 1.4
***************
*** 4,7 ****
--- 4,8 ----
cp $SOURCEDIR/*.txt $SOURCEDIR/*.css .
+ cp $SOURCEDIR/../examples/snippets/*.html ../examples/snippets/
cd ..
buildhtml.py
Index: default.css
===================================================================
RCS file: /cvsroot/sqlobject/SOWeb/docs/default.css,v
retrieving revision 1.3
retrieving revision 1.4
diff -C2 -d -r1.3 -r1.4
*** default.css 8 Apr 2003 04:05:04 -0000 1.3
--- default.css 5 Jul 2003 04:39:07 -0000 1.4
***************
*** 108,121 ****
font-family: Helvetica, Arial, sans-serif;
border: thin solid black;
- background-color: #cccccc;
-moz-border-radius: 8px;
padding: 4px;
}
h1.title {
text-align: center;
background-color: #444499;
color: #eeeeee;
! border: medium solid black;
-moz-border-radius: 20px;
}
--- 108,137 ----
font-family: Helvetica, Arial, sans-serif;
border: thin solid black;
-moz-border-radius: 8px;
padding: 4px;
}
+ h1 {
+ background-color: #444499;
+ border: medium solid black;
+ color: #ffffff;
+ }
+
+ h2 {
+ background-color: #666666;
+ color: #ffffff;
+ border: medium solid black;
+ }
+
+ h3, h4, h5, h6 {
+ background-color: #cccccc;
+ color: #000000;
+ }
+
h1.title {
text-align: center;
background-color: #444499;
color: #eeeeee;
! border: thick solid black;
-moz-border-radius: 20px;
}
***************
*** 236,237 ****
--- 252,274 ----
ul.auto-toc {
list-style-type: none }
+
+ // Highlighting:
+
+ .function {color: #000077; font-weight: bold}
+ .keyword {color: #004444;}
+ .comment {color: #770000; font-style: italic}
+ .normal {color: #000000;}
+ .string {color: #006600;}
+ .symbol {color: #000000;}
+
+ .htmltag {color: #000077;}
+ .htmlsymbol {color: #000000;}
+ .htmlnormal {color: #000000;}
+ .htmlcomment {color: #770000; font-style: italic}
+ .htmlstring {color: #006600;}
+ .htmlattr {color: #000000;}
+
+ .stmlfunction {color: #000077; font-weight: bold}
+ .stmlattr {color: #000000;}
+ .stmlstring {color: #006600;}
+ .stmlexpr {color: #004444;}
\ No newline at end of file
|
|
From: <ian...@us...> - 2003-07-05 04:39:10
|
Update of /cvsroot/sqlobject/SOWeb
In directory sc8-pr-cvs1:/tmp/cvs-serv22271
Modified Files:
default.css index.html index.txt
Log Message:
Update for 0.4
Index: default.css
===================================================================
RCS file: /cvsroot/sqlobject/SOWeb/default.css,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** default.css 27 Feb 2003 09:06:11 -0000 1.1
--- default.css 5 Jul 2003 04:39:06 -0000 1.2
***************
*** 108,121 ****
font-family: Helvetica, Arial, sans-serif;
border: thin solid black;
- background-color: #cccccc;
-moz-border-radius: 8px;
padding: 4px;
}
h1.title {
text-align: center;
background-color: #444499;
color: #eeeeee;
! border: medium solid black;
-moz-border-radius: 20px;
}
--- 108,137 ----
font-family: Helvetica, Arial, sans-serif;
border: thin solid black;
-moz-border-radius: 8px;
padding: 4px;
}
+ h1 {
+ background-color: #444499;
+ border: medium solid black;
+ color: #ffffff;
+ }
+
+ h2 {
+ background-color: #666666;
+ color: #ffffff;
+ border: medium solid black;
+ }
+
+ h3, h4, h5, h6 {
+ background-color: #cccccc;
+ color: #000000;
+ }
+
h1.title {
text-align: center;
background-color: #444499;
color: #eeeeee;
! border: thick solid black;
-moz-border-radius: 20px;
}
***************
*** 236,237 ****
--- 252,274 ----
ul.auto-toc {
list-style-type: none }
+
+ // Highlighting:
+
+ .function {color: #000077; font-weight: bold}
+ .keyword {color: #004444;}
+ .comment {color: #770000; font-style: italic}
+ .normal {color: #000000;}
+ .string {color: #006600;}
+ .symbol {color: #000000;}
+
+ .htmltag {color: #000077;}
+ .htmlsymbol {color: #000000;}
+ .htmlnormal {color: #000000;}
+ .htmlcomment {color: #770000; font-style: italic}
+ .htmlstring {color: #006600;}
+ .htmlattr {color: #000000;}
+
+ .stmlfunction {color: #000077; font-weight: bold}
+ .stmlattr {color: #000000;}
+ .stmlstring {color: #006600;}
+ .stmlexpr {color: #004444;}
\ No newline at end of file
Index: index.html
===================================================================
RCS file: /cvsroot/sqlobject/SOWeb/index.html,v
retrieving revision 1.4
retrieving revision 1.5
diff -C2 -d -r1.4 -r1.5
*** index.html 8 Apr 2003 04:05:04 -0000 1.4
--- index.html 5 Jul 2003 04:39:06 -0000 1.5
***************
*** 51,59 ****
class Person(SQLObject):
! _columns = [Col('firstName'),
! Col('middleInitial', default=None),
! Col('lastName')]
</pre>
! <p>Here's the (MySQL) CREATE statement for that class:</p>
<pre class="literal-block">
CREATE TABLE person (
--- 51,59 ----
class Person(SQLObject):
! firstName = StringCol(length=100)
! middleInitial = StringCol(length=1, default=None)
! lastName = StringCol(length=100)
</pre>
! <p>Here's the (MySQL) <tt class="literal"><span class="pre">CREATE</span></tt> statement for that class:</p>
<pre class="literal-block">
CREATE TABLE person (
***************
*** 61,69 ****
first_name VARCHAR(100) NOT NULL,
middle_initial CHAR(1),
! last_name VARCHAR(150) NOT NULL
);
</pre>
! <p>Postgres works too with a slightly different CREATE statement and
! connection object, but it's otherwise identical.</p>
<p>Here's how you'd use the object:</p>
<pre class="literal-block">
--- 61,71 ----
first_name VARCHAR(100) NOT NULL,
middle_initial CHAR(1),
! last_name VARCHAR(100) NOT NULL
);
</pre>
! <p>SQLObject supports most database schemas that you already have, and
! can also issue the <tt class="literal"><span class="pre">CREATE</span></tt> statement for you. Postgres and SQLite are
! also supported, and SQLObject provides an abstraction layer that helps
! make your application much more portable between these databases.</p>
<p>Here's how you'd use the object:</p>
<pre class="literal-block">
***************
*** 85,90 ****
<div class="section" id="community">
<h1><a class="toc-backref" href="#id10" name="community">Community</a></h1>
! <p>Well, it's just starting, but I'd recommend <a class="reference" href="http://lists.sourceforge.net/lists/listinfo/sqlobject-discuss">joining the mailing
! list</a> or visiting the <a class="reference" href="http://sourceforge.net/mailarchive/forum.php?forum=sqlobject-discuss">sqlobject-discuss archives</a>.</p>
<p>If you are tracking changes, keeping up with CVS is helpful. To
access CVS:</p>
--- 87,91 ----
<div class="section" id="community">
<h1><a class="toc-backref" href="#id10" name="community">Community</a></h1>
! <p><a class="reference" href="http://lists.sourceforge.net/lists/listinfo/sqlobject-discuss">Join the mailing list</a> or visit the <a class="reference" href="http://sourceforge.net/mailarchive/forum.php?forum=sqlobject-discuss">sqlobject-discuss archives</a>.</p>
<p>If you are tracking changes, keeping up with CVS is helpful. To
access CVS:</p>
***************
*** 102,116 ****
patches. For simple bug fixes it's just as easy for me to get a line
number and the fixed line -- submitting patches is more overhead than
! it's worth for small changes.</p>
</div>
<div class="section" id="download">
<h1><a class="toc-backref" href="#id12" name="download">Download</a></h1>
! <p><a class="reference" href="http://prdownloads.sourceforge.net/sqlobject/SQLObject-0.3.tar.gz?download">SQLObject-0.3.tar.gz</a></p>
! <p><a class="reference" href="http://prdownloads.sourceforge.net/sqlobject/SQLObject-0.3-1.noarch.rpm?download">SQLObject-0.3-1.noarch.rpm</a></p>
! <p><a class="reference" href="http://prdownloads.sourceforge.net/sqlobject/SQLObject-0.3.win32.exe?download">SQLObject-0.3.win32.exe</a></p>
</div>
<div class="section" id="documentation">
<h1><a class="toc-backref" href="#id13" name="documentation">Documentation</a></h1>
! <p><a class="reference" href="docs/News.html">New in 0.3</a></p>
<p><a class="reference" href="docs/SQLObject.html">SQLObject documentation</a></p>
<p><a class="reference" href="docs/SQLBuilder.html">SQLBuilder documentation</a></p>
--- 103,118 ----
patches. For simple bug fixes it's just as easy for me to get a line
number and the fixed line -- submitting patches is more overhead than
! it's worth for small changes. But again, bug reports should go to the
! bug tracker, so that I don't lose anything.</p>
</div>
<div class="section" id="download">
<h1><a class="toc-backref" href="#id12" name="download">Download</a></h1>
! <p><a class="reference" href="http://prdownloads.sourceforge.net/sqlobject/SQLObject-0.4.tar.gz?download">SQLObject-0.4.tar.gz</a></p>
! <p><a class="reference" href="http://prdownloads.sourceforge.net/sqlobject/SQLObject-0.4-1.noarch.rpm?download">SQLObject-0.4-1.noarch.rpm</a></p>
! <p><a class="reference" href="http://prdownloads.sourceforge.net/sqlobject/SQLObject-0.4.win32.exe?download">SQLObject-0.4.win32.exe</a></p>
</div>
<div class="section" id="documentation">
<h1><a class="toc-backref" href="#id13" name="documentation">Documentation</a></h1>
! <p><a class="reference" href="docs/News.html">New in 0.4</a></p>
<p><a class="reference" href="docs/SQLObject.html">SQLObject documentation</a></p>
<p><a class="reference" href="docs/SQLBuilder.html">SQLBuilder documentation</a></p>
Index: index.txt
===================================================================
RCS file: /cvsroot/sqlobject/SOWeb/index.txt,v
retrieving revision 1.3
retrieving revision 1.4
diff -C2 -d -r1.3 -r1.4
*** index.txt 8 Apr 2003 04:05:04 -0000 1.3
--- index.txt 5 Jul 2003 04:39:06 -0000 1.4
***************
*** 38,46 ****
class Person(SQLObject):
! _columns = [Col('firstName'),
! Col('middleInitial', default=None),
! Col('lastName')]
! Here's the (MySQL) CREATE statement for that class::
CREATE TABLE person (
--- 38,46 ----
class Person(SQLObject):
! firstName = StringCol(length=100)
! middleInitial = StringCol(length=1, default=None)
! lastName = StringCol(length=100)
! Here's the (MySQL) ``CREATE`` statement for that class::
CREATE TABLE person (
***************
*** 48,56 ****
first_name VARCHAR(100) NOT NULL,
middle_initial CHAR(1),
! last_name VARCHAR(150) NOT NULL
);
! Postgres works too with a slightly different CREATE statement and
! connection object, but it's otherwise identical.
Here's how you'd use the object::
--- 48,58 ----
first_name VARCHAR(100) NOT NULL,
middle_initial CHAR(1),
! last_name VARCHAR(100) NOT NULL
);
! SQLObject supports most database schemas that you already have, and
! can also issue the ``CREATE`` statement for you. Postgres and SQLite are
! also supported, and SQLObject provides an abstraction layer that helps
! make your application much more portable between these databases.
Here's how you'd use the object::
***************
*** 73,78 ****
=========
! Well, it's just starting, but I'd recommend `joining the mailing
! list`__ or visiting the `sqlobject-discuss archives`_.
.. __: http://lists.sourceforge.net/lists/listinfo/sqlobject-discuss
--- 75,79 ----
=========
! `Join the mailing list`__ or visit the `sqlobject-discuss archives`_.
.. __: http://lists.sourceforge.net/lists/listinfo/sqlobject-discuss
***************
*** 100,104 ****
patches. For simple bug fixes it's just as easy for me to get a line
number and the fixed line -- submitting patches is more overhead than
! it's worth for small changes.
.. _SourceForge bug tracker: http://sourceforge.net/tracker/?atid=540672&group_id=74338&func=browse
--- 101,106 ----
patches. For simple bug fixes it's just as easy for me to get a line
number and the fixed line -- submitting patches is more overhead than
! it's worth for small changes. But again, bug reports should go to the
! bug tracker, so that I don't lose anything.
.. _SourceForge bug tracker: http://sourceforge.net/tracker/?atid=540672&group_id=74338&func=browse
***************
*** 107,126 ****
========
! SQLObject-0.3.tar.gz__
! __ http://prdownloads.sourceforge.net/sqlobject/SQLObject-0.3.tar.gz?download
! SQLObject-0.3-1.noarch.rpm__
! __ http://prdownloads.sourceforge.net/sqlobject/SQLObject-0.3-1.noarch.rpm?download
! SQLObject-0.3.win32.exe__
! __ http://prdownloads.sourceforge.net/sqlobject/SQLObject-0.3.win32.exe?download
Documentation
=============
! `New in 0.3`__
__ docs/News.html
--- 109,128 ----
========
! SQLObject-0.4.tar.gz__
! __ http://prdownloads.sourceforge.net/sqlobject/SQLObject-0.4.tar.gz?download
! SQLObject-0.4-1.noarch.rpm__
! __ http://prdownloads.sourceforge.net/sqlobject/SQLObject-0.4-1.noarch.rpm?download
! SQLObject-0.4.win32.exe__
! __ http://prdownloads.sourceforge.net/sqlobject/SQLObject-0.4.win32.exe?download
Documentation
=============
! `New in 0.4`__
__ docs/News.html
|
|
From: <ian...@us...> - 2003-07-05 03:55:25
|
Update of /cvsroot/sqlobject/SQLObject
In directory sc8-pr-cvs1:/tmp/cvs-serv18828
Modified Files:
setup.py
Log Message:
Version 0.4
Index: setup.py
===================================================================
RCS file: /cvsroot/sqlobject/SQLObject/setup.py,v
retrieving revision 1.10
retrieving revision 1.11
diff -C2 -d -r1.10 -r1.11
*** setup.py 1 Jul 2003 00:13:04 -0000 1.10
--- setup.py 5 Jul 2003 03:55:22 -0000 1.11
***************
*** 11,15 ****
setup(name="SQLObject",
! version="0.4rc1",
description="Object-Relational Manager, aka database wrapper",
long_description="""\
--- 11,15 ----
setup(name="SQLObject",
! version="0.4",
description="Object-Relational Manager, aka database wrapper",
long_description="""\
|
|
From: <ian...@us...> - 2003-07-05 03:49:55
|
Update of /cvsroot/sqlobject/SQLObject/SQLObject
In directory sc8-pr-cvs1:/tmp/cvs-serv18381
Modified Files:
SQLBuilder.py
Log Message:
Accept Unicode SQLBuilder literals
Index: SQLBuilder.py
===================================================================
RCS file: /cvsroot/sqlobject/SQLObject/SQLObject/SQLBuilder.py,v
retrieving revision 1.6
retrieving revision 1.7
diff -C2 -d -r1.6 -r1.7
*** SQLBuilder.py 26 Jun 2003 08:33:56 -0000 1.6
--- SQLBuilder.py 5 Jul 2003 03:49:52 -0000 1.7
***************
*** 109,113 ****
if isinstance(obj, SQLExpression):
return obj.sqlRepr()
! elif t is type(""):
for orig, repl in sqlStringReplace:
obj = obj.replace(orig, repl)
--- 109,113 ----
if isinstance(obj, SQLExpression):
return obj.sqlRepr()
! elif t is type("") or t is type(u""):
for orig, repl in sqlStringReplace:
obj = obj.replace(orig, repl)
|
|
From: <ian...@us...> - 2003-07-01 00:13:11
|
Update of /cvsroot/sqlobject/SQLObject
In directory sc8-pr-cvs1:/tmp/cvs-serv6733
Modified Files:
setup.py README.txt
Log Message:
0.3->0.4 version changes
Index: setup.py
===================================================================
RCS file: /cvsroot/sqlobject/SQLObject/setup.py,v
retrieving revision 1.9
retrieving revision 1.10
diff -C2 -d -r1.9 -r1.10
*** setup.py 28 Jun 2003 22:19:16 -0000 1.9
--- setup.py 1 Jul 2003 00:13:04 -0000 1.10
***************
*** 11,15 ****
setup(name="SQLObject",
! version="0.3",
description="Object-Relational Manager, aka database wrapper",
long_description="""\
--- 11,15 ----
setup(name="SQLObject",
! version="0.4rc1",
description="Object-Relational Manager, aka database wrapper",
long_description="""\
***************
*** 32,36 ****
license="LGPL",
packages=["SQLObject"],
! download_url="http://prdownloads.sourceforge.net/sqlobject/SQLObject-0.3.tar.gz?download")
# Send announce to:
--- 32,36 ----
license="LGPL",
packages=["SQLObject"],
! download_url="http://prdownloads.sourceforge.net/sqlobject/SQLObject-0.4.tar.gz?download")
# Send announce to:
Index: README.txt
===================================================================
RCS file: /cvsroot/sqlobject/SQLObject/README.txt,v
retrieving revision 1.3
retrieving revision 1.4
diff -C2 -d -r1.3 -r1.4
*** README.txt 8 Apr 2003 03:08:00 -0000 1.3
--- README.txt 1 Jul 2003 00:13:04 -0000 1.4
***************
*** 1,4 ****
=============
! SQLObject 0.3
=============
--- 1,4 ----
=============
! SQLObject 0.4
=============
|
|
From: <ian...@us...> - 2003-06-30 22:43:09
|
Update of /cvsroot/sqlobject/SQLObject/SQLObject
In directory sc8-pr-cvs1:/tmp/cvs-serv27689/SQLObject
Modified Files:
DBConnection.py
Log Message:
Fix a couple SQLite bugs (from Matt Goodall <ma...@po...>)
Index: DBConnection.py
===================================================================
RCS file: /cvsroot/sqlobject/SQLObject/SQLObject/DBConnection.py,v
retrieving revision 1.36
retrieving revision 1.37
diff -C2 -d -r1.36 -r1.37
*** DBConnection.py 28 Jun 2003 22:20:20 -0000 1.36
--- DBConnection.py 30 Jun 2003 22:43:06 -0000 1.37
***************
*** 149,153 ****
(", ".join(select.tables),
self.whereClauseForSelect(select, limit=0, order=0))
! val = self.queryOne(q)[0]
if self.debug:
print "COUNT results:", val
--- 149,153 ----
(", ".join(select.tables),
self.whereClauseForSelect(select, limit=0, order=0))
! val = int(self.queryOne(q)[0])
if self.debug:
print "COUNT results:", val
***************
*** 586,590 ****
return "%s LIMIT %i" % (query, end)
if not end:
! return "%s OFFSET %i" % (query, start)
return "%s LIMIT %i OFFSET %i" % (query, end-start, start)
--- 586,590 ----
return "%s LIMIT %i" % (query, end)
if not end:
! return "%s LIMIT 0 OFFSET %i" % (query, start)
return "%s LIMIT %i OFFSET %i" % (query, end-start, start)
|
|
From: <ian...@us...> - 2003-06-28 22:36:23
|
Update of /cvsroot/sqlobject/SQLObject/docs
In directory sc8-pr-cvs1:/tmp/cvs-serv3421
Modified Files:
SQLObject.txt
Log Message:
Added internal references
Index: SQLObject.txt
===================================================================
RCS file: /cvsroot/sqlobject/SQLObject/docs/SQLObject.txt,v
retrieving revision 1.13
retrieving revision 1.14
diff -C2 -d -r1.13 -r1.14
*** SQLObject.txt 28 Jun 2003 22:19:08 -0000 1.13
--- SQLObject.txt 28 Jun 2003 22:36:20 -0000 1.14
***************
*** 149,154 ****
We'll develop a simple addressbook-like database. We could create the
! tables ourselves (which I'll show later @@: link), but for now we'll
! let SQLObject do that work. First, the class:
.. raw:: html
--- 149,154 ----
We'll develop a simple addressbook-like database. We could create the
! tables ourselves, and just have SQLObject access those tables, but for
! now we'll let SQLObject do that work. First, the class:
.. raw:: html
***************
*** 169,174 ****
different (especially the ``id`` column). You'll notice the names
were changed from mixedCase to underscore_separated -- this is done by
! the style object (@@: link). There are a variety of ways to handle
! other names that are not as SQLObject expects (@@: link).
The tables don't yet exist. We'll let SQLObject create them:
--- 169,176 ----
different (especially the ``id`` column). You'll notice the names
were changed from mixedCase to underscore_separated -- this is done by
! the `style object`_. There are a variety of ways to handle
! other names that are not as SQLObject expects (see `Irregular Naming`_).
!
! .. _`style object`: `Changing the Naming Style`_
The tables don't yet exist. We'll let SQLObject create them:
***************
*** 178,183 ****
We can change the type of the various columns by using something other
! than `StringCol`, or using different arguments. More about this @@:
! link.
If you don't want to do table creation (you already have tables, or
--- 180,185 ----
We can change the type of the various columns by using something other
! than `StringCol`, or using different arguments. More about this in
! `Subclasses of Col`_.
If you don't want to do table creation (you already have tables, or
***************
*** 190,195 ****
definition, it is implied. For MySQL databases it should be defined
as ``INT PRIMARY KEY AUTO_INCREMENT``, in Postgres ``SERIAL PRIMARY
! KEY``, and in SQLite as ``INTEGER PRIMARY KEY``. You can override the
! name (@@: link), but some integer primary key must exist.
Using the Class
--- 192,199 ----
definition, it is implied. For MySQL databases it should be defined
as ``INT PRIMARY KEY AUTO_INCREMENT``, in Postgres ``SERIAL PRIMARY
! KEY``, and in SQLite as ``INTEGER PRIMARY KEY``. You can `override the
! name`__, but some integer primary key must exist.
!
! __ idName_
Using the Class
***************
*** 227,231 ****
multiple threads accessing the same data (though of course across
processes there can be no sharing of an instance). This changes if
! you're using transactions (@@: link).
To get an idea of what's happening behind the surface, I'll give the
--- 231,235 ----
multiple threads accessing the same data (though of course across
processes there can be no sharing of an instance). This changes if
! you're using transactions_.
To get an idea of what's happening behind the surface, I'll give the
***************
*** 352,360 ****
you're selecting is always assumed to be included, of course.
You can use the keyword arguments `orderBy` and `groupBy` to create
``ORDER BY`` and ``GROUP BY`` in the select statements: `orderBy`
takes a string, which should be the *database* name of the column, or
a column in the form ``Person.q.firstName``; `groupBy` is similar.
! Both accept lists or tuples of arguments.
You can use the special class variable `_defaultOrder` to give a
--- 356,367 ----
you're selecting is always assumed to be included, of course.
+ .. _orderBy:
+
You can use the keyword arguments `orderBy` and `groupBy` to create
``ORDER BY`` and ``GROUP BY`` in the select statements: `orderBy`
takes a string, which should be the *database* name of the column, or
a column in the form ``Person.q.firstName``; `groupBy` is similar.
! Both accept lists or tuples of arguments. You can use ``"-colname"``
! to specify descending order, or call ``MyClass.select().reversed()``.
You can use the special class variable `_defaultOrder` to give a
***************
*** 542,546 ****
`ForeignKey`:
A key to another table/class. Use like ``user =
! ForeignKey('User')``. (@@: test)
`EnumCol`:
One of several string values -- give the possible strings as a
--- 549,553 ----
`ForeignKey`:
A key to another table/class. Use like ``user =
! ForeignKey('User')``.
`EnumCol`:
One of several string values -- give the possible strings as a
***************
*** 569,578 ****
--- 576,588 ----
class). You can also pass a connection object in at instance
creation time, as described in transactions_.
+
`_table`:
The database name of the table for this class. If you don't give
a name, then the standard ``MixedCase`` to ``mixed_case``
translation is performed.
+
`_joins`:
A list of `Join` objects. This is covered below.
+
`_cacheValues`:
If set to ``False`` then values for attributes from the database
***************
*** 582,591 ****
then this is probably the way to do so. You should also use
it with transactions_ (it is not implied).
`_idName`:
The name of the primary key column (default ``id``).
`_style`:
A style object -- this object allows you to use other algorithms
for translating between Python attribute and class names, and the
! database's column and table names. (@@: link)
Relationships Between Classes/Tables
--- 592,608 ----
then this is probably the way to do so. You should also use
it with transactions_ (it is not implied).
+
+ .. _idName:
+
`_idName`:
The name of the primary key column (default ``id``).
+
`_style`:
A style object -- this object allows you to use other algorithms
for translating between Python attribute and class names, and the
! database's column and table names. See `Changing the Naming
! Style`_ for more.
!
! .. Relationships_:
Relationships Between Classes/Tables
***************
*** 611,619 ****
points to this table, then you'd use ``joinColumn="ProductNo"``.
`orderBy`:
! Like the `orderBy` argument to `select()` (@@: link), you can specify
the order that the joined objects should be returned in. `_defaultOrder`
will be used if not specified; ``None`` forces unordered results.
`joinMethodName`:
! When adding joins dynamically (using the class method `addJoin` @@: link),
you can give the name of the accessor for the join. It can also be
created automatically, and is normally implied (i.e., ``addresses =
--- 628,636 ----
points to this table, then you'd use ``joinColumn="ProductNo"``.
`orderBy`:
! Like the `orderBy`_ argument to `select()`, you can specify
the order that the joined objects should be returned in. `_defaultOrder`
will be used if not specified; ``None`` forces unordered results.
`joinMethodName`:
! When adding joins dynamically (using the class method `addJoin`_),
you can give the name of the accessor for the join. It can also be
created automatically, and is normally implied (i.e., ``addresses =
***************
*** 634,641 ****
The name of the intermediate table which references both classes.
`addRemoveName`:
! In the user/role example (@@: link), the methods `addRole(role)` and
`removeRole(role)` are created. The ``Role`` portion of these
method names can be changed by giving a string value here.
An example schema that requires the use of `joinColumn`, `otherColumn`,
and `intermediateTable`::
--- 651,660 ----
The name of the intermediate table which references both classes.
`addRemoveName`:
! In the `user/role example`__, the methods `addRole(role)` and
`removeRole(role)` are created. The ``Role`` portion of these
method names can be changed by giving a string value here.
+ __ `Many-to-Many Relationships`_
+
An example schema that requires the use of `joinColumn`, `otherColumn`,
and `intermediateTable`::
***************
*** 726,730 ****
This is a reference to another table. You typically need to
only give the name of the foreign class that is referenced.
! `ForeignKey` implies an ``INT`` column. (@@: link)
Creating and Dropping Tables
--- 745,749 ----
This is a reference to another table. You typically need to
only give the name of the foreign class that is referenced.
! `ForeignKey` implies an ``INT`` column.
Creating and Dropping Tables
***************
*** 785,792 ****
``MyClass.delColumn("username")``).
! You can also add Joins (@@: link), like
``MyClass.addJoin(MultipleJoin("MyOtherClass"))``, and remove joins with
`delJoin`. `delJoin` does not take strings, you have to get the join
object out of the `_joins` attribute.
Legacy Database Schemas
--- 804,815 ----
``MyClass.delColumn("username")``).
! .. _addJoin:
!
! You can also add Joins__, like
``MyClass.addJoin(MultipleJoin("MyOtherClass"))``, and remove joins with
`delJoin`. `delJoin` does not take strings, you have to get the join
object out of the `_joins` attribute.
+
+ __ Relationships_:
Legacy Database Schemas
|
|
From: <ian...@us...> - 2003-06-28 22:21:23
|
Update of /cvsroot/sqlobject/SQLObject/SQLObject
In directory sc8-pr-cvs1:/tmp/cvs-serv1718/SQLObject
Modified Files:
Col.py
Log Message:
Fix CurrencyCol
Index: Col.py
===================================================================
RCS file: /cvsroot/sqlobject/SQLObject/SQLObject/Col.py,v
retrieving revision 1.23
retrieving revision 1.24
diff -C2 -d -r1.23 -r1.24
*** Col.py 31 May 2003 02:00:27 -0000 1.23
--- Col.py 28 Jun 2003 22:21:21 -0000 1.24
***************
*** 347,350 ****
--- 347,353 ----
SODecimalCol.__init__(self, **kw)
+ class CurrencyCol(DecimalCol):
+ baseClass = SOCurrencyCol
+
def popKey(kw, name, default=None):
if not kw.has_key(name):
|
|
From: <ian...@us...> - 2003-06-28 22:20:57
|
Update of /cvsroot/sqlobject/SQLObject/tests
In directory sc8-pr-cvs1:/tmp/cvs-serv1615
Modified Files:
test.py
Log Message:
Tweak new-style naming
Index: test.py
===================================================================
RCS file: /cvsroot/sqlobject/SQLObject/tests/test.py,v
retrieving revision 1.17
retrieving revision 1.18
diff -C2 -d -r1.17 -r1.18
*** test.py 26 Jun 2003 08:33:56 -0000 1.17
--- test.py 28 Jun 2003 22:20:55 -0000 1.18
***************
*** 9,14 ****
class TestSO1(SQLObject):
_columns = [
- StringCol('name', length=10),
StringCol('passwd', length=10),
]
--- 9,15 ----
class TestSO1(SQLObject):
+ name = StringCol(length=10)
+
_columns = [
StringCol('passwd', length=10),
]
|
|
From: <ian...@us...> - 2003-06-28 22:20:41
|
Update of /cvsroot/sqlobject/SQLObject/SQLObject
In directory sc8-pr-cvs1:/tmp/cvs-serv1550
Modified Files:
Style.py
Log Message:
Added MixedCaseStyle, tweaked styles
Index: Style.py
===================================================================
RCS file: /cvsroot/sqlobject/SQLObject/SQLObject/Style.py,v
retrieving revision 1.3
retrieving revision 1.4
diff -C2 -d -r1.3 -r1.4
*** Style.py 12 May 2003 01:58:21 -0000 1.3
--- Style.py 28 Jun 2003 22:20:37 -0000 1.4
***************
*** 1,5 ****
import re
! __all__ = ["Style", "MixedCaseUnderscoreStyle", "DefaultStyle"]
class Style(object):
--- 1,6 ----
import re
! __all__ = ["Style", "MixedCaseUnderscoreStyle", "DefaultStyle",
! "MixedCaseStyle"]
class Style(object):
***************
*** 16,20 ****
pythonClassToDBTable=None,
dbTableToPythonClass=None,
! idForTable=None):
if pythonAttrToDBColumn:
self.pythonAttrToDBColumn = lambda a, s=self: pythonAttrToDBColumn(s, a)
--- 17,22 ----
pythonClassToDBTable=None,
dbTableToPythonClass=None,
! idForTable=None,
! longID=False):
if pythonAttrToDBColumn:
self.pythonAttrToDBColumn = lambda a, s=self: pythonAttrToDBColumn(s, a)
***************
*** 27,30 ****
--- 29,33 ----
if idForTable:
self.idForTable = lambda a, s=self: idForTable(s, a)
+ self.longID = longID
def pythonAttrToDBColumn(self, attr):
***************
*** 41,48 ****
def idForTable(self, table):
! return 'id'
def pythonClassToAttr(self, className):
! return className[0].lower() + className[1:]
def instanceAttrToIDAttr(self, attr):
--- 44,54 ----
def idForTable(self, table):
! if self.longID:
! return self.tableReference(table)
! else:
! return 'id'
def pythonClassToAttr(self, className):
! return lowerword(className)
def instanceAttrToIDAttr(self, attr):
***************
*** 80,89 ****
DefaultStyle = MixedCaseUnderscoreStyle
! def longID(self, table):
"""
! Use SomeStyle(idForTable=longID) to use this. This will
! make table IDs use the full table, like person_id.
"""
! return
defaultStyle = DefaultStyle()
--- 86,107 ----
DefaultStyle = MixedCaseUnderscoreStyle
! class MixedCaseStyle(Style):
!
"""
! This style leaves columns as mixed-case, and uses long
! ID names (like ProductID instead of simply id).
"""
!
! def pythonAttrToDBColumn(self, attr):
! return capword(attr)
!
! def dbColumnToPythonAttr(self, col):
! return lowerword(col)
!
! def dbTableToPythonClass(self, table):
! return capword(table)
!
! def tableReference(self, table):
! return table + "ID"
defaultStyle = DefaultStyle()
***************
*** 118,121 ****
--- 136,145 ----
else:
return '_%s' % m
+
+ def capword(s):
+ return s[0].upper() + s[1:]
+
+ def lowerword(s):
+ return s[0].lower() + s[1:]
_underToMixedRE = re.compile('_.')
|
|
From: <ian...@us...> - 2003-06-28 22:20:25
|
Update of /cvsroot/sqlobject/SQLObject/SQLObject
In directory sc8-pr-cvs1:/tmp/cvs-serv1501
Modified Files:
DBConnection.py Join.py
Log Message:
More descending sorting support
Index: DBConnection.py
===================================================================
RCS file: /cvsroot/sqlobject/SQLObject/SQLObject/DBConnection.py,v
retrieving revision 1.35
retrieving revision 1.36
diff -C2 -d -r1.35 -r1.36
*** DBConnection.py 26 Jun 2003 08:33:56 -0000 1.35
--- DBConnection.py 28 Jun 2003 22:20:20 -0000 1.36
***************
*** 13,16 ****
--- 13,17 ----
import os
import anydbm
+ from Join import sorter
try:
***************
*** 832,839 ****
self._maxNext = -1
results = self.allResults()
! def cmper(a, b, orderBy=select.ops['orderBy']):
! return cmp(getattr(a, orderBy),
! getattr(b, orderBy))
! results.sort(cmper)
self._results = results
if select.ops.get('start'):
--- 833,837 ----
self._maxNext = -1
results = self.allResults()
! results.sort(sorter(select.ops['orderBy']))
self._results = results
if select.ops.get('start'):
Index: Join.py
===================================================================
RCS file: /cvsroot/sqlobject/SQLObject/SQLObject/Join.py,v
retrieving revision 1.4
retrieving revision 1.5
diff -C2 -d -r1.4 -r1.5
*** Join.py 26 Jun 2003 08:33:56 -0000 1.4
--- Join.py 28 Jun 2003 22:20:20 -0000 1.5
***************
*** 52,85 ****
self.orderBy = defaultSortClass._defaultOrder
if self.orderBy is not None:
! def sorter(a, b, attr=self.orderBy):
! if attr.startswith('-'):
! return -sorter(a, b, attr=attr[1:])
! return cmp(getattr(a, attr),
! getattr(b, attr))
! results.sort(self._sorter(self.orderBy))
return results
! def _sorter(self, orderBy):
! if isinstance(orderBy, tuple) or isinstance(orderBy, list):
! if len(orderBy) == 1:
! orderBy = orderBy[0]
! else:
! fhead = self._sorter(orderBy[0])
! frest = self._sorter(orderBy[1:])
! return lambda a, b, fhead=fhead, frest=frest: fhead(a, b) or frest(a, b)
! if isinstance(orderBy, SQLBuilder.DESC) \
! and isinstance(orderBy.expr, SQLBuilder.SQLObjectField):
! orderBy = '-' + orderBy.expr.original
! elif isinstance(orderBy, SQLBuilder.SQLObjectField):
! orderBy = orderBy.original
! # @@: but we don't handle more complex expressions for orderings
! if orderBy.startswith('-'):
! orderBy = orderBy[1:]
! def sorter(a, b, attr=orderBy):
! return cmp(getattr(b, attr), getattr(a, attr))
else:
! def sorter(a, b, attr=orderBy):
! return cmp(getattr(a, attr), getattr(b, attr))
! return sorter
# This is a one-to-many
--- 52,80 ----
self.orderBy = defaultSortClass._defaultOrder
if self.orderBy is not None:
! results.sort(sorter(self.orderBy))
return results
! def sorter(orderBy):
! if isinstance(orderBy, tuple) or isinstance(orderBy, list):
! if len(orderBy) == 1:
! orderBy = orderBy[0]
else:
! fhead = sorter(orderBy[0])
! frest = sorter(orderBy[1:])
! return lambda a, b, fhead=fhead, frest=frest: fhead(a, b) or frest(a, b)
! if isinstance(orderBy, SQLBuilder.DESC) \
! and isinstance(orderBy.expr, SQLBuilder.SQLObjectField):
! orderBy = '-' + orderBy.expr.original
! elif isinstance(orderBy, SQLBuilder.SQLObjectField):
! orderBy = orderBy.original
! # @@: but we don't handle more complex expressions for orderings
! if orderBy.startswith('-'):
! orderBy = orderBy[1:]
! def cmper(a, b, attr=orderBy):
! return cmp(getattr(b, attr), getattr(a, attr))
! else:
! def cmper(a, b, attr=orderBy):
! return cmp(getattr(a, attr), getattr(b, attr))
! return cmper
# This is a one-to-many
|
|
From: <ian...@us...> - 2003-06-28 22:19:29
|
Update of /cvsroot/sqlobject/SQLObject
In directory sc8-pr-cvs1:/tmp/cvs-serv1374
Modified Files:
setup.py
Log Message:
Filter warnings
Index: setup.py
===================================================================
RCS file: /cvsroot/sqlobject/SQLObject/setup.py,v
retrieving revision 1.8
retrieving revision 1.9
diff -C2 -d -r1.8 -r1.9
*** setup.py 8 Apr 2003 09:04:55 -0000 1.8
--- setup.py 28 Jun 2003 22:19:16 -0000 1.9
***************
*** 1,3 ****
--- 1,5 ----
from distutils.core import setup
+ import warnings
+ warnings.filterwarnings("ignore", "Unknown distribution option")
import sys
|
|
From: <ian...@us...> - 2003-06-28 22:19:10
|
Update of /cvsroot/sqlobject/SQLObject/docs In directory sc8-pr-cvs1:/tmp/cvs-serv1329 Modified Files: SQLObject.txt Log Message: Rewrite for 0.4 Index: SQLObject.txt =================================================================== RCS file: /cvsroot/sqlobject/SQLObject/docs/SQLObject.txt,v retrieving revision 1.12 retrieving revision 1.13 diff -C2 -d -r1.12 -r1.13 *** SQLObject.txt 29 Apr 2003 08:23:17 -0000 1.12 --- SQLObject.txt 28 Jun 2003 22:19:08 -0000 1.13 *************** *** 1,4 **** ``````````````` ! SQLObject 0.3 ``````````````` --- 1,4 ---- ``````````````` ! SQLObject 0.4 ``````````````` *************** [...1572 lines suppressed...] ! * `MultipleJoin` ! * `RelatedJoin` ! ! From `SQLObject.Style`: ! * `Style` ! * `MixedCaseUnderscoreStyle` ! * `DefaultStyle` ! * `MixedCaseStyle` ! ! From `SQLObject.SQLBuilder`: * `AND` *************** *** 908,911 **** --- 994,998 ---- * `IN` * `LIKE` + * `DESC` * `CONTAINSSTRING` * `const` |
|
From: <ian...@us...> - 2003-06-28 22:18:52
|
Update of /cvsroot/sqlobject/SQLObject/docs
In directory sc8-pr-cvs1:/tmp/cvs-serv1312
Modified Files:
default.css
Log Message:
Made header levels more distinct
Index: default.css
===================================================================
RCS file: /cvsroot/sqlobject/SQLObject/docs/default.css,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -C2 -d -r1.1.1.1 -r1.2
*** default.css 26 Feb 2003 23:59:42 -0000 1.1.1.1
--- default.css 28 Jun 2003 22:18:49 -0000 1.2
***************
*** 108,121 ****
font-family: Helvetica, Arial, sans-serif;
border: thin solid black;
- background-color: #cccccc;
-moz-border-radius: 8px;
padding: 4px;
}
h1.title {
text-align: center;
background-color: #444499;
color: #eeeeee;
! border: medium solid black;
-moz-border-radius: 20px;
}
--- 108,137 ----
font-family: Helvetica, Arial, sans-serif;
border: thin solid black;
-moz-border-radius: 8px;
padding: 4px;
}
+ h1 {
+ background-color: #444499;
+ border: medium solid black;
+ color: #ffffff;
+ }
+
+ h2 {
+ background-color: #666666;
+ color: #ffffff;
+ border: medium solid black;
+ }
+
+ h3, h4, h5, h6 {
+ background-color: #cccccc;
+ color: #000000;
+ }
+
h1.title {
text-align: center;
background-color: #444499;
color: #eeeeee;
! border: thick solid black;
-moz-border-radius: 20px;
}
***************
*** 236,237 ****
--- 252,274 ----
ul.auto-toc {
list-style-type: none }
+
+ // Highlighting:
+
+ .function {color: #000077; font-weight: bold}
+ .keyword {color: #004444;}
+ .comment {color: #770000; font-style: italic}
+ .normal {color: #000000;}
+ .string {color: #006600;}
+ .symbol {color: #000000;}
+
+ .htmltag {color: #000077;}
+ .htmlsymbol {color: #000000;}
+ .htmlnormal {color: #000000;}
+ .htmlcomment {color: #770000; font-style: italic}
+ .htmlstring {color: #006600;}
+ .htmlattr {color: #000000;}
+
+ .stmlfunction {color: #000077; font-weight: bold}
+ .stmlattr {color: #000000;}
+ .stmlstring {color: #006600;}
+ .stmlexpr {color: #004444;}
\ No newline at end of file
|
|
From: <ian...@us...> - 2003-06-28 22:18:21
|
Update of /cvsroot/sqlobject/SQLObject/docs In directory sc8-pr-cvs1:/tmp/cvs-serv1283 Added Files: build Log Message: Added builder to go with new example structure --- NEW FILE: build --- #!/bin/sh pushd ../examples > /dev/null ./examplestripper.py popd > /dev/null buildhtml.py --no-toc-backlinks |
Update of /cvsroot/sqlobject/SQLObject/examples
In directory sc8-pr-cvs1:/tmp/cvs-serv1222
Added Files:
codebits.py config.py examplestripper.py personaddress.py
setup.py simpleperson.py styles.py userrole.py
Log Message:
Added examples, example stripper
--- NEW FILE: codebits.py ---
# This isn't a full example...
## Snippet "person_magicmethod"
class Person(SQLObject):
# ...
def imageFilename(self):
return 'images/person-%s.jpg' % self.id
def _get_image(self):
if not os.path.exists(self.imageFilename()):
return None
f = open(self.imageFilename())
v = f.read()
f.close()
return v
def _set_image(self, value):
# assume we get a string for the image
f = open(self.imageFilename(), 'w')
f.write(value)
f.close()
def _del_image(self, value):
# I usually wouldn't include a method like this, but for
# instructional purposes...
os.unlink(self.imageFilename())
_doc_image = 'The headshot for the person'
## end snippet
## Snippet "person_magicoverride"
class Person(SQLObject):
lastName = StringCol()
firstName = StringCol()
def _set_lastName(self, value):
self.notifyLastNameChange(value)
self._SO_set_lastName(value)
## end snippet
## Snippet "phonenumber_magicoverride"
import re
class PhoneNumber(SQLObject):
phoneNumber = StringCol(length=30)
_garbageCharactersRE = re.compile(r'[\-\.\(\) ]')
_phoneNumberRE = re.compile(r'^[0-9]+$')
def _set_phoneNumber(self, value):
value = self._garbageCharactersRE.sub('', value)
if not len(value) >= 10:
raise ValueError, 'Phone numbers must be at least 10 digits long'
if not self._phoneNumberRE.match(value):
raise ValueError, 'Phone numbers can contain only digits'
self._SO_set_phoneNumber(value)
def _get_phoneNumber(self):
value = self._SO_get_phoneNumber()
number = '(%s) %s-%s' % (value[0:3], value[3:6], value[6:10])
if len(value) > 10:
number += ' ext.%s' % value[10:]
return number
## end snippet
## Snippet "transactions1"
conn = DBConnection.PostgresConnection('yada')
trans = conn.transaction()
p = Person(1, trans)
p.firstName = 'Bob'
trans.commit()
p.firstName = 'Billy'
trans.rollback()
## end snippet
## Snippet "transactions2"
class Person(SQLObject):
_cacheValue = False
# ...
## end snippet
--- NEW FILE: config.py ---
from SQLObject import *
"""
This contains basic configuration for all the examples. Since they
all require a connection, you can configure that just in this file.
"""
## Use one of these to define your connection:
"""
conn = MySQLConnection(user='test', db='testdb')
conn = PostgresConnection('user=test dbname=testdb')
conn = SQLiteConnect('database.db')
conn = DBMConnection('database/')
"""
conn = DBMConnection('database/')
conn = MySQLConnection(user='test', db='test')
--- NEW FILE: examplestripper.py ---
#!/usr/bin/env python
"""
This script strips bits of examples from a larger script, formats
them as HTML, and writes them out.
You mark snippets of code like:
## Snippet "snippetname"
code...
## End Snippet
Then a file snippets/snippetname.html is created.
"""
import re, os, sys
import warnings
_snippetRE = re.compile(r'^##\s+Snippet\s+"(.*?)"', re.I)
_endSnippetRE = re.compile(r'^##\s+End\s+Snippet', re.I)
def stripSnippets(lines):
results = {}
name = None
for line in lines:
match = _snippetRE.search(line)
if match:
if name is not None:
warnings.warn('You started snippet %s when snippet %s was not ended'
% (match.group(1), name))
name = match.group(1)
continue
match = _endSnippetRE.search(line)
if match:
name = None
if name is None:
continue
results.setdefault(name, []).append(line)
return results
_bodyRE = re.compile(r'<body[^>]*>', re.I)
_endBodyRE = re.compile(r'</body>', re.I)
_preRE = re.compile(r'<pre>\n<tt>\n', re.I)
_endPreRE = re.compile(r'\n</pre>', re.I)
def snipFile(filename):
f = open(filename)
d = stripSnippets(f)
f.close()
dirname = os.path.join(os.path.dirname(filename), 'snippets')
if not os.path.exists(dirname):
os.mkdir(dirname)
for key, value in d.items():
fn = os.path.join(dirname, '%s' % key)
f = open(fn + ".py", 'w')
f.write(''.join(value))
f.close()
os.system('source-highlight -spython -fxhtml -cdefault.css %s > /dev/null 2>&1'
% (fn + ".py"))
f = open(fn + ".py.html")
c = f.read()
f.close()
os.unlink(fn + ".py.html")
c = c[_bodyRE.search(c).end():]
c = c[:_endBodyRE.search(c).start()]
c = _preRE.sub('<pre class="literal-block"><tt>', c)
c = _endPreRE.sub('</pre>', c)
f = open(fn + ".html", 'w')
f.write(c)
f.close()
def snipAll(dir):
if dir == sys.argv[0]:
return
if dir.endswith('snippets'):
return
if os.path.isdir(dir):
for fn in os.listdir(dir):
fn = os.path.join(dir, fn)
snipAll(fn)
elif dir.endswith('.py'):
snipFile(dir)
if __name__ == '__main__':
args = sys.argv[1:]
if not args:
args = ['.']
for arg in args:
snipAll(arg)
--- NEW FILE: personaddress.py ---
from SQLObject import *
from config import conn
__connection__ = conn
## Snippet "address-person"
class Person(SQLObject):
firstName = StringCol()
middleInitial = StringCol(length=1, default=None)
lastName = StringCol()
addresses = MultipleJoin('Address')
## end snippet
## Snippet "address-address"
class Address(SQLObject):
street = StringCol()
city = StringCol()
state = StringCol(length=2)
zip = StringCol(length=9)
person = ForeignKey('Person')
## end snippet
def reset():
Person.dropTable(ifExists=True)
Person.createTable()
Address.dropTable(ifExists=True)
Address.createTable()
reset()
## Snippet "address-use1"
p = Person.new(firstName='John', lastName='Doe')
print p.addresses
#>> []
a1 = Address.new(street='123', city='Smallsville',
state='IL', zip='50484', person=p)
print [a.street for a in p.addresses]
#>> ['123']
## end snippet
# We'll add some more data to make the results more interesting:
add1 = Person.new(firstName='Jane', lastName='Doe')
add2 = Person.new(firstName='Tom', lastName='Brown')
Address.new(street='5839', city='Eckersville',
state='IL', zip='50482', person=add1)
Address.new(street='4', city='Whinging',
state='AZ', zip='49378', person=add2)
## Snippet "person-select1"
peeps = Person.select(Person.q.firstName=="John")
print list(peeps)
#>> [<Person 1 lastName='Doe' middleInitial=None firstName='John'>]
# SELECT person.id FROM person WHERE person.first_name = 'John';
## end snippet
## Snippet "person-select2"
peeps = Person.select(
AND(Address.q.personID == Person.q.id,
Address.q.zip.startswith('504')))
print list(peeps)
# SELECT person.id FROM person, phone_number
# WHERE (phone_number.id = person.id AND
# phone_number.phone_number LIKE '612%');
## end snippet
## Snippet "person-select3"
peeps = Person.select("""address.id = person.id AND
address.zip LIKE '504%'""",
clauseTables=['address'])
## end snippet
list(peeps)
--- NEW FILE: setup.py ---
import sys
from config import conn
import SQLObject
main = sys.modules['__main__']
if '-v' in sys.argv:
conn.debug = 1
def reset():
classes = []
for name in dir(main):
value = getattr(main, name)
if isinstance(value, type) \
and issubclass(value, SQLObject.SQLObject)\
and value is not SQLObject.SQLObject:
value.dropTable(ifExists=True)
value.createTable()
--- NEW FILE: simpleperson.py ---
from SQLObject import *
## Use one of these to define your connection:
"""
## Snippet "connections"
conn = MySQLConnection(user='test', db='testdb')
conn = PostgresConnection('user=test dbname=testdb')
conn = SQLiteConnect('database.db')
conn = DBMConnection('database/')
## End snippet
"""
conn = DBMConnection('database/')
conn = MySQLConnection(user='test', db='test')
## Snippet "simpleaddress-person1"
class Person(SQLObject):
_connection = conn
firstName = StringCol()
middleInitial = StringCol(length=1, default=None)
lastName = StringCol()
## end snippet
## We create a table like this: (for MySQL)
"""
## Snippet "simpleaddress-schema-person1"
CREATE TABLE person (
id INT PRIMARY KEY AUTO_INCREMENT,
first_name TEXT,
middle_initial CHAR(1),
last_name TEXT
);
## end snippet
"""
def reset():
Person.dropTable(ifExists=True)
Person.createTable()
## Get rid of any tables we have left over...
Person.dropTable(ifExists=True)
## Now we create new tables...
## Snippet "simpleaddress-person1-create"
Person.createTable()
## End snippet
## Snippet "simpleaddress-person1-use"
p = Person.new(firstName="John", lastName="Doe")
print p
#>> <Person 1 firstName='John' middleInitial=None lastName='Doe'>
print p.firstName
#>> 'John'
p.middleInitial = 'Q'
print p.middleInitial
#>> 'Q'
p2 = Person(1)
print p2
#>> <Person 1 firstName='John' middleInitial='Q' lastName='Doe'>
print p is p2
#>> True
## End snippet
reset()
print '-'*60
conn.debug = 1
## Snippet "simpleaddress-person1-use-debug"
p = Person.new(firstName="John", lastName="Doe")
#>> QueryIns:
# INSERT INTO person (last_name, middle_initial, first_name)
# VALUES ('Doe', NULL, 'John')
#
#-- Not quite optimized, we don't remember the values we used to
#-- create the object, so they get re-fetched from the database:
#>> QueryOne:
# SELECT last_name, middle_initial, first_name
# FROM person
# WHERE id = 1
print p
#>> <Person 1 firstName='John' middleInitial=None lastName='Doe'>
print p.firstName
#-- Now we've saved cached the column values, so we don't fetch
#-- it again.
#>> 'John'
p.middleInitial = 'Q'
#>> Query :
# UPDATE person
# SET middle_initial = 'Q'
# WHERE id = 1
print p.middleInitial
#>> 'Q'
p2 = Person(1)
#-- Again, no database access, since we're just grabbing the same
#-- instance we already had.
print p2
#>> <Person 1 firstName='John' middleInitial='Q' lastName='Doe'>
print p is p2
#>> True
## End snippet
## Snippet "simpleaddress-person1-use-set"
p.set(firstName='Bob', lastName='Dole')
## end snippet
--- NEW FILE: styles.py ---
from SQLObject import *
from config import conn
__connection__ = conn
## Snippet "style1"
class Person(SQLObject):
_style = MixedCaseStyle(longID=True)
firstName = StringCol()
lastName = StringCol()
## end snippet
"""
## Snippet "default-style"
__connection__.style = MixedCaseStyle(longID=True)
## end snippet
"""
## Snippet "style-table"
class User(SQLObject):
_table = "user_table"
_idName = "userid"
username = StringCol(length=20, dbName='name')
## end snippet
--- NEW FILE: userrole.py ---
from SQLObject import *
import setup
__connection__ = setup.conn
True, False = 1==1, 0==1
## Snippet "userrole-classes"
class User(SQLObject):
# user is a reserved word in some databases, so we won't
# use that for the table name:
_table = "user_table"
username = StringCol(alternateID=True, length=20)
# We'd probably define more attributes, but we'll leave
# that excersize to the reader...
roles = RelatedJoin('Role')
class Role(SQLObject):
name = StringCol(alternateID=True, length=20)
users = RelatedJoin('User')
## end snippet
#def reset():
# User.dropTable(ifExists=True)
# User.createTable()
# Role.dropTable(ifExists=True)
# Role.createTable()
setup.reset()
## Snippet "userrole-use"
bob = User.new(username='bob')
tim = User.new(username='tim')
jay = User.new(username='jay')
admin = Role.new(name='admin')
editor = Role.new(name='editor')
bob.addRole(admin)
bob.addRole(editor)
tim.addRole(editor)
print bob.roles
#>> [<Role 1 name='admin'>, <Role 2 name='editor'>]
print tim.roles
#>> [<Role 2 name='editor'>]
print jay.roles
#>> []
print admin.users
#>> [<User 1 username='bob'>]
print editor.users
#>> [<User 1 username='bob'>, <User 2 username='tim'>]
## end snippet
## Snippet "userrole-use-alternate"
print User.byUsername('bob')
#>> <User 1 username='bob'>
print Role.byName('admin')
#>> <Role 1 name='admin'>
## End snippet
|
|
From: <ian...@us...> - 2003-06-26 08:34:40
|
Update of /cvsroot/sqlobject/SQLObject/docs
In directory sc8-pr-cvs1:/tmp/cvs-serv4218/docs
Modified Files:
News.txt
Log Message:
updated
Index: News.txt
===================================================================
RCS file: /cvsroot/sqlobject/SQLObject/docs/News.txt,v
retrieving revision 1.7
retrieving revision 1.8
diff -C2 -d -r1.7 -r1.8
*** News.txt 30 May 2003 02:20:22 -0000 1.7
--- News.txt 26 Jun 2003 08:34:38 -0000 1.8
***************
*** 72,75 ****
--- 72,81 ----
the exception in either case).
+ * Can order by descending order, with the `reversed` option to
+ the `select` method, or by prefixing the column with a ``"-"``.
+
+ * Ordering with joins works better -- you can order with multiple
+ columns, as well as descending ordering.
+
Col and Join
~~~~~~~~~~~~
***************
*** 130,133 ****
--- 136,142 ----
* ``ForeignKey`` columns return None if the associated column is
NULL in the database (used to just act weird).
+
+ * Instantiating an object with an id of None will give an error,
+ instead of just acting weird.
Internal
|
|
From: <ian...@us...> - 2003-06-26 08:33:59
|
Update of /cvsroot/sqlobject/SQLObject/SQLObject
In directory sc8-pr-cvs1:/tmp/cvs-serv4120/SQLObject
Modified Files:
DBConnection.py Join.py SQLBuilder.py SQLObject.py
Log Message:
* Made descending ordering work
* Made ordering with joins more robust
Index: DBConnection.py
===================================================================
RCS file: /cvsroot/sqlobject/SQLObject/SQLObject/DBConnection.py,v
retrieving revision 1.34
retrieving revision 1.35
diff -C2 -d -r1.34 -r1.35
*** DBConnection.py 24 May 2003 21:17:17 -0000 1.34
--- DBConnection.py 26 Jun 2003 08:33:56 -0000 1.35
***************
*** 174,194 ****
ops = select.ops
! def clauseList(lst):
if type(lst) not in (type([]), type(())):
lst = [lst]
! return [clauseQuote(i) for i in lst]
def clauseQuote(s):
if type(s) is type(""):
assert SQLBuilder.sqlIdentifier(s), "Strings in clauses are expected to be column identifiers. I got: %r" % s
if select.sourceClass._SO_columnDict.has_key(s):
s = select.sourceClass._SO_columnDict[s].dbName
! return s
else:
! return SQLBuilder.sqlRepr(s)
if order and ops.get('groupBy'):
! q = "%s GROUP BY %s" % (q, ", ".join(clauseList(ops['groupBy'])))
if order and ops.get('dbOrderBy'):
! q = "%s ORDER BY %s" % (q, ", ".join(clauseList(ops['dbOrderBy'])))
start = ops.get('start', 0)
--- 174,206 ----
ops = select.ops
! def clauseList(lst, desc=False):
if type(lst) not in (type([]), type(())):
lst = [lst]
! lst = [clauseQuote(i) for i in lst]
! if desc:
! lst = [SQLBuilder.DESC(i) for i in lst]
! return ', '.join([SQLBuilder.sqlRepr(i) for i in lst])
!
def clauseQuote(s):
if type(s) is type(""):
+ if s.startswith('-'):
+ desc = True
+ s = s[1:]
+ else:
+ desc = False
assert SQLBuilder.sqlIdentifier(s), "Strings in clauses are expected to be column identifiers. I got: %r" % s
if select.sourceClass._SO_columnDict.has_key(s):
s = select.sourceClass._SO_columnDict[s].dbName
! if desc:
! return SQLBuilder.DESC(SQLBuilder.SQLConstant(s))
! else:
! return SQLBuilder.SQLConstant(s)
else:
! return s
if order and ops.get('groupBy'):
! q = "%s GROUP BY %s" % (q, clauseList(ops['groupBy']))
if order and ops.get('dbOrderBy'):
! q = "%s ORDER BY %s" % (q, clauseList(ops['dbOrderBy'], ops.get('reversed', False)))
start = ops.get('start', 0)
Index: Join.py
===================================================================
RCS file: /cvsroot/sqlobject/SQLObject/SQLObject/Join.py,v
retrieving revision 1.3
retrieving revision 1.4
diff -C2 -d -r1.3 -r1.4
*** Join.py 4 Jun 2003 05:19:05 -0000 1.3
--- Join.py 26 Jun 2003 08:33:56 -0000 1.4
***************
*** 1,3 ****
! from SQLBuilder import NoDefault
import Style
import SQLObject
--- 1,4 ----
! import SQLBuilder
! NoDefault = SQLBuilder.NoDefault
import Style
import SQLObject
***************
*** 52,59 ****
if self.orderBy is not None:
def sorter(a, b, attr=self.orderBy):
return cmp(getattr(a, attr),
getattr(b, attr))
! results.sort(sorter)
return results
# This is a one-to-many
--- 53,85 ----
if self.orderBy is not None:
def sorter(a, b, attr=self.orderBy):
+ if attr.startswith('-'):
+ return -sorter(a, b, attr=attr[1:])
return cmp(getattr(a, attr),
getattr(b, attr))
! results.sort(self._sorter(self.orderBy))
return results
+
+ def _sorter(self, orderBy):
+ if isinstance(orderBy, tuple) or isinstance(orderBy, list):
+ if len(orderBy) == 1:
+ orderBy = orderBy[0]
+ else:
+ fhead = self._sorter(orderBy[0])
+ frest = self._sorter(orderBy[1:])
+ return lambda a, b, fhead=fhead, frest=frest: fhead(a, b) or frest(a, b)
+ if isinstance(orderBy, SQLBuilder.DESC) \
+ and isinstance(orderBy.expr, SQLBuilder.SQLObjectField):
+ orderBy = '-' + orderBy.expr.original
+ elif isinstance(orderBy, SQLBuilder.SQLObjectField):
+ orderBy = orderBy.original
+ # @@: but we don't handle more complex expressions for orderings
+ if orderBy.startswith('-'):
+ orderBy = orderBy[1:]
+ def sorter(a, b, attr=orderBy):
+ return cmp(getattr(b, attr), getattr(a, attr))
+ else:
+ def sorter(a, b, attr=orderBy):
+ return cmp(getattr(a, attr), getattr(b, attr))
+ return sorter
# This is a one-to-many
Index: SQLBuilder.py
===================================================================
RCS file: /cvsroot/sqlobject/SQLObject/SQLObject/SQLBuilder.py,v
retrieving revision 1.5
retrieving revision 1.6
diff -C2 -d -r1.5 -r1.6
*** SQLBuilder.py 5 May 2003 17:35:19 -0000 1.5
--- SQLBuilder.py 26 Jun 2003 08:33:56 -0000 1.6
***************
*** 358,365 ****
def __getattr__(self, attr):
if attr == 'id':
! return Table.__getattr__(self, self.soClass._idName)
else:
! return Table.__getattr__(
! self, self.soClass._SO_columnDict[attr].dbName)
class Field(SQLExpression):
--- 358,366 ----
def __getattr__(self, attr):
if attr == 'id':
! return SQLObjectField(self.tableName, self.soClass._idName, attr)
else:
! return SQLObjectField(self.tableName,
! self.soClass._SO_columnDict[attr].dbName,
! attr)
class Field(SQLExpression):
***************
*** 374,377 ****
--- 375,383 ----
return executor.field(self.tableName, self.fieldName)
+ class SQLObjectField(Field):
+ def __init__(self, tableName, fieldName, original):
+ self.original = original
+ Field.__init__(self, tableName, fieldName)
+
class ConstantSpace:
def __getattr__(self, attr):
***************
*** 517,520 ****
--- 523,536 ----
## SQL Builtins
########################################
+
+ class DESC(SQLExpression):
+
+ def __init__(self, expr):
+ self.expr = expr
+
+ def sqlRepr(self):
+ if isinstance(self.expr, DESC):
+ return sqlRepr(self.expr.expr)
+ return '%s DESC' % sqlRepr(self.expr)
def AND(*ops):
Index: SQLObject.py
===================================================================
RCS file: /cvsroot/sqlobject/SQLObject/SQLObject/SQLObject.py,v
retrieving revision 1.45
retrieving revision 1.46
diff -C2 -d -r1.45 -r1.46
*** SQLObject.py 4 Jun 2003 05:20:05 -0000 1.45
--- SQLObject.py 26 Jun 2003 08:33:56 -0000 1.46
***************
*** 846,853 ****
def select(cls, clause=None, clauseTables=None,
orderBy=NoDefault, groupBy=None, limit=None,
! lazyColumns=False):
return SelectResults(cls, clause, clauseTables=clauseTables,
orderBy=orderBy, groupBy=groupBy,
! limit=limit, lazyColumns=lazyColumns)
select = classmethod(select)
--- 846,854 ----
def select(cls, clause=None, clauseTables=None,
orderBy=NoDefault, groupBy=None, limit=None,
! lazyColumns=False, reversed=False):
return SelectResults(cls, clause, clauseTables=clauseTables,
orderBy=orderBy, groupBy=groupBy,
! limit=limit, lazyColumns=lazyColumns,
! reversed=reversed)
select = classmethod(select)
***************
*** 979,984 ****
orderBy = self.ops['orderBy']
if orderBy is not None:
if sourceClass._SO_columnDict.has_key(orderBy):
! self.ops['dbOrderBy'] = sourceClass._SO_columnDict[orderBy].dbName
def clone(self, **newOps):
--- 980,994 ----
orderBy = self.ops['orderBy']
if orderBy is not None:
+ if isinstance(orderBy, str) and orderBy.startswith('-'):
+ orderBy = orderBy[1:]
+ desc = True
+ else:
+ desc = False
if sourceClass._SO_columnDict.has_key(orderBy):
! self.ops['dbOrderBy'] = sourceClass._SO_columnDict[orderBy].dbName
! else:
! self.ops['dbOrderBy'] = orderBy
! if desc:
! self.ops['dbOrderBy'] = '-' + self.ops['dbOrderBy']
def clone(self, **newOps):
***************
*** 1002,1005 ****
--- 1012,1018 ----
def lazyColumns(self, value):
return self.clone(lazyColumns=value)
+
+ def reversed(self):
+ self.clone(reversed=not self.ops.get('reversed', False))
def __getitem__(self, value):
|
|
From: <ian...@us...> - 2003-06-26 08:33:59
|
Update of /cvsroot/sqlobject/SQLObject/tests
In directory sc8-pr-cvs1:/tmp/cvs-serv4120/tests
Modified Files:
test.py
Log Message:
* Made descending ordering work
* Made ordering with joins more robust
Index: test.py
===================================================================
RCS file: /cvsroot/sqlobject/SQLObject/tests/test.py,v
retrieving revision 1.16
retrieving revision 1.17
diff -C2 -d -r1.16 -r1.17
*** test.py 31 May 2003 01:59:45 -0000 1.16
--- test.py 26 Jun 2003 08:33:56 -0000 1.17
***************
*** 89,93 ****
self.assertEqual(tc3.other2, tc4d)
self.assertEqual(tc3.other2ID, tc4d.id)
!
--- 89,96 ----
self.assertEqual(tc3.other2, tc4d)
self.assertEqual(tc3.other2ID, tc4d.id)
! tcc = TestSO3.new(name='b', other=tc4a)
! self.assertEqual(tcc.other, tc4a)
! tcc2 = TestSO3.new(name='c', other=tc4a.id)
! self.assertEqual(tcc2.other, tc4a)
***************
*** 176,179 ****
--- 179,188 ----
range(0, 90))
+ def test5(self):
+ self.counterEqual(Counter.select('all', orderBy='number', reversed=True), range(99, -1, -1))
+
+ def test6(self):
+ self.counterEqual(Counter.select('all', orderBy='-number'), range(99, -1, -1))
+
########################################
***************
*** 257,261 ****
Phone.delColumn(col, changeSchema=True)
Person.delJoin(join)
-
########################################
--- 266,269 ----
***************
*** 368,373 ****
_columns = [StringCol('zip', length=5),
ForeignKey('PersonJoiner2')]
! # KeyCol('personJoiner2ID', foreignKey='PersonJoiner2')]
class JoinTest2(SQLObjectTest):
--- 376,382 ----
_columns = [StringCol('zip', length=5),
+ StringCol('plus4', length=4, default=None),
ForeignKey('PersonJoiner2')]
! _defaultOrder = ['-zip', 'plus4']
class JoinTest2(SQLObjectTest):
***************
*** 396,400 ****
z = AddressJoiner2(id)
self.assertEqual(z.zip, 'xxxxx')
!
--- 405,413 ----
z = AddressJoiner2(id)
self.assertEqual(z.zip, 'xxxxx')
!
! def testDefaultOrder(self):
! p1 = PersonJoiner2.byName('bob')
! self.assertEqual([i.zip for i in p1.addressJoiner2s],
! ['33333', '22222', '11111'])
|
|
From: <ian...@us...> - 2003-06-04 05:20:08
|
Update of /cvsroot/sqlobject/SQLObject/SQLObject
In directory sc8-pr-cvs1:/tmp/cvs-serv11660/SQLObject
Modified Files:
SQLObject.py
Log Message:
Made SomeSQLObject(None) bomb instead of just acting weird.
Index: SQLObject.py
===================================================================
RCS file: /cvsroot/sqlobject/SQLObject/SQLObject/SQLObject.py,v
retrieving revision 1.44
retrieving revision 1.45
diff -C2 -d -r1.44 -r1.45
*** SQLObject.py 31 May 2003 02:00:39 -0000 1.44
--- SQLObject.py 4 Jun 2003 05:20:05 -0000 1.45
***************
*** 323,326 ****
--- 323,329 ----
+ class CreateNewSQLObject:
+ pass
+
# SQLObject is the superclass for all SQLObject classes, of
# course. All the deeper magic is done in MetaSQLObject, and
***************
*** 370,377 ****
def __new__(cls, id, connection=None, selectResults=None):
# When id is None, that means we are trying
# to create a new object. This is done by the
# `new()` method.
! if id is None:
# Create an actual new object:
inst = object.__new__(cls)
--- 373,382 ----
def __new__(cls, id, connection=None, selectResults=None):
+ assert id is not None, 'None is not a possible id for %s' % cls.__name
+
# When id is None, that means we are trying
# to create a new object. This is done by the
# `new()` method.
! if id is CreateNewSQLObject:
# Create an actual new object:
inst = object.__new__(cls)
***************
*** 743,750 ****
# a new object.
if kw.has_key('connection'):
! inst = cls(None, connection=kw['connection'])
del kw['connection']
else:
! inst = cls(None)
# First we do a little fix-up on the keywords we were
--- 748,755 ----
# a new object.
if kw.has_key('connection'):
! inst = cls(CreateNewSQLObject, connection=kw['connection'])
del kw['connection']
else:
! inst = cls(CreateNewSQLObject)
# First we do a little fix-up on the keywords we were
|