First, apologies for the mistakes in the tutorial.  I'm going to
convert my own application today, so that will be a practical test.
But I did say to check back in 24 hours in case there are corrections.
 Let's make that 48 hours from now, to take care of any remaining
beasties.

On 8/16/07, Christoph Haas <[EMAIL PROTECTED]> wrote:
> Oh, well, the whole project seems to be a increasingly moving target.
> First pylons.database is deprecated and replaced by SAContext. Then
> SAContext is deprected. Takes some getting used to.

Whatever's happening to the rest of the project, Pylons' relationship
to SQLAlchemy has evolved.  pylons.database built it in.  SAContext
attempted to correct some deficiencies in it.  It succeeded in some
ways but failed in others, which is why it's been retired.  Throughout
SAContext's life there has been a debate whether to include it in
Pylons. Ben wanted to get all database APIs out of Pylons core: (1) to
make it database-neutral, (2) to avoid making another bad API
decision, and (3) to avoid tying it to Pylons' release cycle which may
be too slow.  That meant SAContext needed a home.  We're considering a
"Pylons extras" package for things like this,which can be updated
quickly regardless of Pylons' release cycle, but so far this package
does not exist.

Then SQLAlchemy 0.4 made some standardizations and simplifications and
improved the manual, which lessened the need for SAContext.
Simultaneously I wasn't sure how to adapt SAContext to 0.4: bound
metadatas?  one global metadata?  scoped_session or custom code?
Inline BoundSessionStrategy and remove the other strategies?  Subclass
for multiple engines? Turn PylonsSAContext into a config-parsing
function?

When MikeB and Ben came up with drafts of this tutorial,and SQLAlchemy
added the engine_from_config function I'd long been lobbying for, it
was clear that this would be cleaner than shoehorning SQLAlchemy 0.4
into SAContext's arbitrary structure.  So i wanted to stop supporting
a dead-end class, provide a viable configuration that people
(including me) can use now, and get the wiki articles consistent with
each other.  Thus the "quickness" of getting the tutorial up, which
led to some errors creeping in.

The eventual plan is to include this in an application template so you
can do something like "paster create -t pylons,sqlalchemy,genshi Foo"
and get it all preconfigured.  But that will take time to verify the
right template and get it incorporated.  In the meantime people need a
viable database configuration NOW, so this is what we've got.
Improvements to the pattern will improve the eventual application
template.

> One typo seems to be the
> "sqlalchemy.default.uri" and "sqlalchemy.uri" in the development.ini
> that leads to key errors not finding the "url" key. Changing it to
> "sqlalchemy.url" works better. That one was easy to find and I added a
> comment to that page.

I checked with MikeB and he wants to stick with 'url', so I changed
the tutorial.  This means those upgrading from SAContext or
pylons.database will have to change their config key from 'uri' to
'url'.

> ---> 18     return "Pylons|%s|%s" % (thread.id, id(config))
>
> AttributeError: 'module' object has no attribute 'id'
>
> I'm not threading expert so I don't know where to look. In "ipython" the
> thread module doesn't have an id.

It should have been thread.get_ident().  I misremembered the syntax.

MikeB and Ben removed the app_scope function entirely from the
article, saying it's only needed in a rare circumstance.  I re-added
it in a section at the bottom for those who need it.  You only need it
if you have multiple instances of the SAME Pylons application running
in the same WSGi process; e.g, with Paste HTTPServer 's "composite".
It prevents those instances from sharing session objects.

"paster shell" use needs to be tested, along with standalone
applications using the model.  I believe standalone apps can just
borrow the config code in websetup.py.

-- 
Mike Orr <[EMAIL PROTECTED]>

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"pylons-discuss" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/pylons-discuss?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to