l.s.w.s.StepsToGo : class documentation

Part of lp.services.webapp.servers View In Hierarchy

>>> class FakeRequest:
...     def __init__(self, traversed, stack):
...         self._traversed_names = traversed
...         self.stack = stack
...     def getTraversalStack(self):
...         return self.stack
...     def setTraversalStack(self, stack):
...         self.stack = stack
>>> request = FakeRequest([], ['baz', 'bar', 'foo'])
>>> stepstogo = StepsToGo(request)
>>> stepstogo.startswith()
True
>>> stepstogo.startswith('foo')
True
>>> stepstogo.startswith('foo', 'bar')
True
>>> stepstogo.startswith('foo', 'baz')
False
>>> len(stepstogo)
3
>>> print stepstogo.consume()
foo
>>> request._traversed_names
['foo']
>>> request.stack
['baz', 'bar']
>>> print stepstogo.consume()
bar
>>> bool(stepstogo)
True
>>> print stepstogo.consume()
baz
>>> print stepstogo.consume()
None
>>> bool(stepstogo)
False
>>> request = FakeRequest([], ['baz', 'bar', 'foo'])
>>> list(StepsToGo(request))
['foo', 'bar', 'baz']
Method __init__ Undocumented
Method __iter__ Undocumented
Method consume Remove the next path step and return it.
Method peek Return the next path step without removing it.
Method next Undocumented
Method startswith Return whether the steps to go start with the names given.
Method __len__ Undocumented
Method __nonzero__ Undocumented
Method _stack Undocumented
@property
def _stack(self):
Undocumented
def __init__(self, request):
Undocumented
def __iter__(self):
Undocumented
def consume(self):
Remove the next path step and return it.

Returns None if there are no path steps left.

def peek(self):
Return the next path step without removing it.

Returns None if there are no path steps left.

def next(self):
Undocumented
def startswith(self, *args):
Return whether the steps to go start with the names given.
def __len__(self):
Undocumented
def __nonzero__(self):
Undocumented
API Documentation for Launchpad, generated by pydoctor at 2022-06-16 00:00:12.