cybertools/container
2011-09-29 18:17:35 +02:00
..
__init__.py Refactored ordered container stuff out of loops package and put into cybertools.container 2006-01-27 08:21:24 +00:00
base.py provide special views for tracking storage and tracks 2008-05-08 14:41:09 +00:00
configure.zcml clean-up inner HTML stuff 2006-08-13 21:59:29 +00:00
contents.pt minor clean-up of contents template 2008-12-30 22:52:29 +00:00
cybertools.container-configure.zcml Refactored ordered container stuff out of loops package and put into cybertools.container 2006-01-27 08:21:24 +00:00
DEPENDENCIES.cfg Refactored ordered container stuff out of loops package and put into cybertools.container 2006-01-27 08:21:24 +00:00
interfaces.py Refactored ordered container stuff out of loops package and put into cybertools.container 2006-01-27 08:21:24 +00:00
ordered.py work in progress: make cybertools package work with BlueBream 1.0 2011-09-29 18:17:35 +02:00
README.txt Refactored ordered container stuff out of loops package and put into cybertools.container 2006-01-27 08:51:45 +00:00
SETUP.cfg Refactored ordered container stuff out of loops package and put into cybertools.container 2006-01-27 08:21:24 +00:00
tests.py Refactored ordered container stuff out of loops package and put into cybertools.container 2006-01-27 08:21:24 +00:00

Ordered Containers
==================

  ($Id$)

Let's add an ordered container and place some objects in it:
      
  >>> from zope.app.container.ordered import OrderedContainer
  >>> c1 = OrderedContainer()
  >>> c1['sub1'] = OrderedContainer()
  >>> c1['sub2'] = OrderedContainer()
  >>> c1['sub3'] = OrderedContainer()
  >>> c1['sub4'] = OrderedContainer()
  >>> c1.keys()
  ['sub1', 'sub2', 'sub3', 'sub4']
      
A special management view provides methods for moving objects down, up,
to the bottom, and to the top
      
  >>> from cybertools.container.ordered import OrderedContainerView
  >>> from zope.publisher.browser import TestRequest
  >>> view = OrderedContainerView(c1, TestRequest())
  >>> view.move_bottom(('sub3',))
  >>> c1.keys()
  ['sub1', 'sub2', 'sub4', 'sub3']
  >>> view.move_up(('sub4',), 1)
  >>> c1.keys()
  ['sub1', 'sub4', 'sub2', 'sub3']
  >>> view.move_top(('sub2',))
  >>> c1.keys()
  ['sub2', 'sub1', 'sub4', 'sub3']
  >>> view.move_down(('sub2',), 2)
  >>> c1.keys()
  ['sub1', 'sub4', 'sub2', 'sub3']