Download Shareware and Freeware Software for Windows, Linux, Macintosh, PDA

line Home  |  About Us  |  Link To Us  |  FAQ  |  Contact

Serving Software Downloads in 976 Categories, Downloaded 29.658.814 Times

Flask-Genshi 0.5

Company: Dag Odenhall
Date Added: September 25, 2013  |  Visits: 183

Flask-Genshi

Report Broken Link
Printer Friendly Version


Product Homepage
Download (16 downloads)



Flask-Genshi is a Flask extension that allows you to easily use Genshi for templating. It knows how to render a template based on the file extension and can create Response objects with mimetype set accordingly.<br /><br />Installation<br /><br />Just grab it from PyPI with easy_install or pip, for example:<br /><br />easy_install Flask-Genshi<br /><br />If you???*a*?re starting a new project you don???*a*?t need to explicitly install Flask as Flask-Genshi depends on it already.<br /><br />How to Use<br /><br />You need to construct a Genshi with your Flask instance.<br /><br />from flaskext.genshi import Genshi<br /><br />app = Flask(__name__)<br />genshi = Genshi(app)<br /><br />The best way to render templates is to use render_response(). This ensures that the proper mimetype is sent if you render XHTML, XML or text, and sets the right doctype for you.<br /><br />Use it like so:<br /><br />from flaskext.genshi import render_response<br /><br />@app.route('/')<br />def index():<br /> title = 'Genshi + Flask, a match made in heaven!'<br /> return render_response('index.html', dict(title=title))<br /><br />Using Methods<br /><br />Methods control things such as the doctype and how end tags are rendered, and with render_response() also the mimetype. Unless overridden the method used is decided by the template???*a*?s filename extension.<br /><br />By default HTML renders as strict HTML 4.01. This is how you change it to HTML5:<br /><br />genshi.extensions['html'] = 'html5'<br /><br />I recommend against this but of course you can also change it to XHTML:<br /><br />genshi.extensions['html'] = 'xhtml'<br /><br />You can also override the default with a parameter to the templating functions:<br /><br />render_response('video.html', method='html5')<br /><br />The extensions html, xml, txt, js and css are recognized, but you can add any extension and method you like. Note that txt, js and css templates are rendered with genshi.template.NewTextTemplate which is not XML-based. Rendering javascript with templates gives you tools like flask.url_for() and rendering CSS with templates gives you dynamic stylesheets with things like variables.<br /><br />API Reference<br /><br />class flaskext.genshi.Genshi(app)<br /><br /> extensions<br /> What method is used for an extension.<br /><br /> methods<br /> Render methods.<br /><br /> template_loader<br /> A genshi.template.TemplateLoader that loads templates from the same place as Flask.<br /><br />flaskext.genshi.select_method(template, method=None)<br /> Selects a method from Genshi.methods based on the file extension of template and Genshi.extensions, or based on method.<br /><br />flaskext.genshi.generate_template(template, context=None, method=None)<br /> Creates a Genshi template stream that you can run filters and transformations on.<br /><br />flaskext.genshi.render_template(template, context=None, method=None)<br /> Renders a template to a string.<br /><br />flaskext.genshi.render_response(template, context=None, method=None)<br /> Renders a template and wraps it in a response_class with mimetype set according to the rendering method.<br /><br />#md5=8a4ad41837cbee034142a00954aa334e<br /><br />#md5=b5f50c36632725f4a9defb84ca334fb9

Requirements: No special requirements
Platforms: *nix, Linux
Keyword: Based Change Context Dnone Default Doctype Extension Flask Flaskextgenshi Flaskgenshi Genshi Import Method Method Dnone Mimetype Render Render Response Rendered Rendering Template Templates
Users rating: 0/10

License: Freeware Size: 61.44 KB
USER REVIEWS
More Reviews or Write Review


FLASK-GENSHI RELATED
Modules  -  Context Theme 6.x-1.x-de
By default the Context module can set theme variables, but does not support changing the theme based on context.InstallationUnpack in your modules folder (usually '/sites/all/modules/')Enable under Administer > Site Building > Modules.
10 KB  
Utilities  -  Word Predictor 1.1 Alpha
Word Predictor is intelligent enough to offer suggestions for the user, based on context and the characters inserted so far. This goal of this software is to allow users with limited mobility to be able to more accurately and quickly input text...
 
