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 38.854.815 Times

Flask-Genshi 0.5

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


Report Broken Link
Printer Friendly Version

Product Homepage
Download (25 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
More Reviews or Write Review

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...
Security Tools  -  Steganifyer 1.0
it is about a GUI (Graphical User Interface ) program based on Qt4 library ,that hides data on a picture using differents method depending on picture format (BMP,JPG,PNG,...) (this is called Steganography) the data can be on any file format
5.67 MB  
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  -  Firefox Accessibility Extension
Firefox Accessibility Extension adds tools for accessible navigation and the development of accessible web content.
276.48 KB  
Web Browsers  -  Text Formatting Toolbar
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  
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  
Linux Software  -  Driver Booster
Driver Booster 7 can update all outdated/faulty/missing drivers in 1-click with a database of 3, 500, 000+ drivers, which ensures all outdated drivers and game components can be updated for Windows users. And all the supported drivers have passed...
24.64 MB  
Linux Software  -  EasyEDA PCB Designer for Linux 2.0.0
EasyEDA, a great web based EDA(Electronics Design Automation) tool, online PCB tool, online PCB software for electronics engineers, educators, students, makers and enthusiasts. Theres no need to install any software. Just open EasyEDA in any...
34.4 MB  
Linux Software  -  wpCache® WordPress HTTP Cache 1.9
wpCache® is a high-performance, distributed object, caching system application, generic in nature, but intended for use in speeding up dynamic web applications, by decreasing database load time. wpCache® decreases dramatically the page...
3.51 MB  
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  
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  -  Math::GMPf 0.29
Math::GMPf - perl interface to the GMP library's floating point (mpf) functions.
30.72 KB  
Programming  -  Net::Wire10 1.08
Net::Wire10 is a Pure Perl connector that talks to Sphinx, MySQL and Drizzle servers. Net::Wire10 implements the low-level network protocol, alias the MySQL wire protocol version 10, necessary for talking to one of the aforementioned...
30.72 KB  
Programming  -  logilab-common 0.56.2
a bunch of modules providing low level functionnalities shared among some python projects devel Please note that some of the modules have some extra dependencies. For instance, logilab.common.db will require a db-api 2.0 compliant...
174.08 KB  
Programming  -  OpenSSL for linux 1.0.0a
The OpenSSL Project is a collaborative effort to develop a robust, commercial-grade, full-featured, and Open Source toolkit implementing the Secure Sockets Layer (SSL v2/v3) and Transport Layer Security (TLS v1) protocols as well as a...
3.83 MB