[Checkins] SVN: megrok.rdb/trunk/ Preparing for release.
Martijn Faassen
faassen at startifact.com
Fri Aug 14 12:17:50 EDT 2009
Log message for revision 102777:
Preparing for release.
Changed:
A megrok.rdb/trunk/CHANGES.txt
U megrok.rdb/trunk/setup.py
U megrok.rdb/trunk/src/megrok/rdb/README.txt
U megrok.rdb/trunk/src/megrok/rdb/tests/test_rdb.py
-=-
Added: megrok.rdb/trunk/CHANGES.txt
===================================================================
--- megrok.rdb/trunk/CHANGES.txt (rev 0)
+++ megrok.rdb/trunk/CHANGES.txt 2009-08-14 16:17:50 UTC (rev 102777)
@@ -0,0 +1,7 @@
+CHANGES
+*******
+
+0.9 (unreleased)
+================
+
+- Initial public release.
Modified: megrok.rdb/trunk/setup.py
===================================================================
--- megrok.rdb/trunk/setup.py 2009-08-14 16:15:17 UTC (rev 102776)
+++ megrok.rdb/trunk/setup.py 2009-08-14 16:17:50 UTC (rev 102777)
@@ -1,23 +1,30 @@
from setuptools import setup, find_packages
import os
-version = '0.1'
+def read(*rnames):
+ return open(os.path.join(os.path.dirname(__file__), *rnames)).read()
-long_description = ''
+long_description = read('src/megrok/rdb/README.txt') + '\n' +\
+ read('CHANGES.txt')
setup(name='megrok.rdb',
- version=version,
+ version='0.9dev',
description="SQLAlchemy based RDB support for Grok.",
long_description=long_description,
- # Get more strings from http://www.python.org/pypi?%3Aaction=list_classifiers
- classifiers=[
- "Programming Language :: Python",
- "Topic :: Software Development :: Libraries :: Python Modules",
- ],
- keywords='',
+ classifiers=['Development Status :: 4 - Beta',
+ 'Environment :: Web Environment',
+ 'Framework :: Zope3',
+ 'Intended Audience :: Developers',
+ 'License :: OSI Approved :: Zope Public License',
+ 'Operating System :: OS Independent',
+ 'Programming Language :: Python',
+ 'Topic :: Internet :: WWW/HTTP',
+ 'Topic :: Software Development :: Libraries',
+ 'Topic :: Database',
+ ],
+ keywords='rdb relational sqlalchemy grok database',
author='Grok Team',
author_email='grok-dev at zope.org',
- url='',
license='ZPL',
packages=find_packages('src'),
package_dir = {'': 'src'},
Modified: megrok.rdb/trunk/src/megrok/rdb/README.txt
===================================================================
--- megrok.rdb/trunk/src/megrok/rdb/README.txt 2009-08-14 16:15:17 UTC (rev 102776)
+++ megrok.rdb/trunk/src/megrok/rdb/README.txt 2009-08-14 16:17:50 UTC (rev 102777)
@@ -2,6 +2,9 @@
megrok.rdb
==========
+Introduction
+------------
+
The ``megrok.rdb`` package adds powerful relational database support
to Grok, based on the powerful SQLAlchemy_ library. It makes available
a new ``megrok.rdb.Model`` and ``megrok.rdb.Container`` which behave
@@ -10,14 +13,11 @@
.. _SQLAlchemy: http://www.sqlalchemy.org
-XXX a hack to make things work in doctests. In some particular setup
-this hack wasn't needed anymore, but I am unable at this time to
-reestablish this combination of packages::
+In this document we will show you how to use ``megrok.rdb``.
- >>> __file__ = 'foo'
+Declarative models
+------------------
-In this document we will show you how to use ``megrok.rdb``.
-
``megrok.rdb`` uses SQLAlchemy's ORM system, in particular its
declarative extension, almost directly. ``megrok.rdb`` just supplies a
few special base classes and directives to make things easier, and a few
@@ -53,6 +53,12 @@
container will be defined as the (possibly automatically assigned)
primary key in the database.
+FIXME a hack to make things work in doctests. In some particular setup
+this hack wasn't needed anymore, but I am unable at this time to
+reestablish this combination of packages::
+
+ >>> __file__ = 'foo'
+
Now we can set up the ``Department`` class. This has the ``courses``
relation that links to its courses::
@@ -98,6 +104,9 @@
We see here that ``Course`` links back to the department it is in,
using a foreign key.
+Configuration
+-------------
+
We need to actually grok these objects to have them fully set
up. Normally grok takes care of this automatically, but in this case
we'll need to do it manually.
@@ -153,9 +162,6 @@
>>> component.provideUtility(scoped_session, provides=IScopedSession)
-Let's make sure that as soon as the engine is created, we create the
-appropriate metadata::
-
We now need to create the tables we defined in our database. We can do this
only when the engine is first created, so we set up a handler for it::
@@ -165,6 +171,9 @@
... rdb.setupDatabase(metadata)
>>> component.provideHandler(engine_created)
+Using the database
+------------------
+
Now all that is out the way, we can use the ``rdb.Session`` object to make
a connection to the database.
@@ -299,14 +308,14 @@
>>> qc = MyQueryContainer()
Let's try some common read-only container operations, such as
-``__getitem__``1::
+``__getitem__``::
>>> qc['1'].name
u'Philosophy'
>>> qc['2'].name
'Physics'
-XXX Why the unicode difference between u'Philosophy' and 'Physics'?
+FIXME Why the unicode difference between u'Philosophy' and 'Physics'?
``__getitem__`` with a ``KeyError``::
Modified: megrok.rdb/trunk/src/megrok/rdb/tests/test_rdb.py
===================================================================
--- megrok.rdb/trunk/src/megrok/rdb/tests/test_rdb.py 2009-08-14 16:15:17 UTC (rev 102776)
+++ megrok.rdb/trunk/src/megrok/rdb/tests/test_rdb.py 2009-08-14 16:17:50 UTC (rev 102777)
@@ -13,7 +13,7 @@
def moduleSetUp(test):
# using zope.testing.module.setUp to work around
# __module__ being '__builtin__' by default
- module.setUp(test, '__main__')
+ module.setUp(test, 'foo')
def moduleTearDown(test):
# make sure scope func is empty before we tear down component architecture
More information about the Checkins
mailing list