1. xpahos
  2. WebHelpers


slug...@gmail.com  committed e6e4535


  • Participants
  • Parent commits 4278a49
  • Branches trunk

Comments (0)

Files changed (6)

File docs/_templates/index.html

View file
 <a href="http://routes.groovie.org/">Routes</a>, 
 <a href="http://python.org/pypi/Unidecode/">unidecode</a>, 
 <a href="http://pythonpaste.org/webob/">WebOb</a>, or
-<a href="http://pylonshq.com/">Pylons</a>, or
+<a href="http://pylonshq.com/">Pylons</a>,
 as noted in their documentation.  WebHelpers requires Python 2.4 or higher,
 and has not yet been tested with Python 3. An extensive test suite for doctest
 and Nose is included.</p>

File docs/contents.rst

View file
 WebHelpers Documentation
 .. toctree::
    :maxdepth: 1
-   overview

File docs/overview.rst

-.. automodule:: webhelpers

File webhelpers/__init__.py

View file
-"""Functions useful in web applications (and other applications)
+"""WebHelpers contains a wide variety of functions for web applications.
+It's pure Python and can be used with any web framework, and many of the
+helpers are also useful in non-web applications.
-WebHelpers provides a wide variety of functions useful in any web application,
-including an HTML tag generator with smart escaping, tag functions,
-text-to-HTML converters, a paginator, etc.  These can be used in any web
-framework.  A few Pylons-specific helpers are in ``webehlpers.pylonslib``;
-these can be ported to other frameworks by simply replacing the
-framework-specific API calls (request/response/session/URL).
+WebHelpers includes the widely-used HTML tag builder with smart escaping and
+convenience functions for common tags. These ensure the HTML tags are
+syntactically correct and prevent cross-site scripting attacks. Convenience
+functions for form input tags and other common tags are provided.
-Some helpers are also useful in non-web applications.  There are text
-formatters, advanced container types, country & state abbreviations, simple
-numeric statistics, etc.
+Other helpers perform text processing, display records a pageful at a time,
+generate Atom/RSS feeds with geographical (GIS) data, handle MIME types,
+calculate statistics, and more.  There are also high-level container types,
+including a value counter and accumulator.  There are lists of country names,
+country codes, US states, Canadian provinces, and UK counties.
-The main criteria for incuding helpers are: 
+WebHelpers requires Python 2.4 or higher. It has not yet been tested with 
+Python 3.  WebHelpers has no formal dependencies; however, a few individual
+helpers depend on 
+`Routes <http://routes.groovie.org/>`_, 
+`Unidecode <http://python.org/pypi/Unidecode/>`_, 
+`WebOb <http://pythonpaste.org/webob>`_, or
+`Pylons <a href="http://pylonshq.com/>`_,
+as noted in their documentation.
+The main criteria for adding new helpers are: 
 * Is it useful in a wide variety of applications, especially web applications?
 * Is it too small to be released as its own project, and is there no other
   Python project more appropriate for it?
-Helper functions are organized into modules by theme.  All HTML generators are
-under the ``webhelpers.html`` package, except for a few third-party modules
-which are directly under ``webhelpers``.
-WebHelpers depends on Routes 1.x due to the unit tests and deprecated Rails
-Users of WebHelpers 0.3 will notice significant changes in 0.6.  All helpers
-ported from Rails (the ``webhelpers.rails`` package) have been deprecated, and
-most have been replaced with new functions in ``webhelpers.html`` or elsewhere.
-``from webhelpers import *`` no longer imports all helpers; you must
-specifically import the modules or functions you want.  Javascript libraries
-(Prototype, Scriptaculous, and ``link_to_remote()``) have also been deprecated
-because the Javascript state-of-the-art changes too rapidly.
-Pylons applications ported to Pylons 0.9.7 that depend on the deprecated Rails
-helpers should add the following to myapp/lib/helpers.py::
-    from webhelpers.rails.wrapped import *
-    from routes import url_for, redirect_to
-A few helpers have external dependencies as noted in their module docstrings.
+WebHelpers was originally created as a utility package for Pylons. Many of the
+helpers were ported from Ruby on Rails. Version 0.6 introduced the HTML tag
+builder and deprecated the rails helpers; new subpackages were added to replace
+the rails helpers. Version 1.0 builds on this with many additional helpers.

File webhelpers/html/__init__.py

View file
+"""HTML generation helpers.
+All public objects in the ``webhelpers.html.builder`` subpackage are also
+available in the ``webhelpers.html`` namespace.  Most programs will want
+to put this line in their code::
+    from webhelpers.html import *
+Or you can import the most frequently-used objects explicitly::
+    from webhelpers.html import HTML, escape, literal
 from webhelpers.html.builder import *

File webhelpers/media.py

View file
     Returns ``(width, height)`` as two integers, or ``default`` if the size
     could not be ascertained.  Failure usually means the file does not exist
-    or is not in a recognized format.  Only JPG, PNG, GIF, BMP are supported at
-    this time.
+    or is not in a recognized format.  Only JPG, PNG, GIF, and BMP are
+    supported at this time.
     The algorithms are based on a `PyCode recipe
     <http://www.pycode.com/modules/?id=32&tab=download>`_ by