Skip to content

Commit

Permalink
fix unlikely race condition
Browse files Browse the repository at this point in the history
  • Loading branch information
tilgovi committed Aug 10, 2011
1 parent f0622e0 commit db5a749
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions greins/app.py
Expand Up @@ -87,19 +87,19 @@ def load_file(self,cf):

# Load all the mount points
for r, a in cfg['mounts'].iteritems():
if not r.startswith('/'):
self.logger.warning("Adding leading '/' to '%s'" % r)
r = '/' + r
if r in self._mounts:
self.logger.warning("Duplicate routes for '%s'" % r)
continue
# Capture the handler in a closure
def wrap(app):
def app_with_env(env, start_response):
return app(env, start_response)
app_with_env.__name__ = app.__name__
return app_with_env
self._mounts[r] = wrap(a)
wrapped = wrap(a)
if not r.startswith('/'):
self.logger.warning("Adding leading '/' to '%s'" % r)
r = '/' + r
if self._mounts.setdefault(r, wrapped) != wrapped:
self.logger.warning("Duplicate routes for '%s'" % r)
continue

# Set up server hooks
for hook in self._hooks:
Expand Down

0 comments on commit db5a749

Please sign in to comment.