There are a few people who have been pushing most of their logic into
PostgreSQL stored procedures and triggers, and using its roles to
enforce permissions.  Aruynn Shaw has done the most work on this that
I've seen, but last I looked it hadn't gotten onto PyPI and was hard
to find.  This looks like the best link:
https://projects.commandprompt.com/public/

- Exceptable: convert PostgreSQL exceptions to Python exceptions.
- Simpycity: a Python db layer for calling PostgreSQL stored
procedures. (Not compatible with SQLAlchemy.)
- VerticallyChallenged: authorization via database roles, with
Repoze.who for authentication.  (This one doesn't seem to be online
yet.)

The links are, in order:
https://projects.commandprompt.com/public/exceptable/
https://projects.commandprompt.com/public/simpycity/
https://projects.commandprompt.com/public/verticallychallenged/

VC I haven't updated the wiki/written docs for yet.. but it's coming. :)
The repo can be viewed
https://projects.commandprompt.com/public/verticallychallenged/repo/



If you want to use these and reach a dead end, let me know and I can
put you in touch with Aurynn. Maybe that will help prod her to make
PyPI releases. :)

I *am* trying on this, I ran into a bug with my setup.py not pulling in the required SQL files. :(


The problem with that is that the DB engine throws a generic Constraint
Violation from which I have to "extract" constraint name, and produce a
meaningful message to the user, like "Name already exists, please try
another". Therefore I catch generic SQL exceptions in the model save()
method, and re-throw custom exceptions made for the model like, for
example, NameDuplicateError, or EmailDuplicateError, etc... so the
controller can catch these and send back proper message, or alter the
form to highlight fields in question.

That's what Exceptable is for. I think it could be made more pythonic,
but I haven't had a need for it myself so I haven't had an incentive
to.


Yes, this is exactly the problem that Exceptable is designed to solve.
If you can give me an exact example of the constraint error, I can add a check into Exceptable proper.

Thanks,
--
Aurynn Shaw

The PostgreSQL Company - Command Prompt, Inc. 1.503.667.4564 ext 103
PostgreSQL Replication, Consulting, Custom Development, 24x7 support
We are all in the gutter, but some of us are looking at the stars.
  -- Oscar Wilde

[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