{ "info": { "author": "BlueDynamics Alliance", "author_email": "dev@bluedynamics.com", "bugtrack_url": null, "classifiers": [ "Development Status :: 3 - Alpha", "Environment :: Web Environment", "Operating System :: OS Independent", "Programming Language :: Python", "Topic :: Internet :: WWW/HTTP :: Dynamic Content" ], "description": "A tile is a piece of web application, i.e. a form, a navigation, etc.\n\nSplitting your application in such small and logic application parts makes it\neasy to re-use this application, simplifies application ajaxification and\nthe use of same application parts in different manners.\n\nImports.:\n\n >>> from bda.bfg.tile import Tile\n >>> from bda.bfg.tile import TileRenderer\n >>> from bda.bfg.tile import registerTile\n >>> from bda.bfg.tile import tile\n \nWe need some dummies as model and request.:\n\n >>> class Model(object): pass\n >>> model = Model()\n >>> from repoze.bfg.request import DEFAULT_REQUEST_FACTORIES\n >>> request = DEFAULT_REQUEST_FACTORIES[None]['factory'](environ={})\n \nThe pure Tile itself. Normally you do not create this directly, this is done\ndue registration, see below.:\n\n >>> mytile = Tile('testdata/tile1.pt', None)\n >>> mytile(model, request)\n u'Tile One'\n\nRegister a tile using the prior template testtemplate. When no object is given,\nthe default tile is instanciated as above.:\n\n >>> registerTile('tileone', 'testdata/tile1.pt')\n\nRender the already registered tile.:\n\n >>> TileRenderer(model, request)('tileone')\n u'Tile One'\n\nNow the decorator - level=1 is needed for the doctest only to reduce the module\nlevel.:\n\n >>> @tile('tiletwo', 'testdata/tile2.pt', level=1)\n ... class Tile2(Tile):\n ... data = u'custom'\n >>> TileRenderer(model, request)('tiletwo')\n u'Tile Two: Tile One'\n\nYou can define an attribute which is responsible to render the tile instead of\ndefining a template. By default ``render`` is taken. With the keyword argument \n``attribute`` you can point to a different attribute.:\n \n >>> @tile('attrtile')\n ... class Tile2(Tile):\n ... def render(self):\n ... return u'