1. Atsushi Odagiri
  2. WebHelpers


slug...@gmail.com  committed 0544ba1


  • Participants
  • Parent commits d2b1a82
  • Branches trunk

Comments (0)

Files changed (7)


View file
  • Ignore whitespace
 Run tests on Python 2.4 to see if any 2.5isms have crept in.
-What is the purpose of webhelpers.mimehelper? It has a hidden Pylons
-dependency, although it's optional. Under what circumstances would you use it, 
-and how much of an advantage is it to pass a short alias like
-m.mimetype("html")? Need better documentation.`
-Document MIMETypes.__init__().
-webhelpers.number: document __call__ methods.
 Too many strip_tags / sanitize / bleach functions.

File docs/conf.py

View file
  • Ignore whitespace
 # other places throughout the built documents.
 # The short X.Y version.
-version = '1.0b3'
+version = '1.0'
 # The full version, including alpha/beta/rc tags.
-release = '1.0b1'
+release = '1.0b3'
 # There are two options for replacing |today|: either, you set today to some
 # non-false value, then it is used:

File docs/modules/number.rst

View file
  • Ignore whitespace
 .. autoclass:: SimpleStats
-    :members:
-    :undoc-members:
+    :members: __call__, extend
 .. autoclass:: Stats
-    :members:
-    :undoc-members:
+    :members: __call__, extend, finish

File docs/modules/pylonslib/flash.rst

View file
  • Ignore whitespace
 .. currentmodule:: webhelpers.pylonslib.flash
 .. autoclass:: Flash
-    :members:
+   :members: __call__, pop_messages
+.. autoclass:: Message
+   :members:

File webhelpers/mimehelper.py

View file
  • Ignore whitespace
-"""MIMEType helpers
+"""MIME Type helpers
-These helpers depend on the WebOb package.
+This helper depends on the WebOb package, and has optional Pylons support.
 import mimetypes
     add_alias = classmethod(add_alias)
     def __init__(self, environ):
+        """``environ`` is the WSGI environment of the current request."""
         self.env = environ
     def _set_response_content_type(self, mimetype):

File webhelpers/number.py

View file
  • Ignore whitespace
     def __call__(self, value):
+        """Add a data value."""
         if self.count == 0:
             self.min = self.max = value
     def finish(self):
+        """Finish calculations. (Call after adding all data values.)
+        Call this after adding all data values, or the results will be
+        incomplete.
+        """
         self.mean = mean(self.list)
         self.median = median(self.list)
         self.standard_deviation = standard_deviation(self.list)

File webhelpers/pylonslib/flash.py

View file
  • Ignore whitespace
 categories are "*warning*", "*notice*", "*error*", and "*success*", with
 the default being "*notice*".  The category is available in the message's
 ``.category`` attribute, and is normally used to set the container's CSS
-class.  Unlike the logging system, the flash object does not filter out
-messages below a certain level; it returns all messages set. 
+This is the *only* thing it does. Calling ``.pop_messages()`` pops all messages
+in the order registered, regardless of category.  It is *not* possible to pop
+only a certain category, or all levels above a certain level, or to group
+messages by category. If you want to group different kinds of messages
+together, or pop only certain categories while leaving other categories, you
+should use multiple ``Flash`` objects.
 You can change the standard categories by overriding the ``.categories``
 and ``.default_category`` class attributes, or by providing alternate
 values using constructor keywords.
-Note that messages are _not_ grouped by category, nor is it possible to 
-pop one category of messages while leaving the others.  If you want to 
-group different kinds of messages together, you should use multiple flash
 Category example
 class Message(object):
     """A message returned by ``Flash.pop_messages()``.
-    ``Message`` instances have the following attributes:
+    Converting the message to a string returns the message text. Instances
+    also have the following attributes:
     * ``message``: the message text.
     * ``category``: the category specified when the message was created.
-    Calling ``str(message)`` ``unicode(message)``, or ``message.__html__()`` 
-    returns the message text. (The latter returns an escaped literal
-    unless the message is already a literal; see 
-    ``webhelpers.html.builder``.)
     def __init__(self, category, message):