That looks great. I think I'll probably make a concerted effort at
digging through the dispatchers to find the actual code which creates
the environmemt within TG.

Cheers

-Rob

Patrik Blommaskog wrote:
> Here's an excerpt from how I did it with TG 0.8 for processing incoming
> mail from qmail into the database of the TG application (eggtail). It
> still seems to work after upgrading to TG0.9a1, but please note that it
> uses the old style of configuration files. I haven't looked into how to
> migrate this to the current style.
> 
> import cherrypy
> from turbogears.database import PackageHub
> from eggtail.model import Entity, User
> 
> cherrypy.config.update(file="prod.cfg")
> dburi = cherrypy.config.get("sqlobject.dburi", None)
> if not dburi:
>     raise TemporaryFailure("The database uri was not found.")
> 
> hub = PackageHub("eggtail")
> __connection__ = hub
> 
> # By now we have the model available.
> 
> to = getUserNameFromTheMailSomehow()
> 
> try:
>     user = User.byName(to)
> except sqlobject.SQLObjectNotFound:
>     raise PermanentFailure('The recipient "%s" does not exist in the
> database.' % repr(to))
> 
> 
> 

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"TurboGears" 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/turbogears
-~----------~----~----~----~------~----~------~--~---

Reply via email to