You are here: Home » Software Development » Components & Libraries » Genshi

Genshi

Genshi Genshi - A toolkit for stream-based generation of output for the web



  • Downloads:4
  • Last update:Jul 28, 2009
  • Version:0.4.1
  • License:Freeware
  • Publisher:Edgewall Software
  • System Requirements Windows All / Unix

Free Download ( 131 KB )

Genshi

Genshi - A toolkit for stream-based generation of output for the web
Genshi is a Python library that offers an integrated set of components for processing, parsing and generating HTML, XML or other textual content for output generation on the web.

Genshi is a "toolkit for stream-based generation of output for the web". The largest feature provided by Genshi is an XML-based template engine that is heavily inspired by Kid. But it also provides a text-based template engine, as well as a collection of tools for working with markup.

Why XML-based?

Most template engines for web applications are character-stream based: they know nothing about the format of the response body that is being generated.

They simply substitute variable expressions, and provide some directives for looping, conditionals, etc. Thus they can be used to generate any kind of textual output, be it HTML, plain text emails, program code, or really anything else.

However, 99% of the templates used by web applications generate some kind of XML/HTML-based markup.

We believe that web applications can benefit from a template engine that "knows what it's doing" when it comes to markup. You don't need to worry about generating output that is not well-formed, nor do you need to worry about accidentially not escaping some data, thereby greatly reducing the risk for introducing XSS attack vectors.

Furthermore, your templates look a lot more like the targetted output format: an HTML template looks like HTML, a template for an RSS feed looks like RSS. Directives in text-based template languages often result in rather messy templates, or produce excessive amounts of unnecessary white space.

Main features of Genshi:

  • A unified stream-based processing model for markup, where
  • Streams can come from XML or HTML text, or be generated programmatically using a very simple syntax.
  • XPath can be used to query any stream, not just in templates.
  • Different serialization methods (XML, HTML, and plain text) for streams.
  • An HTML "sanitizing" filter to strip potentially dangerous elements or attributes from user-submitted HTML markup.
  • A simple text-based template engine that can be used for generating plain text output.


    Requirements of Genshi:

  • Python 2.3 or later (2.4 or later is recommended)
  • Optional: setuptools 0.6a2 or later


    What's New in This Release:

  • Fix incorrect reference to translation function in the I18N filter.
  • The `ET()` function now correctly handles attributes with a namespace.
  • XML declarations are now processed internally, as well as written to the output when XML serialization is used (ticket #111).
  • Added the functions `encode()` and `get_serializer()` to the `genshi.output` module, which provide a lower-level API to the functionality previously only available through `Stream.render()` and `Stream.serialize()`.
  • The `DocType` class now has a `get(name)` function that returns a `DOCTYPE` tuple for a given string.
  • Added frameset variants to the `DocType` constants for HTML 4.01 and XHTML 1.0.
  • Improved I18n extraction for pluralizable messages: for any translation function with multiple string arguments (such as ``ngettext``), a single item with a tuple of strings is yielded, instead an item for each string argument.
  • The `HTMLFormFiller` stream filter no longer alters form elements for which the data element contains no corresponding item.
  • Code in `` processing instructions no longer gets the special treatment as Python code in template expressions, i.e. item and attribute access are no longer interchangeable (which was broken in a number of ways anyway, see ticket #113). This change does not affect expressions.
  • Numerous fixes for the execution of Python code in `` processing instructions (tickets #113 and #114).
  • The `py:def` (and `#def`) directive now supports "star args" (i.e. `*args` and `**kwargs`) in the function declaration (ticket #116).

    Free Download ( 131 KB )

  • Rating & Reviews for Genshi





    Tips & Guides Related to Genshi

    • Voice over Internet phone and chat software on Mac

      Internet phone has become so ubiquitous, an entire generation of internet users is probably unaware there was ever life without it. Use Internet phone to help you communicate across networks with people all the world.

      by candies on Aug 26, 2009

    • How can I remove Spam from my PC

      How can you remove spam emails from PC? Spam Monitor - this excellent detector and remove software monitors and removes Spam, Junk Mail and Virus Mail from your PC!

      by candies on Jun 19, 2009

    • How do I protect my computer from Spam

      How do I protect my computer from Spam Mail? Spam Monitor - this powerful and latest Spam monitor filter software offers a series of protective functions, it can protect your PC from all Spam Emails!

      by candies on Jun 18, 2009

    • How to stop Junk Mail in your mailbox

      How to stop Spam and Junk Mail in your mailbox? Spam Monitor - this full-functional spam detector and filter software can help you monitor all the Junk Mails and stop them from sending to your mailbox.

      by candies on Jun 19, 2009

    • How to block spam on Microsoft Outlook Express

      How to block spam emails on Microsoft Outlook Express? Spam Monitor, this powful Spam Detector and Blocker software is also an useful Outlook Express Spam Blocker tool, it offers blocking Spam for Outlook.

      by candies on Jun 22, 2009

    Free Download Genshi

    Free Download ( 131 KB )