A stack-like list. Calling it returns the head of the stack.
| 2216 | |
| 2217 | |
| 2218 | class AppStack(list): |
| 2219 | """ A stack-like list. Calling it returns the head of the stack. """ |
| 2220 | |
| 2221 | def __call__(self): |
| 2222 | """ Return the current default application. """ |
| 2223 | return self[-1] |
| 2224 | |
| 2225 | def push(self, value=None): |
| 2226 | """ Add a new :class:`Bottle` instance to the stack """ |
| 2227 | if not isinstance(value, Bottle): |
| 2228 | value = Bottle() |
| 2229 | self.append(value) |
| 2230 | return value |
| 2231 | |
| 2232 | |
| 2233 | class WSGIFileWrapper(object): |