This is a pre-production deployment of Warehouse, however changes made here WILL affect the production instance of PyPI.
Latest Version Dependencies status unknown Test status unknown Test coverage unknown
Project Description

A tile is a piece of web application, i.e. a form, a navigation, etc.

Splitting your application in such small and logic application parts makes it easy to re-use this application, simplifies application ajaxification and the use of same application parts in different manners.


>>> from bda.bfg.tile import Tile
>>> from bda.bfg.tile import TileRenderer
>>> from bda.bfg.tile import registerTile
>>> from bda.bfg.tile import tile

We need some dummies as model and request.:

>>> class Model(object): pass
>>> model = Model()
>>> from repoze.bfg.request import DEFAULT_REQUEST_FACTORIES
>>> request = DEFAULT_REQUEST_FACTORIES[None]['factory'](environ={})

The pure Tile itself. Normally you do not create this directly, this is done due registration, see below.:

>>> mytile = Tile('testdata/', None)
>>> mytile(model,  request)
u'<span>Tile One</span>'

Register a tile using the prior template testtemplate. When no object is given, the default tile is instanciated as above.:

>>> registerTile('tileone', 'testdata/')

Render the already registered tile.:

>>> TileRenderer(model, request)('tileone')
u'<span>Tile One</span>'

Now the decorator - level=1 is needed for the doctest only to reduce the module level.:

>>> @tile('tiletwo', 'testdata/', level=1)
... class Tile2(Tile):
...     data = u'custom'
>>> TileRenderer(model, request)('tiletwo')
u'<span>Tile Two: <b><span>Tile One</span></b></span>'

You can define an attribute which is responsible to render the tile instead of defining a template. By default render is taken. With the keyword argument attribute you can point to a different attribute.:

>>> @tile('attrtile')
... class Tile2(Tile):
...     def render(self):
...         return u'<h1>Rendered via attribute call</h1>'
>>> TileRenderer(model, request)('attrtile')
u'<h1>Rendered via attribute call</h1>'
>>> @tile('attrtile', attribute='foobar')
... class Tile2(Tile):
...     def foobar(self):
...         return u'<h1>Rendered via attribute foobar call</h1>'
>>> TileRenderer(model, request)('attrtile')
u'<h1>Rendered via attribute foobar call</h1>'
Release History

Release History


This version

History Node

TODO: Figure out how to actually get changelog content.

Changelog content for this version goes here.

Donec et mollis dolor. Praesent et diam eget libero egestas mattis sit amet vitae augue. Nam tincidunt congue enim, ut porta lorem lacinia consectetur. Donec ut libero sed arcu vehicula ultricies a non tortor. Lorem ipsum dolor sit amet, consectetur adipiscing elit.

Show More

Download Files

Download Files

TODO: Brief introduction on what you do with files - including link to relevant help section.

File Name & Checksum SHA256 Checksum Help Version File Type Upload Date
bda.bfg.tile-1.0.tar.gz (5.0 kB) Copy SHA256 Checksum SHA256 Source Sep 10, 2009

Supported By

WebFaction WebFaction Technical Writing Elastic Elastic Search Pingdom Pingdom Monitoring Dyn Dyn DNS HPE HPE Development Sentry Sentry Error Logging CloudAMQP CloudAMQP RabbitMQ Heroku Heroku PaaS Kabu Creative Kabu Creative UX & Design Fastly Fastly CDN DigiCert DigiCert EV Certificate Rackspace Rackspace Cloud Servers DreamHost DreamHost Log Hosting