[Zope3-checkins]
SVN: Zope3/trunk/src/zope/app/publication/requestpublicationregistry.py
replaced nested if-clauses with cleaner code
Andreas Jung
andreas at andreas-jung.com
Wed Oct 12 16:05:04 EDT 2005
Log message for revision 39105:
replaced nested if-clauses with cleaner code
Changed:
U Zope3/trunk/src/zope/app/publication/requestpublicationregistry.py
-=-
Modified: Zope3/trunk/src/zope/app/publication/requestpublicationregistry.py
===================================================================
--- Zope3/trunk/src/zope/app/publication/requestpublicationregistry.py 2005-10-12 19:54:34 UTC (rev 39104)
+++ Zope3/trunk/src/zope/app/publication/requestpublicationregistry.py 2005-10-12 20:05:03 UTC (rev 39105)
@@ -83,15 +83,17 @@
environment.
"""
- factory_lst = self.getFactoriesFor(method, mimetype)
- if not factory_lst:
- factory_lst = self.getFactoriesFor(method, '*')
- if not factory_lst:
- factory_lst = self.getFactoriesFor('*', '*')
- if not factory_lst:
- raise ConfigurationError('No registered publisher found '
- 'for (%s/%s)' % (method, mimetype))
+ found = False
+ for m,mt in ((method, mimetype), (method, '*'), ('*', '*')):
+ factory_lst = self.getFactoriesFor(m, mt)
+ if factory_lst:
+ found = True
+ break
+ if not found:
+ raise ConfigurationError('No registered publisher found '
+ 'for (%s/%s)' % (method, mimetype))
+
# now iterate over all factory candidates and let them introspect
# the request environment to figure out if they can handle the
# request
More information about the Zope3-Checkins
mailing list