Re: [turbogears-commits] r5496 - branches/1.1/turbogears

0 просмотров
Перейти к первому непрочитанному сообщению

Christopher Arndt

не прочитано,
28 сент. 2008 г., 00:27:2528.09.2008
– turbogea...@googlegroups.com
Hi all,

I just commited this fix to the 1.1. branch because TurboGears will hang
(and could only be killed with a KILL signal), when an exception occurs
in 'startup.startTurboGears'. This could happen when you tried to open
the toolbox in a project with identity, but no ORM is installed.

But I'm not totally happy with the fix, because it essentially silently
ignores errors when loading TurboGears extensions (though it logs them).

If you look at my other commits before this one, you can see that I
tried prevent users from starting a project which needs a ORM when none
is installed, but still...

Anybody has any better ideas or comments?


Chris

svn-c...@turbogears.org schrieb:
> Author: carndt
> Date: Sat Sep 27 23:17:57 2008
> New Revision: 5496
> URL: http://trac.turbogears.org/changeset/5496
>
> Log:
> Ignore errors when loading TurboGears extensions on startup or when starting them (CherryPy hangs when an exception occurs during startup)
>
> Modified:
> branches/1.1/turbogears/startup.py
>
> Modified: branches/1.1/turbogears/startup.py
> ==============================================================================
> --- branches/1.1/turbogears/startup.py (original)
> +++ branches/1.1/turbogears/startup.py Sat Sep 27 23:17:57 2008
> @@ -228,9 +228,18 @@
> # Start all TurboGears extensions
> extensions = pkg_resources.iter_entry_points("turbogears.extensions")
> for entrypoint in extensions:
> - ext = entrypoint.load()
> + try:
> + ext = entrypoint.load()
> + except Exception, e:
> + log.error("Error loading TurboGears extension plugin '%s': %s",
> + entrypoint, e)
> + continue
> if hasattr(ext, "start_extension"):
> - ext.start_extension()
> + try:
> + ext.start_extension()
> + except Exception, e:
> + log.error("Error starting TurboGears extension '%s': %s",
> + entrypoint, e)
>
> for item in call_on_startup:
> item()
>

Ответить всем
Отправить сообщение автору
Переслать
0 новых сообщений