[gnue] r10273 - in trunk/gnue-common: . src/base
[email protected] Thu, 16 Dec 2010 15:22:17 -0600 (CST)
| Newsgroups | gmane.comp.cms.gnue.cvs |
|---|---|
| Message-ID | <[email protected]> |
Author: reinhard Date: 2010-12-16 15:22:17 -0600 (Thu, 16 Dec 2010) New Revision: 10273 Modified: trunk/gnue-common/ trunk/gnue-common/src/base/plugin.py Log: Moved exception to the end of the file. Property changes on: trunk/gnue-common ___________________________________________________________________ Name: bzr:revision-info - timestamp: 2010-12-03 00:59:15.023999929 +0100 committer: Reinhard M=C3=BCller <[email protected]> properties:=20 branch-nick: common + timestamp: 2010-12-16 22:21:53.016000032 +0100 committer: Reinhard M=C3=BCller <[email protected]> properties:=20 branch-nick: common Name: bzr:file-ids - src/base/tree.py 9946@3a364389-8fce-0310-8f11-cc363fde16c7:trunk%2Fg= nue-common:src%2Fbase%2Ftree.py + src/base/plugin.py 9937@3a364389-8fce-0310-8f11-cc363fde16c7:trunk%2= Fgnue-common:src%2Fbase%2Fplugin.py Name: bzr:revision-id:v4 - 3116 [email protected] 3117 [email protected] 3118 [email protected] 3119 [email protected] 3120 [email protected] 3121 [email protected] 3122 [email protected] 3123 [email protected] 3124 [email protected] 3125 [email protected] 3126 [email protected] 3127 [email protected] 3128 [email protected] 3129 [email protected] 3130 [email protected] 3131 [email protected] 3132 [email protected] 3133 [email protected] 3134 [email protected] 3135 [email protected] 3136 [email protected] 3137 [email protected] 3138 [email protected] 3139 [email protected] 3140 [email protected] 3141 [email protected] 3142 [email protected] 3143 [email protected] 3144 [email protected] 3145 [email protected] 3146 [email protected] + 3116 [email protected] 3117 [email protected] 3118 [email protected] 3119 [email protected] 3120 [email protected] 3121 [email protected] 3122 [email protected] 3123 [email protected] 3124 [email protected] 3125 [email protected] 3126 [email protected] 3127 [email protected] 3128 [email protected] 3129 [email protected] 3130 [email protected] 3131 [email protected] 3132 [email protected] 3133 [email protected] 3134 [email protected] 3135 [email protected] 3136 [email protected] 3137 [email protected] 3138 [email protected] 3139 [email protected] 3140 [email protected] 3141 [email protected] 3142 [email protected] 3143 [email protected] 3144 [email protected] 3145 [email protected] 3146 [email protected] 3147 [email protected] Name: bzr:text-parents - src/base/tree.py svn-v3-single1-dHJ1bmsvZ251ZS1jb21tb24.:3a364389-8f= ce-0310-8f11-cc363fde16c7:trunk%2Fgnue-common:10118 + src/base/plugin.py svn-v3-single1-dHJ1bmsvZ251ZS1jb21tb24.:3a364389-= 8fce-0310-8f11-cc363fde16c7:trunk%2Fgnue-common:10035 Modified: trunk/gnue-common/src/base/plugin.py =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- trunk/gnue-common/src/base/plugin.py 2010-12-16 20:56:25 UTC (rev 102= 72) +++ trunk/gnue-common/src/base/plugin.py 2010-12-16 21:22:17 UTC (rev 102= 73) @@ -63,46 +63,14 @@ from types import ModuleType from gnue.common.base import errors =20 -__all__ =3D ['LoadError', 'list_plugins', 'find'] +__all__ =3D ['list_plugins', 'find', 'LoadError'] =20 + # =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D -# Exceptions +# Global functions # =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D =20 # ----------------------------------------------------------------------= ------- -# Module loading error -# ----------------------------------------------------------------------= ------- - -class LoadError(errors.AdminError): - """ - Indicates a failure to load a given module. Raised by L{find}. - - If e is an Exception of this class, e.exceptions gives a dictionary = with - the keys being the modules that were trying to be imported and the v= alues - being the exception info tuples for the exception that happened tryi= ng, and - e.detail is a string containing basically the same info. - """ - def __init__(self, name, exceptions): - - self.name =3D name - self.exceptions =3D exceptions - - if self.exceptions: - message =3D u_("Cannot load plugin '%s'") % self.name - detail =3D u_("The following plugins failed:\n") - for (name, exc) in self.exceptions.items(): - detail +=3D u"* %s: %s" % (name, exc) - else: - message =3D u_("Cannot find plugin '%s'") % self.name - detail =3D None - - errors.AdminError.__init__(self, message) - - if detail: - self.detail =3D detail - - -# ----------------------------------------------------------------------= ------- # List all available plugins # ----------------------------------------------------------------------= ------- =20 @@ -355,6 +323,39 @@ =20 =20 # =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D +# Exceptions +# =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D + +class LoadError(errors.AdminError): + """ + Indicates a failure to load a given module. Raised by L{find}. + + If e is an Exception of this class, e.exceptions gives a dictionary = with + the keys being the modules that were trying to be imported and the v= alues + being the exception info tuples for the exception that happened tryi= ng, and + e.detail is a string containing basically the same info. + """ + def __init__(self, name, exceptions): + + self.name =3D name + self.exceptions =3D exceptions + + if self.exceptions: + message =3D u_("Cannot load plugin '%s'") % self.name + detail =3D u_("The following plugins failed:\n") + for (name, exc) in self.exceptions.items(): + detail +=3D u"* %s: %s" % (name, exc) + else: + message =3D u_("Cannot find plugin '%s'") % self.name + detail =3D None + + errors.AdminError.__init__(self, message) + + if detail: + self.detail =3D detail + + +# =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D # Self test code # =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D =20