Network & Internet  -  Franker 1.1.2
Franker is a browser extension which mimics Ilya Frank's Reading Method. Features: * Frankate (translate sentence-by-sentence) selected text: Ctrl+F or context menu (context menu in Safari extension only) * Frankate...
51.2 KB  
Network & Internet  -  Flask-HTMLBuilder 0.4
Flask-HTMLBuilder is a Flask extension that allows flexible and easy Python-only generation of HTML snippets and full HTML documents using a robust syntax. For more advanced usage it provides a lean template inheritance system that is intertwined...
225.28 KB  
Programming  -  Flask-SSLify 0.1.3
This is a simple Flask extension that configures your Flask application to redirect all incoming requests to HTTPS. Redirects only occur when app.debug is False.
10.24 KB  
Web Browsers  -  PubChem Search for Safari 1.0
PubChem Search is very useful Safari extension that will add a PubChem search item right in the context menu. To use it, just select some text on the page, right-click and then choose Search in PubChem. Settings allow you to set search results...
 
Web Browsers  -  Text Formatting Toolbar 0.1.4.12
After Downloading and installing the Text Formatting Toolbar the new toolbar will be visible and ready for use. You then need to select the format you want to use. The default is BBcode, but you can chose HTML or Wiki code depending on what you...
174.08 KB  
Programming  -  collective.z3cform.wizard 1.3.2
This library implements a simple z3c.form-based wizard. The wizard is composed of multiple steps. Each step is a form. Data is stored in a session until the user clicks the Finish button on the last step. In order to make good use of...
30.72 KB  
Programming  -  Flask-OAuth 0.9
Flask-OAuth is a Flask extension that allows you to interact with remove OAuth enabled applications. Currently it only implements the consumer interface so you cannot expose your own API with OAuth. It depends on the python-oauth2 module. You can...
10.24 KB  
Business  -  SSuite Office - The Fifth Element 2.1
Productivity software for the office has a player trying to pit itself against the Redmond-based software giant. One promising tagline in SSuite Office's homepage is No Java and No Net. Why is this important? It means that the software runs...
37.7 MB  
NEW DOWNLOADS IN LINUX SOFTWARE, PROGRAMMING
Linux Software  -  Polling Autodialer Software 3.4
ICTBroadcast Auto Dialer software has a survey campaign for telephone surveys and polls. This auto dialer software automatically dials a list of numbers and asks them a set of questions that they can respond to, by using their telephone keypad....
488 B  
Linux Software  -  Total Video Converter Mac Free 3.5.5
Total Video Converter Mac Free developed by EffectMatrix Ltd is the official legal version of Total Video Converter which was a globally recognized brand since 2006. Total Video Converter Mac Free is a free but powerful all-in-one video...
17.7 MB  
Linux Software  -  Skeith mod_log_sql Analyzer 2.10beta2
Skeith is a php based front end for analyzing logs for Apache using mod_log_sql.
47.5 KB  
Linux Software  -  SLAX 6.0+
Slax is a modern, portable, small and fast Linux operating system with a modular approach and outstanding design. Despite its small size, Slax provides a wide collection of pre-installed software for daily use, including a well organized graphical...
190 KB  
Linux Software  -  GTK+ 2.5
GTK+, which stands for the GIMP Toolkit, is a library for creating graphical user interfaces for the X Window System. It is designed to be small, efficient, and flexible. GTK+ is written in C with a very object-oriented approach. Language bindings...
60 MB  
Programming  -  FLEX-db Digital Asset Manager 3.0.9
FLEX-db - an enterprise Digital Asset Manager (DAM). It ingests and links metadata with files, creates thumbnails, and processes files using business rules. FLEX-db has a JSP client, Java app server for file input and output and an EJB metadata...
21.57 MB  
Programming  -  Libicom 0.9.0
The libicom library is a character based dynamicly linked library for Linux. It is used to remotely control the Icom IC-R8500 wide band receiver via an RS232 link. All call and return parameters to the control functions are character string based....
20.48 KB  
Programming  -  dotdesktop 0.3
Dotdesktop library provides ability to parse desktop entry file and access the information in a convenient way. Desktop entry file format is defined by freedesktop.org, it is used to describe information about an application such as the name and...
327.68 KB  
Programming  -  Cedalion for Linux 0.2.6
Cedalion is a programming language that allows its users to add new abstractions and define (and use) internal DSLs. Its innovation is in the fact that it uses projectional editing to allow the new abstractions to have no syntactic limitations.
471.04 KB  
Programming  -  libyasl 0.2
Libyasl is a C++ class library to easily realize TCP/UDP/Multicast clientsand servers in IPv4 and IPv6 environments under GNU/Linux systems.
143.36 KB