Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 21fdca6

Browse files
committed
Update docs for release 3.1.0
1 parent 8e728b5 commit 21fdca6

File tree

128 files changed

+9251
-8163
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

128 files changed

+9251
-8163
lines changed

‎Authors.html‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,7 @@ <h1 class="pudge-member-page-heading">Authors</h1>
6262
<li>Lukasz Dobrzanski &lt;lukasz.m.dobrzanski at gmail.com></li>
6363
<li>Gregor Horvath &lt;gh at gregor-horvath.com></li>
6464
<li>Nathan Edwards &lt;nje5 at georgetown.edu></li>
65+
<li>Lutz Steinborn &lt;l.steinborn at 4c-gmbh.de></li>
6566
<li>Oleg Broytman &lt;<a href="mailto:phd@phdru.name" class="reference external">phd@phdru.name</a>></li>
6667
</ul>
6768
<a href="https://sourceforge.net/projects/sqlobject" class="reference external image-reference"><img src="https://sourceforge.net/sflogo.php?group_id=74338&amp;type=10" alt="Get SQLObject at SourceForge.net. Fast, secure and Free Open Source software downloads" style="width: 80px; height: 15px;" class="noborder align-center"></a>

‎DeveloperGuide.html‎

Lines changed: 94 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -35,15 +35,16 @@ <h1 class="pudge-member-page-heading">SQLObject Developer Guide</h1>
3535
<p class="topic-title first">Contents</p>
3636
<ul class="simple">
3737
<li><a href="#development-installation" class="reference internal" id="id1">Development Installation</a></li>
38-
<li><a href="#style-guide" class="reference internal" id="id2">Style Guide</a></li>
39-
<li><a href="#testing" class="reference internal" id="id3">Testing</a></li>
40-
<li><a href="#documentation" class="reference internal" id="id4">Documentation</a></li>
38+
<li><a href="#architecture" class="reference internal" id="id2">Architecture</a><ul>
39+
<li><a href="#columns-validators-and-converters" class="reference internal" id="id3">Columns, validators and converters</a></li>
40+
</ul>
41+
</li>
42+
<li><a href="#style-guide" class="reference internal" id="id4">Style Guide</a></li>
43+
<li><a href="#testing" class="reference internal" id="id5">Testing</a></li>
44+
<li><a href="#documentation" class="reference internal" id="id6">Documentation</a></li>
4145
</ul>
4246
</div>
43-
<p id="start">These are some notes on developing SQLObject. I'll try to expand them
44-
as things come up.</p>
45-
<blockquote>
46-
-- Ian Bicking</blockquote>
47+
<p id="start">These are some notes on developing SQLObject.</p>
4748
<div class="section" id="development-installation">
4849
<h1>Development Installation</h1>
4950
<p>First install <a href="http://www.formencode.org/en/latest/download.html" class="reference external">FormEncode</a>:</p>
@@ -54,16 +55,75 @@ <h1>Development Installation</h1>
5455
</pre>
5556
<p>Then do the same for SQLObject:</p>
5657
<pre class="literal-block">
57-
$ git clone git clone git://git.code.sf.net/p/sqlobject/sqlobject
58+
$ git clone git clone git://github.com/sqlobject/sqlobject
5859
$ cd sqlobject
5960
$ sudo python setup.py develop
6061
</pre>
62+
<p>Or rather fork it and clone your fork. To develop a feature or a bugfix
63+
create a separate branch, push it to your fork and create a pull request
64+
to the original repo. That way CI will be triggered to test your code.</p>
6165
<p>Voila! The packages are globally installed, but the files from the
62-
checkout were not copied into <tt class="docutils literal"><span class="pre">site-packages</span></tt>. See <a href="http://pythonhosted.org/setuptools/" class="reference external">setuptools</a> for more.</p>
66+
checkout were not copied into <tt class="docutils literal"><span class="pre">site-packages</span></tt>. See <a href="https://setuptools.readthedocs.io/en/latest/index.html" class="reference external">setuptools</a> for more.</p>
67+
</div>
68+
<div class="section" id="architecture">
69+
<h1>Architecture</h1>
70+
<p>There are three main kinds of objects in SQLObject: tables, columns and
71+
connections.</p>
72+
<p>Tables-related objects are in <a href="sqlobject/main.py.html" class="reference external">sqlobject/main.py</a> module. There are two
73+
main classes: <tt class="docutils literal">SQLObject</tt> and <tt class="docutils literal">sqlmeta</tt>; the latter is not a
74+
metaclass but a parent class for <tt class="docutils literal">sqlmeta</tt> attribute in every class -
75+
the authors tried to move there all attributes and methods not directly
76+
related to columns to avoid cluttering table namespace.</p>
77+
<p>Connections are instances of <tt class="docutils literal">DBConnection</tt> class (from
78+
<a href="sqlobject/dbconnection.py.html" class="reference external">sqlobject/dbconnection.py</a>) and its concrete descendants.
79+
<tt class="docutils literal">DBConnection</tt> contains generic code for generating SQL, working with
80+
transactions and so on. Concrete connection classes (like
81+
<tt class="docutils literal">PostgresConnection</tt> and <tt class="docutils literal">SQLiteConnection</tt>) provide
82+
backend-specific functionality.</p>
83+
<div class="section" id="columns-validators-and-converters">
84+
<h2>Columns, validators and converters</h2>
85+
<p>Columns are instances of classes from <a href="sqlobject/col.py.html" class="reference external">sqlobject/col.py</a>. There are two
86+
classes for every column: one is for user to include into an instance of
87+
SQLObject, an instance of the other is automatically created by
88+
SQLObject's metaclass. The two classes are usually named <tt class="docutils literal">Col</tt> and
89+
<tt class="docutils literal">SOCol</tt>; for example, <tt class="docutils literal">BoolCol</tt> and <tt class="docutils literal">SOBoolCol</tt>. User-visible
90+
classes, descendants of <tt class="docutils literal">Col</tt>, seldom contain any code; the main code
91+
for a column is in <tt class="docutils literal">SOCol</tt> descendants and in validators.</p>
92+
<p>Every column has a list of validators. Validators validate input data
93+
and convert input data to python data and back. Every validator must
94+
have methods <tt class="docutils literal">from_python</tt> and <tt class="docutils literal">to_python</tt>. The former converts data
95+
from python to internal representation that will be converted by
96+
converters to SQL strings. The latter converts data from SQL data to
97+
python. Also please bear in mind that validators can receive <tt class="docutils literal">None</tt>
98+
(for SQL <tt class="docutils literal">NULL</tt>) and <tt class="docutils literal">SQLExpression</tt> (an object that represents
99+
SQLObject expressions); both objects must be passed unchanged by
100+
validators.</p>
101+
<p>Converters from <a href="sqlobject/converters.py.html" class="reference external">sqlobject/converters.py</a> aren't visible to users. They
102+
are used behind the scene to convert objects returned by validators to
103+
backend-specific SQL strings. The most elaborated converter is
104+
<tt class="docutils literal">StringLikeConverter</tt>. Yes, it converts strings to strings. It
105+
converts python strings to SQL strings using backend-specific quoting
106+
rules.</p>
107+
<p>Let look into <tt class="docutils literal">BoolCol</tt> as an example. The very <tt class="docutils literal">BoolCol</tt> doesn't
108+
have any code. <tt class="docutils literal">SOBoolCol</tt> has a method to create <tt class="docutils literal">BoolValidator</tt>
109+
and methods to create backend-specific column type. <tt class="docutils literal">BoolValidator</tt>
110+
has identical methods <tt class="docutils literal">from_python</tt> and <tt class="docutils literal">to_python</tt>; the method
111+
passes <tt class="docutils literal">None</tt>, <tt class="docutils literal">SQLExpression</tt> and bool values unchanged; int and
112+
objects that have method <tt class="docutils literal">__nonzero__</tt> are converted to bool; other
113+
objects trigger validation error. Bool values that are returned by call
114+
to <tt class="docutils literal">from_python</tt> will be converted to SQL strings by
115+
<tt class="docutils literal">BoolConverter</tt>; bool values from <tt class="docutils literal">to_python</tt> (is is supposed they
116+
are originated from the backend via DB API driver) are passed to the
117+
application.</p>
118+
<p>Objects that are returned from <tt class="docutils literal">from_python</tt> must be registered with
119+
converters. Another approach for <tt class="docutils literal">from_python</tt> is to return an object
120+
that has <tt class="docutils literal">__sqlrepr__</tt> method. Such objects convert to SQL strings
121+
themselves, converters are not used.</p>
122+
</div>
63123
</div>
64124
<div class="section" id="style-guide">
65125
<h1>Style Guide</h1>
66-
<p>Generally you should follow the recommendations in <a href="http://www.python.org/peps/pep-0008.html" class="reference external">PEP 8</a>, the
126+
<p>Generally you should follow the recommendations in <a href="http://www.python.org/dev/peps/pep-0008/" class="reference external">PEP 8</a>, the
67127
Python Style Guide. Some things to take particular note of:</p>
68128
<ul class="simple">
69129
<li>With a few exceptions sources must be <a href="https://gitlab.com/pycqa/flake8" class="reference external">flake8</a>-clean (and hence
@@ -73,7 +133,7 @@ <h1>Style Guide</h1>
73133
<ul>
74134
<li><p class="first"><strong>No tabs</strong>. Not anywhere. Always indent with 4 spaces.</p>
75135
</li>
76-
<li><p class="first">I don't stress too much on line length. But try to break lines up
136+
<li><p class="first">We don't stress too much on line length. But try to break lines up
77137
by grouping with parenthesis instead of with backslashes (if you
78138
can). Do asserts like:</p>
79139
<pre class="literal-block">
@@ -94,7 +154,7 @@ <h1>Style Guide</h1>
94154
sqlobject import *</tt> so names should be fairly distinct, or they
95155
shouldn't be exported in <tt class="docutils literal">sqlobject.__init__</tt>.</p>
96156
</li>
97-
<li><p class="first">I'm very picky about whitespace. There's one and only one right way
157+
<li><p class="first">We're very picky about whitespace. There's one and only one right way
98158
to do it. Good examples:</p>
99159
<pre class="literal-block">
100160
short = 3
@@ -118,9 +178,9 @@ <h1>Style Guide</h1>
118178
func( a, b )
119179
[ 1, 2, 3 ]
120180
</pre>
121-
<p>To me, the poor use of whitespace seems lazy. I'll think less of
122-
your code (justified or not) for this very trivial reason. I will
123-
fix all your code for you if you don't do it yourself, because I
181+
<p>To us, the poor use of whitespace seems lazy. We'll think less of
182+
your code (justified or not) for this very trivial reason. We will
183+
fix all your code for you if you don't do it yourself, because we
124184
can't bear to look at sloppy whitespace.</p>
125185
</li>
126186
<li><p class="first">Use <tt class="docutils literal">@@</tt> to mark something that is suboptimal, or where you have a
@@ -174,9 +234,9 @@ <h1>Style Guide</h1>
174234
<h1>Testing</h1>
175235
<p>Tests are important. Tests keep everything from falling apart. All
176236
new additions should have tests.</p>
177-
<p>Testing uses py.test, an alternative to <tt class="docutils literal">unittest</tt>. It is available at
178-
<a href="http://pytest.org/" class="reference external">http://pytest.org/</a> and <a href="http://pypi.python.org/pypi/pytest" class="reference external">http://pypi.python.org/pypi/pytest</a>. Read its<ahref="http://pytest.org/latest/getting-started.html" class="reference external">getting
179-
started</a> document for more.</p>
237+
<p>Testing uses py.test, an alternative to <tt class="docutils literal">unittest</tt>. It is available
238+
at <a href="http://pytest.org/" class="reference external">http://pytest.org/</a> and <a href="https://pypi.python.org/pypi/pytest" class="reference external">https://pypi.python.org/pypi/pytest</a>. Read its
239+
<ahref="http://docs.pytest.org/en/latest/getting-started.html" class="reference external">getting started</a> document for more.</p>
180240
<p>To actually run the test, you have to give it a database to connect to.
181241
You do so with the option <tt class="docutils literal"><span class="pre">-D</span></tt>. You can either give a complete URI or
182242
one of several shortcuts like <tt class="docutils literal">mysql</tt> (these shortcuts are defined in
@@ -192,22 +252,32 @@ <h1>Testing</h1>
192252
<p><tt class="docutils literal">supports(featureName)</tt> checks if the database backend supports the
193253
named feature. What backends support what is defined at the top of
194254
<tt class="docutils literal">dbtest</tt>.</p>
195-
<p>If you <tt class="docutils literal">import *</tt> you'll also get py.test's version of <a href="http://pytest.org/latest/assert.html#assertions-about-expected-exceptions" class="reference external">raises</a>, an
255+
<p>If you <tt class="docutils literal">import *</tt> you'll also get py.test's version of <a href="http://docs.pytest.org/en/latest/assert.html#assertions-about-expected-exceptions" class="reference external">raises</a>, an
196256
<tt class="docutils literal">inserts</tt> function that can create instances for you, and a couple
197257
miscellaneous functions.</p>
198-
<p>If you submit a patch or implement a feature without a test, I'll be
199-
forced to write the test. That's no fun for me, to just be writing
258+
<p>If you submit a patch or implement a feature without a test, we'll be
259+
forced to write the test. That's no fun for us, to just be writing
200260
tests. So please, write tests; everything at least needs to be
201261
exercised, even if the tests are absolutely complete.</p>
202-
<p>We now use Travis CI to run tests. See the status:</p>
262+
<p>We now use Travis CI and Circle CI to run tests. See the statuses:</p>
203263
<a href="https://travis-ci.org/sqlobject/sqlobject" class="reference external image-reference"><img src="https://travis-ci.org/sqlobject/sqlobject.svg?branch=master" alt="https://travis-ci.org/sqlobject/sqlobject.svg?branch=master"></a>
264+
<a href="https://circleci.com/gh/sqlobject/sqlobject" class="reference external image-reference"><img src="https://circleci.com/gh/sqlobject/sqlobject.svg?style=shield" alt="https://circleci.com/gh/sqlobject/sqlobject.svg?style=shield"></a>
265+
<p>To avoid triggering unnecessary test run at CI services add text <a href="https://docs.travis-ci.com/user/customizing-the-build/#skipping-a-build" class="reference external">[skip ci]</a> or
266+
<a href="https://circleci.com/docs/skip-a-build/" class="reference external">[ci skip]</a> anywhere in your commit
267+
messages for commits that don't change code (documentation updates and such).</p>
268+
<p>We use <a href="https://pypi.python.org/pypi/coverage" class="reference external">coverage.py</a>
269+
to measures code coverage by tests and upload the result for analyzis to
270+
<a href="https://coveralls.io/github/sqlobject/sqlobject" class="reference external">Coveralls</a> and
271+
<a href="https://codecov.io/gh/sqlobject/sqlobject" class="reference external">Codecov</a>:</p>
272+
<a href="https://coveralls.io/github/sqlobject/sqlobject?branch=master" class="reference external image-reference"><img src="https://coveralls.io/repos/github/sqlobject/sqlobject/badge.svg?branch=master" alt="https://coveralls.io/repos/github/sqlobject/sqlobject/badge.svg?branch=master"></a>
273+
<a href="https://codecov.io/gh/sqlobject/sqlobject" class="reference external image-reference"><object type="image/svg+xml" data="https://codecov.io/gh/sqlobject/sqlobject/branch/master/graph/badge.svg">https://codecov.io/gh/sqlobject/sqlobject/branch/master/graph/badge.svg</object></a>
204274
</div>
205275
<div class="section" id="documentation">
206276
<h1>Documentation</h1>
207277
<p>Please write documentation. Documentation should live in the docs/
208278
directory. Pudge converts documentation from Restructured Text to
209-
HTML. It presently requires kid 0.9.3, which must be obtained
210-
separately (for instance, from <a href="http://pypi.python.org/pypi/kid/0.9.3" class="reference external">http://pypi.python.org/pypi/kid/0.9.3</a>)</p>
279+
HTML. It presently requires kid 0.9.6, which must be obtained
280+
separately (for instance, from <a href="https://pypi.python.org/pypi/kid/0.9.6" class="reference external">https://pypi.python.org/pypi/kid/0.9.6</a>).</p>
211281
<a href="https://sourceforge.net/projects/sqlobject" class="reference external image-reference"><img src="https://sourceforge.net/sflogo.php?group_id=74338&amp;type=10" alt="Get SQLObject at SourceForge.net. Fast, secure and Free Open Source software downloads" style="width: 80px; height: 15px;" class="noborder align-center"></a>
212282
</div>
213283
</div></div>

‎Inheritance.html‎

Lines changed: 19 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -39,10 +39,21 @@ <h1 class="pudge-member-page-heading"></h1>
3939
<td>Daniel Savard, XSOLI Inc.</td></tr>
4040
</tbody>
4141
</table>
42-
<div class="section" id="inheritance">
43-
<h1>Inheritance</h1>
42+
<div class="contents topic" id="contents">
43+
<p class="topic-title first">Contents</p>
44+
<ul class="simple">
45+
<li><a href="#inheritance" class="reference internal" id="id1">Inheritance</a><ul>
46+
<li><a href="#why" class="reference internal" id="id2">Why</a></li>
47+
<li><a href="#who-what-and-how" class="reference internal" id="id3">Who, What and How</a></li>
48+
<li><a href="#limitations-and-notes" class="reference internal" id="id4">Limitations and notes</a></li>
49+
</ul>
50+
</li>
51+
</ul>
52+
</div>
53+
<div class="section" id="inheritance">
54+
<h1><a href="#id1" class="toc-backref">Inheritance</a></h1>
4455
<div class="section" id="why">
45-
<h2>Why</h2>
56+
<h2><ahref="#id2" class="toc-backref">Why</a></h2>
4657
<p>Imagine you have a list of persons, and every person plays a certain role.
4758
Some persons are students, some are professors, some are employees. Every
4859
role has different attributes. Students are known by their department and
@@ -197,10 +208,10 @@ <h2>Why</h2>
197208
</pre>
198209
</div>
199210
<div class="section" id="who-what-and-how">
200-
<h2>Who, What and How</h2>
201-
<p>Daniel Savard has implemented inheritance for SQLObject. According to
202-
<ahref="http://www.objectmatter.com/vbsf/docs/maptool/ormapping.html" class="reference external">ObjectMatter</a> this is a kind of vertical inheritance. The only difference
203-
is that objects reference their leaves, not parents. Links to parents are
211+
<h2><ahref="#id3" class="toc-backref">Who, What and How</a></h2>
212+
<p>Daniel Savard has implemented inheritance for SQLObject. In <ahref="https://cayenne.apache.org/docs/3.0/modeling-inheritance.html" class="reference external">terms of
213+
ORM</a> this is a kind of vertical inheritance. The only difference is
214+
that objects reference their leaves, not parents. Links to parents are
204215
reconstructed at run-time using the hierarchy of Python classes.</p>
205216
<ul class="simple">
206217
<li>As suggested by Ian Bicking, each child class now has the same
@@ -303,7 +314,7 @@ <h2>Who, What and How</h2>
303314
</pre>
304315
</div>
305316
<div class="section" id="limitations-and-notes">
306-
<h2>Limitations and notes</h2>
317+
<h2><ahref="#id4" class="toc-backref">Limitations and notes</a></h2>
307318
<ul class="simple">
308319
<li>Only single inheritance will work. It is not possible to inherit
309320
from multiple SQLObject classes.</li>

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /