dodotable.environment — Environment for dodotable¶
Customize your table¶
Dodotable has dodotable.environment.Environment to render data
to template and get a instance of sqlalchemy.orm.session.Session to
requeset a query to database.
Usually dodotable.environment.Environment used in
dodotable.schema.Schema. dodotable.schema.Schema.environment
generate template loader and define custom function to
Jinja’s environment to call a functions in template.
So, you have to inherit environment class and implement some methods,
dodotable.environment.Environment.template_loader()dodotable.environment.Environment.build_url()dodotable.environment.Environment.get_session()
A good example is dodotable.environment.flask.FlaskEnvironment.
more examples are in it.
-
class
dodotable.environment.Environment(locale_selector=None)¶ Top-level environment class, every environment class implemented by inherit this class.
Parameters: locale_selector ( Callable) – a locale returning nullary function for selection of the right translation. the type of a return value can bestrorbabel.core.Localeas well. if it’s omitted or a return value isNoneEnglish is shown.-
template_loader¶ Get custom template loader
Returns: jinja template loader Return type: jinja2.loaders.BaseLoader
-