A stack-like list. Calling it returns the head of the stack.
| 2987 | |
| 2988 | |
| 2989 | class AppStack(list): |
| 2990 | """ A stack-like list. Calling it returns the head of the stack. """ |
| 2991 | |
| 2992 | def __call__(self): |
| 2993 | """ Return the current default application. """ |
| 2994 | return self.default |
| 2995 | |
| 2996 | def push(self, value=None): |
| 2997 | """ Add a new :class:`Bottle` instance to the stack """ |
| 2998 | if not isinstance(value, Bottle): |
| 2999 | value = Bottle() |
| 3000 | self.append(value) |
| 3001 | return value |
| 3002 | new_app = push |
| 3003 | |
| 3004 | @property |
| 3005 | def default(self): |
| 3006 | try: |
| 3007 | return self[-1] |
| 3008 | except IndexError: |
| 3009 | return self.push() |
| 3010 | |
| 3011 | |
| 3012 | class WSGIFileWrapper(object): |
no outgoing calls
no test coverage detected
searching dependent graphs…